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

Re: [amibroker] AFL code query



PureBytes Links

Trading Reference Links

Thanks again Graham.  I think you have given me an idea of the problem.  The 
solution is more complicated however, because adding that loop slows things 
to a standstill in the database I'm using.  Maybe I can use an if... 
statement to arrange it so that this loop is only executed at the end of 
each day?  I only need the data on a daily basis.

chuck
----- Original Message ----- 
From: "Graham" <kavemanperth@xxxxxxxxx>
To: <amibroker@xxxxxxxxxxxxxxx>
Sent: Tuesday, October 25, 2005 8:18 PM
Subject: Re: [amibroker] AFL code query


> you would need to create an outer for loop to run the calculation for
> each bar. Then apply the POC with [bar] array identifier
>
> for( bar=1;bar<barcount;bar++)
> {
> for............your code
> {
>
> }
>
> }
>
>
> On 10/26/05, Charles Stangor <cstangor232@xxxxxxxxxxxxxxxxxx> wrote:
>>
>>
>>
>>
>> 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
>>
>>  Visit your group "amibroker" on the web.
>>
>>  To unsubscribe from this group, send an email to:
>>  amibroker-unsubscribe@xxxxxxxxxxxxxxx
>>
>>  Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.
>>  To unsubscribe from this group, send an email to:
>>  amibroker-unsubscribe@xxxxxxxxxxxxxxx
>>
>>  Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.
>>  Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.
>> ________________________________
>>
>
>
> --
> Cheers
> Graham
> AB-Write >< Professional AFL Writing Service
> Yes, I write AFL code to your requirements
> http://e-wire.net.au/~eb_kavan/ab_write.htm
>
>
>
> 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
>
>
>
>
>
> 



------------------------ Yahoo! Groups Sponsor --------------------~--> 
Try Online Currency Trading with GFT. Free 50K Demo. Trade 
24 Hours. Commission-Free. 
http://us.click.yahoo.com/RvFikB/9M2KAA/U1CZAA/GHeqlB/TM
--------------------------------------------------------------------~-> 

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

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/amibroker/

<*> To unsubscribe from this group, send an email to:
    amibroker-unsubscribe@xxxxxxxxxxxxxxx

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/