Dear All,
Here is a simple strategy, a slight improvement of my “End of Day USD/JPY“.
The timeframe is M15.
The strategy is so simple that it doesn’t need explanations (see in the code).
You can adapt the parameters, so that you can use it on USD/JPY (the best), AUD/JPY, EUR/JPY, GBP/JPY.
Regards,
// END OF DAY - YEN
// www.doctrading.fr
Defparam cumulateorders = false
// TAILLE DES POSITIONS
n = 1
// PARAMETRES
// high ratio = few positions
// AUD/JPY : ratio = 0.5 / SL = 0.8 / TP = 1.2 / Period = 12
// EUR/JPY : ratio = 0.6 / SL = 1 / TP = 0.8 / Period = 8
// GBP/JPY : ratio = 0.5 / SL = 0.6 / TP = 1 / Period = 8
// USD/JPY : ratio = 0.5 / SL = 1 / TP = 0.8 / Period = 12
ratio = 0.5
// HORAIRES
startTime = 210000
endTime = 231500
exitLongTime = 210000
exitShortTime = 80000
// STOP LOSS & TAKE PROFIT (%)
SL = 1
TP = 0.8
Period = 12
// BOUGIE REFERENCE à StartTime
if time = startTime THEN
amplitude = highest[Period](high) - lowest[Period](low)
ouverture = close
endif
// LONGS & SHORTS : every day except Fridays
// entre StartTime et EndTime
if time >= startTime and time <= endTime and dayOfWeek <> 5 then
buy n shares at ouverture - amplitude*ratio limit
sellshort n shares at ouverture + amplitude*ratio limit
endif
// Stop Loss & Take Profit
set stop %loss SL
set target %profit TP
// Exit Time
if time = exitLongTime then
sell at market
endif
if time = exitShortTime then
exitshort at market
endif
You must be logged in to post a comment.
Hi, Yes I am monitoring all the strategies posted on this site and I confirm that the strategy is a winner. However I have just turned it OFF as it iseems to have entered a less favorable market configuration; I will tell here when the Strategy can be lauched again according to my indicators. I will also check your algo; thanks for sharing ^^
Thanks Doctrading, I have modified the ratio, number of periods, close trade time slightly and it works well in backtest...particularly new trades on Sun, Mon and Tue only, across different pairs. I have also started real trading with just £1 per point, just to see how it goes. It is positive so far...BUT...any idea why the actual trades entered are much fewer than in backtest on some days? As below, overnight 6/7 June ACTUAL generated 1 trade whereas BACKTEST generated 6 trades. This is similar across different pairs and timeframes. 3/4 June and 2/3 June were fine. Am I missing something? Thanks Backtest Entry date Exit date Type Nbr Bars Abs Perf 06/06/2021 23:00 07/06/2021 04:30 Short 22 -£4.00 06/06/2021 22:45 06/06/2021 23:00 Long 1 £3.80 06/06/2021 22:30 06/06/2021 22:45 Short 1 £3.80 06/06/2021 22:00 06/06/2021 22:30 Long 2 £3.80 06/06/2021 21:45 06/06/2021 22:00 Short 1 £3.80 06/06/2021 21:30 06/06/2021 21:45 Long 1 £3.80 03/06/2021 21:00 04/06/2021 04:30 Short 30 £7.90 02/06/2021 21:30 03/06/2021 04:30 Short 28 -£10.70 01/06/2021 22:15 02/06/2021 04:30 Long 25 £16.90 Actual Entry date Exit date Type Nbr Bars Abs Perf 06/06/2021 21:59 07/06/2021 04:30 Short 29 £0.30 03/06/2021 21:00 04/06/2021 04:30 Short 32 £8.50 02/06/2021 21:35 03/06/2021 04:30 Short 30 -£10.20 01/06/2021 22:24 02/06/2021 04:30 Long 27 £18.00
Still doesnt work for me. error line 29, character 58. Anyone know what to do?
Essayez donc cette version : //---------------------------------------------- // End Of Day - USD/JPY M15 // www.doctrading.fr //---------------------------------------------- Defparam cumulateorders = false // TAILLE DES POSITIONS n = 1 // PARAMÈTRES // Plus le "ratio" monte, moins il y a de positions ratio = 0.64 // HORAIRES startTime = 210000 endTime = 231500 exitLongTime = 210000 exitShortTime = 80000 // INDICATEUR MOMENTUM OTa = Momentum[26] c1a = OTa > OTa[11] MLTa = Momentum[280] c2a = MLTa > MLTa[20] OTv = Momentum[4] c1v = OTv < OTv[5] MLTv = Momentum[180] c2v = MLTv = startTime and time <= endTime and dayOfWeek 5 and dayofweek 0 and CONDBUY then buy n shares at ouverture - amplitude*ratio limit endif if time >= startTime and time <= endTime and dayOfWeek 5 and dayofweek 0 and CONDSELL then sellshort n shares at ouverture + amplitude*ratio limit endif // Stop Loss & Take Profit set stop %loss SL set target %profit TP //set stop loss amplitude * ratioSL // Exit Time if time = exitLongTime then sell at market endif if time = exitShortTime then exitshort at market endif
Thanks for the strategy Doctrading! The updated version you have posted is really inconsistent though. Parameters are not defined, conditions are not defined, defined parameters are never used, if-statements that end but never started and so on. Would you mind taking a better look at it?
Bonjour. Le problème est que mon copier coller de dayofweek 5 supprime le "". Désolé. Il faut remettre ces "" après "dayofweek". Cordialement
//---------------------------------------------- // Code principal : End Of Day - USD/JPY M15 // www.doctrading.fr //---------------------------------------------- Defparam cumulateorders = false // TAILLE DES POSITIONS n = 1 // PARAMÈTRES // Plus le "ratio" monte, moins il y a de positions ratio = 0.64 // HORAIRES startTime = 210000 endTime = 231500 exitLongTime = 210000 exitShortTime = 80000 // INDICATEUR MOMENTUM OTa = Momentum[26] c1a = OTa > OTa[11] MLTa = Momentum[280] c2a = MLTa > MLTa[20] OTv = Momentum[4] c1v = OTv < OTv[5] MLTv = Momentum[180] c2v = MLTv = startTime and time <= endTime and dayOfWeek 5 and dayOfWeek 0 and CONDBUY then buy n shares at ouverture - amplitude*ratio limit endif if time >= startTime and time <= endTime and dayOfWeek 5 and dayOfWeek 0 and CONDSELL then sellshort n shares at ouverture + amplitude*ratio limit endif // Stop Loss & Take Profit set stop %loss SL set target %profit TP //set stop loss amplitude * ratioSL // Exit Time if time = exitLongTime then sell at market endif if time = exitShortTime then exitshort at market endif
Ouch, little bug with the code display... Here it is :
AU account losses in AU time zone, spread 2pips, so set set platform hours to Europe +2 "Paris" ON USDJPY mini, I'v back tested through the similar date rang from current period in 15mn TF 100000 units, "100000 is all you get here in Australia!" Just trades some inefficient gains and losses and then the account to zero in an nose dive! Not going to be running this with out a safety net, or ever. Altough some gains in lower tf, however i have not enough data to prove robustness. Which brings on my question. ### Quit Function ### If we have a whole or chasm is a strategy. Can we lock in gains with using the Quit function ? So far i'm only able to use Quit function to close the strategy in a negative situation, or after gains, it quit's still negative after all the hard work! which is something like, If StrategyProfit <-130 then QUIT
Hello guys, thanks for the code !
//---------------------------------------------- // Code principal : End Of Day - USD/JPY M15 // www.doctrading.fr //---------------------------------------------- Defparam cumulateorders = false // TAILLE DES POSITIONS n = 1 // PARAMÈTRES // Plus le "ratio" monte, moins il y a de positions ratio = 0.64 // HORAIRES startTime = 210000 endTime = 231500 exitLongTime = 210000 exitShortTime = 80000 // INDICATEUR MOMENTUM OTa = Momentum[26] c1a = OTa > OTa[11] MLTa = Momentum[280] c2a = MLTa > MLTa[20] OTv = Momentum[4] c1v = OTv < OTv[5] MLTv = Momentum[180] c2v = MLTv = startTime and time = startTime and time <= endTime and dayOfWeek 5 and dayOfWeek 0 and CONDSELL then sellshort n shares at ouverture + amplitude*ratio limit endif // Stop Loss & Take Profit set stop %loss SL set target %profit TP //set stop loss amplitude * ratioSL // Exit Time if time = exitLongTime then sell at market endif if time = exitShortTime then exitshort at market endif
Hi all Just a little optimization for USD/JPY M15. Nice performance since 2018, you can do what you want with it (as is it a little bit "optimized") Profit factor > 3,5. Regards,
Buongiorno doctradinge buongiorno a tutti. Vorrei riportare all'attenzione questo sistema postato tre anni fa perchè le performance sono ancora interessanti. In particolare con USD/JPY i backtest sono ottimi negli ultimi 4 mesi, soprattutto con un timeframe di 1 minuto. Se qualche membro della community ha la possibilità e la pazienza di effettuare backtest più lunghi sarebbe utile per capire se questo sistema è veramente ottimo. Di seguito propongo una mia versione aggiornata in cui ho inserito la gestione della posizione tramite il sistema KAMA & SMA proposto da Roberto tempo fa, con uno stop fisso a 30. Defparam cumulateorders = false // TAILLE DES POSITIONS n = 1 // PARAMETRES // high ratio = few positions // AUD/JPY : ratio = 0.5 / SL = 0.8 / TP = 1.2 / Period = 12 // EUR/JPY : ratio = 0.6 / SL = 1 / TP = 0.8 / Period = 8 // GBP/JPY : ratio = 0.5 / SL = 0.6 / TP = 1 / Period = 8 // USD/JPY : ratio = 0.5 / SL = 1 / TP = 0.8 / Period = 12 ratio = 0.6 period = 8 // HORAIRES startTime = 210000 endTime = 231500 exitLongTime = 210000 exitShortTime = 80000 // BOUGIE REFERENCE à StartTime if time = startTime THEN amplitude = highest[Period](high) - lowest[Period](low) ouverture = close endif // LONGS & SHORTS : every day except Fridays // entre StartTime et EndTime if time >= startTime and time <= endTime and dayOfWeek <> 5 then buy n shares at ouverture - amplitude*ratio limit sellshort n shares at ouverture + amplitude*ratio limit endif // Stop Loss & Take Profit // Stop e target //SET STOP PLOSS 25 //SET TARGET PPROFIT 13 //395 ////////////////////////////////////////////////////////////////////////////////////////////////////////// // Trailing Stop //------------------------------------------------------------------------------------ IF Not OnMarket THEN TrailStart = 10 //10 Start trailing profits from this point BasePerCent = 0.100 //10.0% Profit to keep StepSize = 6 //6 Pips chunks to increase Percentage PerCentInc = 0.100 //10.0% PerCent increment after each StepSize chunk RoundTO = -0.5 //-0.5 rounds to Lower integer, +0.4 rounds to Higher integer PriceDistance = 7 * pipsize//8.9 minimun distance from current price y1 = 0 y2 = 0 ProfitPerCent = BasePerCent ELSIF LongOnMarket AND close > (TradePrice + (y1 * pipsize)) THEN //LONG x1 = (close - tradeprice) / pipsize //convert price to pips IF x1 >= TrailStart THEN //go ahead only if N+ pips Diff1 = abs(TrailStart - x1) Chunks1 = max(0,round((Diff1 / StepSize) + RoundTO)) ProfitPerCent = BasePerCent + (BasePerCent * (Chunks1 * PerCentInc)) ProfitPerCent = max(ProfitPerCent[1],min(100,ProfitPerCent)) y1 = max(x1 * ProfitPerCent, y1) //y = % of max profit ENDIF ELSIF ShortOnMarket AND close < (TradePrice - (y2 * pipsize)) THEN//SHORT x2 = (tradeprice - close) / pipsize //convert price to pips IF x2 >= TrailStart THEN //go ahead only if N+ pips Diff2 = abs(TrailStart - x2) Chunks2 = max(0,round((Diff2 / StepSize) + RoundTO)) ProfitPerCent = BasePerCent + (BasePerCent * (Chunks2 * PerCentInc)) ProfitPerCent = max(ProfitPerCent[1],min(100,ProfitPerCent)) y2 = max(x2 * ProfitPerCent, y2) //y = % of max profit ENDIF ENDIF IF y1 THEN //Place pending STOP order when y>0 SellPrice = Tradeprice + (y1 * pipsize) //convert pips to price IF abs(close - SellPrice) > PriceDistance THEN IF close >= SellPrice THEN SELL AT SellPrice STOP ELSE SELL AT SellPrice LIMIT ENDIF ELSE SELL AT Market ENDIF ENDIF IF y2 THEN //Place pending STOP order when y>0 ExitPrice = Tradeprice - (y2 * pipsize) //convert pips to price IF abs(close - ExitPrice) > PriceDistance THEN IF close <= ExitPrice THEN EXITSHORT AT ExitPrice STOP ELSE EXITSHORT AT ExitPrice LIMIT ENDIF ELSE EXITSHORT AT Market ENDIF ENDIF set stop ploss 30