Hi,
I am struggling with a code for some time. It seems to work for some cases, but strange enough not all of the times during the backtest.
I am trying to code the following:
c1 = Moving average 20 > Moving average 50
c2 = Stochastic close [1] < 21 and stochastic close [0] >= 21
c3 = abs(bollingerup close[0] – abs(bollowingerdown close[0])>1
the combination of c1, c2 and c3 is reguired to buy a contract. Attached a screenshot of the graph with a example where I should expect a trade opening and a screenshot of the code.
As a test I changed c1, c2 and c3 variables and each time the result shows different results, so apparently all conditions seems to work.
Could please somebody take a look and see what I am doing wrong? Why does it generate trades, but not for all the situations, when c1, c2 and c3 are valid?
Thank you!