Hi
If I want too invalidate a system after a specific date in a indicator how do I get it right in the system? If I do it like this the backtest shows different result with and without the “Aktiv”. Whats wrong??
IF OpenDate > 20210501 THEN //Stoppdatum i maj
Datum = 0 //Invalidera alla signaler
ENDIF
return Datum AS "Datum"
Datum = CALL "Indicator"
Aktiv = Datum >= 1
TaPosition = c11 AND c12 AND c13 AND Aktiv
IF TaPosition THEN
BUY positionStorlek CONTRACT AT MARKET
ENDIF
Your indicator should be:
Datum = 1
IF OpenDate > 20210501 THEN //Stoppdatum i maj
Datum = 0 //Invalidera alla signaler
ENDIF
Otherwise DATUM will never retain value 1.
Thanks, missed that. But why do I get different backtest results when I use “Aktiv” in “TaPosition”?
If you are using very low TF’s, such as a few seconds, it might be that the period has canged, while you were modifying your code, so a different period will yield different results.
In any case only the real code may be investigated.
I use 1h timeframe so thats not the problem.