Is there a best practice for using BarsInProgress vs. BarsArray in a Strategy? For example, what is the difference between this:
[COLOR=blue]if[/COLOR] (EMA(BarsArray[0], eMAFastLength)[0] > EMA(BarsArray[0], eMASlowLength)[0]) baseTFLongOK = [COLOR=blue]true[/COLOR]; [COLOR=blue]else[/COLOR] baseTFLongOK = [COLOR=blue]false[/COLOR]; [COLOR=blue]if[/COLOR] (EMA(BarsArray[0], eMAFastLength)[0] < EMA(BarsArray[0], eMASlowLength)[0]) baseTFShortOK = [COLOR=blue]true[/COLOR]; [COLOR=blue]else[/COLOR] baseTFShortOK = [COLOR=blue]false[/COLOR];
[COLOR=blue]if[/COLOR] (BarsInProgress == 0) { [COLOR=blue]if[/COLOR] (EMA(eMAFastLength)[0] > EMA(eMASlowLength)[0]) baseTFLongOK = [COLOR=blue]true[/COLOR]; [COLOR=blue]else[/COLOR] baseTFLongOK = [COLOR=blue]false[/COLOR]; [COLOR=blue]if[/COLOR] (EMA(eMAFastLength)[0] < EMA(eMASlowLength)[0]) baseTFShortOK = [COLOR=blue]true[/COLOR]; [COLOR=blue]else[/COLOR] baseTFShortOK = [COLOR=blue]false[/COLOR]; }
Thanks.
Comment