Hi,
I'd like to test a system where a buy or sell order is given by a custom indicator. I need this one is below or above zero for "at least" a certain number of bars. How can I do this with the barssince function?
Let's name A my indicator, is it correct, for example: barssince(A<0)>"number of bars"? And can I optimize the variable "numer of bars.
Thank you
Regards
Marco1971
Wanna join the discussion?! Login to your Discussions forum accountor Register a new forum account.
Should work to use the opposite condition, you may also want to use 'or equal to' to rule out if the value is exactly 0:
Whenever a condition is true, it would return a value of 1, so summing a true over 3 periods should equal 3 if true for 3 periods in a row. This may be more reliable in some cases where there might not be a perfect opposite condition to consider. You can Optimize numerical values in the system tester by using OPT1, OPT2, etc. and then defining the range of numbers you want to test between within the Optimizations tab.
As in the example above:
BarsSince(A<=0)>=OPT1
or in my example:
Sum(A>0,OPT1)>=OPT1
Edited by user Tuesday, March 15, 2016 5:15:37 PM(UTC) | Reason: Not specified