Bonjour,
Je souhaite créer un indicateur graphique du drawdown equity. Je vous soumets donc une stratégie (qui ne financera pas les prochaines vacances de Nicolas ou la nouvelle voiture d’Aston, puisque ce sont les siennes qui vont tout financer :D).
Je n’ai pas réussit à trouver la bonne formule du pourcentage issu du résultat entre la balance et l’équité.
Vous avez 2h ! hahA ! (SVP mettez au moins 2h, ça fait des jours que j’essaie)
Defparam Cumulateorders = False
Rem [Points Pivots Journaliers] // Merci Noobywan, Aston
If dayofweek <> 1 THEN
Ht = DHigh(1)
Bs = DLow(1)
C = DClose(1)
Endif
If dayofweek=5 then
Htfriday=Dhigh(0)
BsFriday=Dlow(0)
CFriday=Dclose(0)
Endif
If dayofweek=1 then
Ht = Htfriday
Bs = BsFriday
C = CFriday
Endif
Pivot = (Ht + Bs + C) / 3
Res3 = Pivot + ((Ht - Bs)*2)
Res2 = Pivot + Ht - Bs
Res1 = (2 * Pivot) - Bs
//Sup1 = (2 * Pivot) - Ht
//Sup2 = Pivot - (Ht - Bs)
//Sup3 = Pivot - ((Ht - Bs)*2)
Rem [Détection de la Tendance]
C1 = close > average[1000]
Rem [Réinitialisation]
If intradaybarindex = 1 then
UnTradeParJourRes1 = 0
UnTradeParJourRes2 = 0
UnTradeParJourRes3 = 0
//UnTradeParJourPivot = 0
//UnTradeParJourSup1 = 0
//UnTradeParJourSup2 = 0
//UnTradeParJourSup3 = 0
Endif
Rem [Condition d'Achat]
//If C1 and close crosses over Sup3 and UnTradeParJourSup3 = 0 then
//buy 10 contract at market
//UnTradeParJourSup3= 1
//Endif
//If C1 and close crosses over Sup2 and UnTradeParJourSup2= 0 then
//buy 1 contract at market
//UnTradeParJourSup2= 1
//Endif
//If C1 and close crosses over Sup1 and UnTradeParJourSup1= 0 then
//buy 1 contract at market
//UnTradeParJourSup1= 1
//Endif
//If C1 and close crosses over Pivot and UnTradeParJourPivot= 0 then
//buy 1 contract at market
//UnTradeParJourPivot= 1
//Endif
If C1 and close crosses over Res1 and UnTradeParJourRes1 = 0 then
buy 10 contract at market
UnTradeParJourRes1= 1
Elsif C1 and close crosses over Res2 and UnTradeParJourRes2 = 0 then
buy 10 contract at market
UnTradeParJourRes2= 1
Elsif C1 and close crosses over Res3 and UnTradeParJourRes3= 0 then
buy 10 contract at market
UnTradeParJourRes3= 1
Endif
Rem [Conditions de Sortie]
If longonmarket and close < dlow(1) and dayofweek <> 1 then
sell at market
Elsif longonmarket and dayofweek = 1 and close < bsfriday then
sell at market
Endif
Rem [Drawdown Equity]
Floatingprofit = (((close-positionprice)*pointvalue)*countofposition)/pipsize + strategyprofit // Thanks Grizzly, Nicolas
DrawdownEquity = (((strategyprofit)/Floatingprofit)-1)*(-100)
LevelZero = 0
If DrawdownEquity > 0 then
DrawdownEquityPositive = 1
Else
DrawdownEquityPositive = 0
Endif
If DrawdownEquityPositive = 1 then
Red = 0
Green = DrawdownEquity
Else
Green = 0
Red = DrawdownEquity
Endif
Rem [Graph]
graph Green coloured (0,255,0)
graph Red coloured (255,0,0)
graph Levelzero coloured (0,0,0)
Moi je verrai cela plutôt comme ça:
InitialCapital = 10000
Floatingprofit = (((close-positionprice)*pointvalue)*countofposition)/pipsize
DrawdownEquity = Floatingprofit/(strategyprofit+InitialCapital)*100
On a ainsi la véritable équité en fonction des profits acquis et du capital initial. Ensuite on peut en déterminer en pourcentage le gain du/des trades actuels.