I am trying to set a variable LongTrade to 1 for the first buy signal and
stay zero till the next sell signal. I cannot use exrem, as my sell signal
is dependant on querying the indicators when the first buy signal occurred.
StaticVarSet("LongTrade",IIf(Buy AND Nz(StaticVarGet("LongTrade"))==0,1,0));
But LongTrade is behaving exactly like the Buy array.
Example, if my buy array is like 1,1,1,0,0,1,1 the LongTrade variable is
also 1,1,1,0,0,1,1 - I would expect it to be 1,0,0,0,0,0,0 till sell signal
occurs at which time it would be ready to be set to 1 by the next buy
signal.
Am I making an elementary error here? Appreciate directions.
Thanks,
Pankaj