I have made a lot of strategies now.
In a lot of strats, stuff is calculated for certain periods back.
Lets say I want to check if an indicator is below 40 for the last 10 bars.
When using COBC I can do that by 2 different ways:
1 at every current bar calculate it for 10 bars back (e.g. with a For loop)
2 or just simple check it at every bar and "stack" the number of bars in a counter.
I have used option 1 a lot but lately I am using option 2 more in my strats.
The reason is that I want to program lean and mean and ask as less as possible from the CPU (specially when COBC=false), but also don't want to get problems while backtesting.
Can someone give some advise what's the best way?
So I can program it for the future directly in the best way.
Tia.
Anne

Comment