Error

 Previous Topic Next Topic
 marco1971 #1 Posted : Tuesday, March 15, 2016 3:31:03 PM(UTC) Rank: NewbieGroups: Registered Users, SubscribersJoined: 3/15/2016(UTC)Posts: 1 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.
 MS Support #2 Posted : Tuesday, March 15, 2016 5:10:43 PM(UTC) Rank: Advanced MemberGroups: Moderators, Registered, Registered Users, SubscribersJoined: 10/8/2010(UTC)Posts: 1,949Thanks: 89 timesWas thanked: 155 time(s) in 150 post(s) 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: BarsSince(A<=0)>=3 Another option might be to Sum the condition over a number of periods, i.e.: Sum(A>0,3)>=3 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)>=OPT1Edited by user Tuesday, March 15, 2016 5:15:37 PM(UTC)  | Reason: Not specified
 Users browsing this topic