We buy when the price is below the EMA200 and above the EMA50 (sik!).
As a filter we use a simple linear regression slope.
We sell when the price is above the EMA28 and below the EMA7.
It really couldn’t be easier
thats all for today
until then
//-------------------------------------------------------------------------
// maincode : everytimelong g50 k100 lrs
//-------------------------------------------------------------------------
// ger40 longonly strategie
// timezone europe, berlin
// timeframe 4h
// created and coded by johnscher
defparam cumulateorders = true // false is working well
once ordersize = 1
TradingDay = Opendayofweek = 1 or Opendayofweek = 2 or Opendayofweek = 3 or Opendayofweek = 4 or Opendayofweek = 5
TradingTime = time >= 090000 and time <= 170000
c1 = close > Exponentialaverage [50] (close)
c2 = close < Exponentialaverage [100] (close)
c3 = close > close [1]
c4 = LinearRegressionSlope[100] (close) < 0
IF TradingDay and TradingTime then
If c1 and c2 and c3 and c4 then
buy ordersize contract at market
Endif
ENDIF
c5 = close < Exponentialaverage [7] (close)
c6 = close > Exponentialaverage [28] (close)
IF longonmarket then
If c5 and c6 then
sell at market
Endif
Endif
Set Stop %Loss 10 //as insurance
Set Target %profit 2.75
You must be logged in to post a comment.
Hi John, Is your strategy suitable for daily SPY? Regards
I found this works well on the DOW
SCUSA . ECCO IL CODICE defparam cumulateorders = true // false is working well once ordersize = 1 TradingDay = ((dayofweek=1 and (time=050000 or time=090000 or time=130000 or time=170000)) or (dayofweek=2 and (time=010000 or time=050000 or time=130000 or time=170000)) or (dayofweek=3 and (time=090000 or time=130000 or time=210000)) or (dayofweek=4 and time=050000) or (dayofweek=5 and (time=010000 or time=090000 or time=130000 or time=170000))) //TradingTime = time >= 090000 and time <= 170000 c1 = close > Exponentialaverage [45] (close) c2 = close < Exponentialaverage [100] (close) c3 = close > close [1] c4 = LinearRegressionSlope[95] (close) < 0 IF TradingDay then If c1 and c2 and c3 and c4 then buy ordersize contract at market Endif ENDIF c5 = close < Exponentialaverage [9] (close) c6 = close > Exponentialaverage [21] (close) IF longonmarket then If c5 and c6 then sell at market Endif Endif Set Stop %Loss 5.50 //as insurance Set Target %profit 2.75 //***************************************************************** if close>open then marginebv=low-130 elsif close<open then marginebv= low-115 endif //tp=300 //stopbv=200 //acquistobreck= LOW-margine //acquistobv= close -marginebv if longonmarket then sell at marginebv stop endif
Ciao John. grazie per la condivisione. Sul DAX A 4 H HO FATTO PICCOLE MODIFICHE E RISULTATI SONO OTTIMI ANCHE CON NOTIZIE NEGATIVE COME LA GUERRA IN UCRAINA, TI COPIO DI SEGUITO IL CODICE: defparam cumulateorders = true // false is working well once ordersize = 1 TradingDay = ((dayofweek=1 and (time=050000 or time=090000 or time=130000 or time=170000)) or (dayofweek=2 and (time=010000 or time=050000 or time=130000 or time=170000)) or (dayofweek=3 and (time=090000 or time=130000 or time=210000)) or (dayofweek=4 and time=050000) or (dayofweek=5 and (time=010000 or time=090000 or time=130000 or time=170000))) //TradingTime = time >= 090000 and time Exponentialaverage [45] (close) c2 = close close [1] c4 = LinearRegressionSlope[95] (close) < 0 IF TradingDay then If c1 and c2 and c3 and c4 then buy ordersize contract at market Endif ENDIF c5 = close Exponentialaverage [21] (close) IF longonmarket then If c5 and c6 then sell at market Endif Endif Set Stop %Loss 5.50 //as insurance Set Target %profit 2.75 //***************************************************************** if close>open then marginebv=low-130 elsif close<open then marginebv= low-115 endif //tp=300 //stopbv=200 //acquistobreck= LOW-margine //acquistobv= close -marginebv if longonmarket then sell at marginebv stop endif
Da error en la linea 9 :-(
One of my best strategies... very simple, easy to remember, and can be implemented manually. Please run a backtest today... it is “out of sample,” so to speak runs on de40 4H