Bonjour,
Voici ma nouvelle stratégie pour le CAC40 (FRANCE40 chez IG) sur 1 minute et étudiée sur 10 000 bougies car je ne souhaite pas intégrer la période du COVID car la volatilité était forte. Je pense qu’il faut réactuliser les variables gains et stoploss tous les 10 000 bougies. Mon but est de faire beaucoup de trades avec des gains raisonnables et des pertes raisonnables. J’ai utilisé la supertrend intégrée à prorealtime en multiframe, peut-être faudrait-il la remplacer par la formule de calcul de l’angle et de la pente ?? Si il y a des passionnés de programmation qui peuvent améliorer ma stratégie, ce serait sympa. Je suis dispo pour toute question.
REM PARAMETRES
defparam cumulateorders=false
//defparam flatbefore=082900
defparam preloadbars=10000
Defparam flatafter=215900
timeframe(1 minute)
n=3
IF time<083000 or time>211000 then
journee=0
else
journee=1
endif
REM GAINS
gain=highest[32]-lowest[27]
gain2=highest[1]-lowest[1]
IF time>163000 or time<070000 then
gain2=10
gain=15
endif
REM PERTES
if time>163000 OR TIME<083000 then
set stop loss 20
else
set stop loss 36
endif
REM TENDANCES EN 12 MINUTES CROISEE AVEC 1 MINUTE
timeframe (12 minute)
if Supertrend[2,1]<close or supertrend[4,1]>close or close[100]<close[53] then
mont2=1
else
mont2=0
endif
if shortonmarket and (tradeprice-close)<0 then
mont2=0
endif
if Supertrend[1,1]>close or supertrend[2,1]>close or close[15]>close then
desc2=1
else
desc2=0
endif
timeframe (1 minute)
if Supertrend[4,7]<close or supertrend[19,2]<close or ((close[120]-close)>80) then
mont=1
else
mont=0
endif
if shortonmarket and (tradeprice-close)<0 then
mont=0
endif
if Supertrend[19,2]>close or supertrend[16,3]>close or ((close-close[380])>145) then
desc=1
else
desc=0
endif
REM STOCHASTIQUE TIME SERIES
p=20
q=2
plusHaut = HIGHEST[p](HIGH)
plusBas = LOWEST[p](LOW)
oscillateur = (CLOSE - plusBas) / (plusHaut - plusBas) * 100
K = AVERAGE[q,6](oscillateur)
REM CALCUL NB BOUGIES MEME COULEUR
u=9
w=8
descente=0
for z=1 to u do
if open[z]>close[z] then
descente=descente+1
endif
next
if descente>=w then
stopvente=0
else
stopvente=1
endif
t=11
v=10
montee=0
for y=1 to T do
if open[y]<close[y] then
montee=montee+1
endif
next
if montee>=V then
stopachat=0
else
stopachat=1
endif
REM CALCUL DE LA CLOTURE
ecartclot=(time+63000)/166.66
cloturehier=close[ecartclot]
rem INTERDICTIONS MATHEMATIQUES
IF K[1]<-10 or stopvente=0 or (close[720]-close)>60 or (close[85]-close)>28 or (Average[15](close)-close[2]>8) or close<(dopen(0)-69) or close<(cloturehier-36) then
stopv=1
else
stopv=0
endif
if (close-lowest[40])>80 OR K[1]>95 or stopachat=0 OR (close-close[720])>168 or (close-close[77])>52 or (close[3]-Average[18](close)>6) or close>(dlow(0)+80) or close>(cloturehier+81) then
stopa=1
else
stopa=0
endif
REM INTERDICTIONS TEMPORELLES
if (time>073000 and time<082000) or (time>112000 and time<123000) or (time>150000 and time<153000) or (time>162500 and time<180000) then
stoptimea=1
else
stoptimea=0
endif
if (time>100000 and time<110000) or (time>121500 and time<131500) or (time>153000 and time<163000) or (time>083500 and time<091500) or (dayofweek=1 and time<120000) OR TIME<083000 OR time>200000 then
stoptimev=1
else
stoptimev=0
endif
REM ACHAT
IF open[2]<close[2] and mont=1 and mont2=1 and JOURNEE=1 and stopa=0 and stoptimea=0 and acha=1 then
buy n share at market
set target profit gain
lastorder=0
endif
REM VENTE
if not onmarket and open[2]>close[2] and open[1]>close[1] and desc=1 and journee=1 and vent=1 and desc2=1 and stopv=0 and stoptimev=0 then
sellshort n share at market
set target profit gain2
lastorder=1
endif
REM CLOTURE SI CHANGEMENT DE TENDANCE
if longonmarket and desc=1 and journee=1 and stopv=0 and stoptimev=0 and vent=1 and desc2=1 and (barindex-tradeindex)>1 and (close-tradeprice)>0 then
sell at market
lastorder=1
endif
if shortonmarket and mont=1 and mont2=1 and stopa=0 and journee=1 and stoptimea=0 and acha=1 and (barindex-tradeindex)>1 and (tradeprice-close)>0 then
exitshort at market
lastorder=0
endif
if mont=1 and mont2=1 and journee=1 and stopa=0 and shortonmarket and (tradeprice-close)>1 then
exitshort at market
lastorder=0
endif
if desc=1 and desc2=1 and longonmarket and (close-tradeprice)>1 then
sell at market
endif
REM CLOTURE POUR GAIN RAPIDE
if longonmarket and (barindex-tradeindex)<3 and (close-tradeprice)>8 then
sell at market
endif
if shortonmarket and (barindex-tradeindex)<3 and (tradeprice-close)>8 then
exitshort at market
endif
IF longonmarket and (barindex-tradeindex)>146 and (close-tradeprice)>0 then
sell at market
endif
if shortonmarket and (barindex-tradeindex)>80 and (tradeprice-close)>0 then
exitshort at market
endif
REM INTERDICTION DU MEME ORDRE SI TROP ELOIGNE
if (close-tradeprice)>34 and lastorder=0 then
acha=0
else
acha=1
endif
if (tradeprice-close)>7 and lastorder=1 then
vent=0
else
vent=1
endif
REM CLOTURE ANTICIPEE
if longonmarket and (close-tradeprice)>6 and (barindex-tradeindex)<4 then
sell at market
endif
if shortonmarket and (tradeprice-close)>4 and (barindex-tradeindex)<=1 then
exitshort at market
endif
if shortonmarket and (tradeprice-close)>13 and (barindex-tradeindex)>46 then
exitshort at market
endif
if longonmarket and (close-tradeprice)>1 and (barindex-tradeindex)>138 then
sell at market
endif
if longonmarket and (close-tradeprice)>-1 and (barindex-tradeindex)>92 then
sell at market
endif
if shortonmarket and (tradeprice-close)>-5 and (barindex-tradeindex)>80 then
exitshort at market
endif
Je précise que le résultat obtenu est avec :
-1- un créneau horaire d’Angleterre à H+1 (actuellement H+2 en France), donc 16h30 dans mon code veut dire 17h30 en France
Il faut donc soit que vous rajoutiez 1 heure au code soit que vous mettiez votre plateforme en heure britannique
-2- 1000€ de capital suffisent car je ne joue que 3 mini contrats ne demandant que 750 € de couverture environ
Ci-joint performance du jour au 10/07/2020 avec 1000 € de capital en début de backtest
Il est possible d’ajouter des filtres de volatilité pour éviter les trades durant une période comme celle du corona.
Tu pourras avoir une stratégie testable sur une horizon plus longue et plus représentatives du marché.
Surtout qu’en ce moment les marchés sont encore bien différent de la période pérenne de fin 2019/début 2020.
Peut on utiliser cette stratégie pour trader le gold ?
Bonjour, non c’est une stratégie de trader sur le cac 40, qui suit un peu le Dow Jones mais je ne pense pas que l’or ou les matières premières suivent le cours du Dow Jones