Ok, I’ll add the short side soon!
The curve and results for 5th down from the top look just as good!?
I know it’s only 10k bars, but I’m trying out a different kind of trading … Auto Entry and Manual Exit if / when needed?
There will be no need for manual exit on this one though if a weekly optimise keeps the Live results above that critical Gain / Loss ratio of 2 ish.
Both sides:
DEFPARAM CumulateOrders = false
MinLookBack = 2 //2 crossing must have occured at least these bars before PullBack
MaxLookBack = 17 //17 crossing must have occured at most these bars before PullBack
MA50 = average[50,1](close)//50,1
// LONG side
x = close crosses over ma50
IF x OR (close > MA50 AND low < MA50) THEN //when a pullback occurs...
IF summation[MinLookBack](x[1]) = 0 THEN
IF summation[MaxLookBack](x[MinLookBack + 1]) AND Not OnMarket AND close > open THEN
BUY 1 CONTRACT AT MARKET
SET STOP pLOSS 50 //50
SET TARGET pPROFIT 300 //300
ENDIF
ENDIF
ENDIF
// SHORT side
x = close crosses under ma50
IF x OR (close < MA50 AND high > MA50) THEN //when a pullback occurs...
IF summation[MinLookBack](x[1]) = 0 THEN
IF summation[MaxLookBack](x[MinLookBack + 1]) AND Not OnMarket AND close < open THEN
SELLSHORT 1 CONTRACT AT MARKET
SET STOP pLOSS 50 //50
SET TARGET pPROFIT 300 //300
ENDIF
ENDIF
ENDIF
There you go (not tested):
DEFPARAM CumulateOrders = false
MinLookBack = 2 //2 crossing must have occured at least these bars before PullBack
MaxLookBack = 17 //17 crossing must have occured at most these bars before PullBack
MA50 = average[50,1](close)//50,1
MA20 = average[20,1](close)//20,1
// LONG side
x = close crosses over ma50
y = close crosses over ma20
IF x OR (close > MA50 AND low < MA50) THEN //when a pullback occurs...
IF summation[MinLookBack](y[1]) = 0 THEN
IF summation[MaxLookBack](y[MinLookBack + 1]) AND Not OnMarket AND close > open THEN
BUY 1 CONTRACT AT MARKET
SET STOP pLOSS 50 //50
SET TARGET pPROFIT 300 //300
ENDIF
ENDIF
ENDIF
// SHORT side
x = close crosses under ma50
y = close crosses under ma20
IF x OR (close < MA50 AND high > MA50) THEN //when a pullback occurs...
IF summation[MinLookBack](y[1]) = 0 THEN
IF summation[MaxLookBack](y[MinLookBack + 1]) AND Not OnMarket AND close < open THEN
SELLSHORT 1 CONTRACT AT MARKET
SET STOP pLOSS 50 //50
SET TARGET pPROFIT 300 //300
ENDIF
ENDIF
ENDIF