Hi all, I’ve tried with one friend to create a TS that is robust and could work on different index.
Here is a trading strategy to be run on 1 hour time-frame.
HOW IT WORKS?
Long entry if supertrend is short and the price goes over the EMA. Closing under the Bollinger bands middle.
Exit long if supertrend is long and the price goes under the EMA and the closure is under the Bollinger bands middle.
BEFORE TESTING:
Only thing to be chosen before run the backtest is the number of contracts, the starting time and end time.
The starting and end time is there to avoid to insert orders when spread during night time is too high.
SUGGESTIONS:
For DAX, EUROSTOX, CAC I suggest starting time 8 and end time 22.
For MIB I suggest starting time 8 and end time 18.
For GOLD and WTI starting time 0 and end time 24 (spread is always the same).
QUESTIONS:
Is there someone that can do a montecarlo forward test on this code?
any comments or Idea? I have also a version with money management but that would be a second step.
defparam cumulateorders = false
//PARAMETRI VARIABILI
OraInizio =8
OraFine = 22
numerocontratti = 1
//PARAMETRI FISSI
mm = 10
BB = 25
ATRvolaDown = 15
ATRvolaUp = 425
ATR = 14
x = 2.5
supertrendLow = 3
SupertrendUp = 10
EMA=exponentialaverage[mm](close)
BBmiddle= (BollingerUp[BB](close)+BollingerDown[BB](close))/2
ora=currenthour
condizioneday= ora > OraInizio and ora < OraFine
condizionevola= AverageTrueRange[ATRvolaDown](close)>AverageTrueRange[ATRvolaUp](close)
// Condizioni per entrare su posizioni long
IF NOT LongOnMarket and condizioneday and Close < Supertrend[supertrendLow,SupertrendUp] and close > ema and condizionevola THEN
BUY numerocontratti CONTRACTS AT MARKET
stopprice=AverageTrueRange[ATR](close)*x
ENDIF
// Condizioni per uscire da posizioni long
If LongOnMarket AND Close > Supertrend[supertrendLow,SupertrendUp] and close < BBmiddle and close < EMA THEN
SELL AT MARKET
ENDIF
// Condizioni per entrare su posizioni short
IF NOT ShortOnMarket and condizioneday and Close > Supertrend[supertrendLow,SupertrendUp] and close < ema and condizionevola THEN
SELLSHORT numerocontratti CONTRACTS AT MARKET
stopprice=AverageTrueRange[ATR](close)*x
ENDIF
// Condizioni per uscire da posizioni short
IF ShortOnMarket AND Close < Supertrend[supertrendLow,SupertrendUp] and close > BBmiddle and close > ema THEN
EXITSHORT AT MARKET
ENDIF
// Stop e target: Inserisci qui i tuoi stop di protezione e profit target
set stop ploss stopprice
You must be logged in to post a comment.
Hi Nicolas! thanks for testing with montecarlo!! I think that best index to use are CAC WTI MIB and DAX. I am running it on test IG to see if real orders are like the backtested and for the moment it seems like this. If you will think that the system could be good I will share another code to avoid exit during the night for those index with increasing of the spread. Let me know if you want me to change the code in english... I saw only now that it is in italian. Sorry.
Hi have another setup for this that was the original one:
//FIXED PARAMETERS
mm = 10
BB = 20
ATRvolaDown = 10
ATRvolaUp = 40
ATR = 14
x = 2
supertrendLow = 3
SupertrendUp = 10
These parameters should not have any curve fitted problems...
@doctortrading... any suggestions to improve it?
David
On prorealtime CFD, you can test the strategy since May 2006.
The results are interesting.
It's winning since 2009, with a drawdown from August 2013 to December 2014.
Thanks for sharing.
Regards,
no, not in teh code... only in the backtest. The entry is only between 8/22 so the spread for dax is 1 for most of the trades and 2 for the ones after 18.00 and before 22.00