[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[amibroker] AFL code query



PureBytes Links

Trading Reference Links

 

I'm hoping one of you AFL experts might help me.  I have the following code which creates a market profile plot.  It also calculates a variable, POC (point of control), which is updated throughout the day.  The value of POC at the end of the day should be maintained for future days' reference, but this does not happen, because the calculations on following days change it. 

Can someone see (1) how to prevent these calculations on day n+1 from influencing the calculations on day n, and/or (2) how to save the variable POC at the end of each day for future use?  Thanks in advance.

 

 

PeriodTime=0; MaxPrice = 0; POC = 0;

for (i = SelectedValue(DayHighPrice) - SelectedValue(DayLowprice); i>=0; i=i-Increment) //Loop across prices

{printf ("\n" + WriteVal (Daylowprice+i, 5.2)+ ": ");

for (j = 1; j <= SelectedValue(Min(CurrentBar2, NumPeriods)); j++) //Loop across time periods

{

PriceInPeriod = DayLowprice+i >= ValueWhen(currentBar2 == j, Barlow2) AND DayLowprice+i <= ValueWhen(currentBar2 == j, BarHigh2);

PeriodTime[i] = periodtime[i]+SelectedValue(PriceinPeriod); //Sum number of times for the price

Char = "";

if (j==1) {Char = "A";} if (j==2) {Char = "B";} if (j==3) {Char = "C";} if (j==4) {Char = "D";} if (j==5) {Char = "E";}

if (j==6) {Char = "F";} if (j==7) {Char = "G";} if (j==8) {Char = "H";} if (j==9) {Char = "I";} if (j==10) {Char = "J";}

if (j==11) {Char = "K";} if (j==12) {Char = "L";} if (j==13) {Char = "M";}

Char = WriteIf(PriceInPeriod, Char, "");

printf (Char);

}

Tprice=Max(Periodtime[i], Maxprice);

POC = IIf(Periodtime[i] > MaxPrice, DayLowPrice+i, poc);

MaxPrice = TPrice;

}



Please note that this group is for discussion between users only.

To get support from AmiBroker please send an e-mail directly to
SUPPORT {at} amibroker.com

For other support material please check also:
http://www.amibroker.com/support.html





YAHOO! GROUPS LINKS