Oh great, thanks for the feedback.
please, can someone try to explain why this happens, i really dont get it !
When i backtest the strategy it goes SHORT but automatic trading took a LONG today….
buongiorno paolo volevo mostrarti alcune modifiche sul tuo lavoro , io sono neofita ho appena iniziato a capirci qualcosa ,
quindi mi scuserai se mostro cavolate , ho fatto anche il djons a 10 minuti e funziona bene , i dati che ti mostro sono non più di un anno ma li ho testi anche sui 2 anni e funzionano bene .
ho escluso il Trailing stop da tutti perché funziona meglio e da risultati migliori .
domani inizio a metterli sul reale con piccola size , cosa ne pensi ?
grazie ancora x il lavoro che hai svolto
eugenio
scusa dimenticavo ho fatto tutti i conti e la resa dei mesi del 2018 e ho notato che il mese di agosto non è da tradare ,
ho escluso gennaio che non rende
guarda i risultati e dimmi cosa ne pensi
grazie
eugenio
chiaramente mi piacerebbe un opinione anche da tutti ,
sempre ne valga la pena
grazie
eugenio
@eugenio
sul forum inglese scrivi in inglese. Grazie.
I apologize again in English
hello paolo I wanted to show you some changes on your work, I’m neophyte I just started to understand something,
so you will excuse me if I show stupid things, I have also done the djons 10 minutes and it works well, the data I show you are not more than a year but I have them even on 2 years and they work well.
I have excluded the Trailing stop from everyone because it works better and results better.
Tomorrow I start to put them on the real with a small size, what do you think?
I made all the accounts and the yield of the months of 2018 and I noticed that the month of August is not to be traded,
I excluded January that does not make
thanks again for the work you have done
clearly I would like an opinion from everyone,
eugenio
Hi,
can you share the strategy version for SP500 ?
@eugenio: It could be a solution, but I preferred to do an optimization to keep high percentage of positive trade minimizing the DD. So I kept the trailing.
thanks
//-------------------------------------------------------------------------
// Main code : Open SP500 3 minuti NY
//------------------------------------------------------------------------
// Common Rules
Defparam Cumulateorders = False
Defparam Preloadbars = 1000
// On/off
Extratradecriteria = 1 // I.e. Long; Only Enters When The Current Bar High Is Lower Then The Lowest Daily High From Today, Yesterday And Day Before.
Usepercentage = 0 // The Minimum Difference In Percentage [[1] From Dayopen Or In Points [0] From Dayopen
Mfetrailing = 1 // Mfe Trailing Stop
Wtrailing = 1 // Williams 3 Bar Trailing Stop
Breakevenstop = 1 // Breakevenstop, Move Stoploss When Position Is In Profit.
Excludefirsttwoweeks = 1 // Exclude The First 2 Weeks Of Every Year (Weeknumber 1 And 2)
// Settings
Positionsize = 10
SL = 0.5 // % Stoploss
PT = 1.30 // % Profit Target
MFETS = 2// % Mfe Trailing Stop
BES = 2 // % Break Even Stop
BESMP = 2 // % Break Even Stop Minimum Profit
WTSMP = 2 // % Williams Trailing Stop Minimum Profit If Mfe Trailing Stop Is Not Used
ETD = 0 // Exclude a Trade Day; Sunday = 0
If Usepercentage Then
Nopl=((Dayopen*0.15)/100)/pointsize
Nops=((Dayopen*0.15)/100)/pointsize
Else
Nopl=4 //number of points long
Nops=5//number of points short
Endif
// Day & Time
Once Entertime = 153000
Once Lasttime = 160000
Once Closetime = 240000 // Greater Then 23.59 Means It Continues Position Overnight
Once Closetimefr=220000
If Excludefirsttwoweeks=1 Then
If Year=2015 And Month=1 And (Day>=1 And Day<=18) Then
Notrading = 1
Elsif Year=2016 And Month=1 And (Day>=1 And Day<=24) Then
Notrading = 1
Elsif Year=2017 And Month=1 And (Day>=1 And Day<=22) Then
Notrading = 1
Elsif Year=2018 And Month=1 And (Day>=1 And Day<=21) Then
Notrading = 1
Elsif Year=2019 And Month=1 And (Day>=1 And Day<=20) Then
Notrading = 1
Else
Notrading = 0
Endif
Endif
Tt1 = Time >= Entertime
Tt2 = Time <= Lasttime
Tradetime = Tt1 And Tt2 and Notrading = 0 And Dayofweek <> ETD
// Reset At Start
If Intradaybarindex = 0 Then
Longtradecounter = 0
Shorttradecounter = 0
Tradecounter = 0
Mclong = 0
Mcshort = 0
Endif
// [pc] Position Criteria
Pclong = Countoflongshares < 1 And Longtradecounter < 1 And Tradecounter < 1
Pcshort = Countofshortshares < 1 And Shorttradecounter < 1 And Tradecounter < 1
// [mc] Main Criteria
If Time = Entertime Then
Dayopen=open
Endif
If High > Dayopen+nopl Then
Mclong=1
Else
Mclong=0
Endif
If Low < Dayopen-nops Then
Mcshort=1
Else
Mcshort=0
Endif
// [ec] Extra Criteria
If Extratradecriteria Then
Min1 = Min(Dhigh(0),dhigh(1))
Min2 = Min(Dhigh(1),dhigh(2))
Max1 = Max(Dlow(0),dlow(1))
Max2 = Max(Dlow(1),dlow(2))
Eclong = High < Min(Min1,min2)
Ecshort = Low > Max(Max1,max2)
else
Eclong=1
Ecshort=1
Endif
// Long & Short Entry
If Tradetime Then
If Pclong and Mclong And Eclong Then
Buy Positionsize Contract At Market
Longtradecounter=longtradecounter + 1
Tradecounter=tradecounter+1
Endif
If Pcshort and Mcshort And Ecshort Then
Sellshort Positionsize Contract At Market
Shorttradecounter=shorttradecounter + 1
Tradecounter=tradecounter+1
Endif
Endif
// Break Even Stop
If Breakevenstop Then
If Not Onmarket Then
Newsl=0
Endif
If Longonmarket And close-tradeprice(1)>=((Tradeprice/100)*BES)*pipsize Then
Newsl = Tradeprice(1)+((Tradeprice/100)*BESMP)*pipsize
Endif
If Shortonmarket And Tradeprice(1)-close>=((Tradeprice/100)*BES)*pipsize Then
Newsl = Tradeprice(1)-((Tradeprice/100)*BESMP)*pipsize
Endif
If Newsl>0 Then
Sell At Newsl Stop
Exitshort At Newsl Stop
Endif
Endif
// Exit Mfe Trailing Stop
If Mfetrailing Then
Trailingstop = (Tradeprice/100)*MFETS
If Not Onmarket Then
Maxprice = 0
Minprice = Close
Priceexit = 0
Endif
If Longonmarket Then
Maxprice = Max(Maxprice,close)
If Maxprice-tradeprice(1)>=trailingstop*pipsize Then
Priceexit = Maxprice-trailingstop*pipsize
Endif
Endif
If Shortonmarket Then
Minprice = Min(Minprice,close)
If Tradeprice(1)-minprice>=trailingstop*pipsize Then
Priceexit = Minprice+trailingstop*pipsize
Endif
Endif
If Onmarket And Wtrailing=0 And Priceexit>0 Then
Sell At Market
Exitshort At Market
Endif
Endif
// Exit Williams Trailing Stop
If Wtrailing Then
Count=1
I=0
J=i+1
Tot=0
While Count<4 Do
Tot=tot+1
If (Low[j]>=low[i]) And (High[j]<=high[i]) Then
J=j+1
Else
Count=count+1
I=i+1
J=i+1
Endif
Wend
Basso=lowest[tot](Low)
Alto=highest[tot](High)
If Close>alto[1] Then
Ref=basso
Endif
If Close<basso[1] Then
Ref=alto
Endif
If Onmarket And Mfetrailing=0 And Positionperf>WTSMP Then
If Low[1]>ref And High<ref Then
Sell At Market
Endif
If High[1]<ref And Low>ref Then
Exitshort At Market
Endif
Endif
If Onmarket And Mfetrailing=1 And Priceexit>0 Then
If High<ref Then
Sell At Market
Endif
If Low>ref Then
Exitshort At Market
Endif
Endif
Endif
// Exit At Closetime
If Onmarket Then
If Time >= Closetime Then
Sell At Market
Exitshort At Market
Endif
Endif
// Exit At Closetime Friday
If Onmarket Then
If (Currentdayofweek=5 And Time>=closetimefr) Then
Sell At Market
Exitshort At Market
Endif
Endif
// Build-in Exit
Set Stop %loss SL
Set Target %profit PT
eugenio – Please use the ‘Insert PRT Code’ button when putting code in your posts as it makes it far easier for others to read. I have tidied up your post for you. 🙂
Attaching an exported ITF file can also be a useful alternative when the code is quite large.
good morning ,
I did not know, you tell me where I find ‘Insert PRT Code’ button?
thanks for the instruction, unfortunately I’m new on this forum
eugenio
PaulParticipant
Master
@eugenio
Thanks for posting!
I like to keep the mfe trailing stop and the breakeven.
It may look that the total results are better with trailing stop disabled, but are you ready to see a gain nearing a profit target go back to your stoploss level?
A SL too small may get you out quickly.
a correction in the code
// Long & Short Entry
If not onmarket and Tradetime Then
true what you say Paul, but the results speak clearly, the trailing too many times affect the overall gain, if I know, as from the test that the total and greater gain I prefer lose,
clearly this consideration is very personal, so I fully share your expression, you did well to put the trailing stop, then it’s up to everyone to do what they think.
however, the fact remains that your work is fantastic.
Have you already used it in real?
I start tomorrow
Thanks again
eugenio
eugenio – This is where you find the ‘Insert PRT Code’ button.
[attachment file=86202]
PaulParticipant
Master
Yes, i’am running it live and the results are similar to the backtest!
A trailing stop, especially the small one, can get you out quickly.
If you prefer to disable the trailing stop, you can still use the breakeven.
i.e. when a position is in profit for 0.35% it moves the breakeven stop from -1.00 to -.0.50%
At a quick glance, it improves the results.
edit; tested the sp500 3min