I went through Understaning AFL tutorial again. I am not using any loops in the system and have coded the entire system using readymade functions like ValueWhen() HighesSince() etc. The above code works but from 2nd day onwards. This is because highestSince(BuyRange, Buy==sigScaleOut) returns a value that is printed as 0 but is NOT 0. This happens when there are no occurence of Buy==sigScaleOut yet (first day). Due to which some other code is not working and resultantly my p/l code also fails. Can you tell me what is returned by HighestSince(cond1, array1) when condition1 has not occurred even once till then. _trace reports it as 0 but _trace(“val=”+(val==0)) reports val=0 which means HighestSince is not returning 0.
sorry, The above should read :
This is because highestSince(BuyRange, Buy==sigScaleOut) returns a value that is printed as 0 but is NOT 0.
This happens when there are no occurrence of BuyRange yet (first day).
As posted before, debug your AFL. Instead of asking what will return HighestSince, why not Plot the result and find out by yourself! This is called debug.