Doctrading

End Of Day - YEN M15

Category: Strategies By: Doctrading Created: May 22, 2020, 10:37 AM
May 22, 2020, 10:37 AM
Strategies
39 Comments
End Of Day - YEN M15

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

Download
Filename: End-Of-Day-YEN-M15.itf
Downloads: 951
Doctrading
Doctrading Master
Hello, I'm Marc. Nice to meet you.
Author’s Profile

Comments

Stanko
4 years ago
#

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

Meta Signals Pro
3 years ago
#

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 ^^

Giddy
5 years ago
#

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

jissey
5 years ago
#

Bonjour Doctrading, avez-vous un programme qui tourne en réel depuis plus d'un an et comparer les résultats avec un backtest au jour J ? Sont_ils approchant ? Merci , cordialement.

Luciole
6 years ago
#

Account goes emptied in 2 trades. Non of the 3 versions you posted are valid code. Thanks to explain what the code should do with days. dayOfWeek seems messed up.

FernetTrader
6 years ago
#

Still doesnt work for me. error line 29, character 58. Anyone know what to do?

Doctrading
6 years ago
#

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

Jogn
6 years ago
#

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?

Doctrading
6 years ago
#

Bonjour. Le problème est que mon copier coller de dayofweek 5 supprime le "". Désolé. Il faut remettre ces "" après "dayofweek". Cordialement

delynot
6 years ago
#

je n'arrive pas non plus avec le dernier code Syntax error line 29 char 58, it’s pointig at the 5 [dayOfWeek 5].

Lucho0712
6 years ago
#

Hi, there seems to be a copy/paste error at the end of the Momentum section. Also, the first "if" to enter market seems to have a copy/paste error, wouldit be possible to have a look look? Thanks!

pat95162
6 years ago
#

Bonjour J'ai essayé ça ne fonctionne pas J'ai une position perdante -21 800 yen. Comment faites vous

Artemois
6 years ago
#

Hi Doctrading Thanks for sharing a correction but the error is the same PRT v10.3 says : Syntax error line 29 char 58, it’s pointig at the 5 [dayOfWeek 5]. Am I doing something wrong or is v11 needed ? Cheers!

Lucho0712
6 years ago
#

Hi, you need to insert "5", in order to not trade on Fridays.

Doctrading
6 years ago
#

//---------------------------------------------- // 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

Doctrading
6 years ago
#

Ouch, little bug with the code display... Here it is :

jamescoop
6 years ago
#

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

rburger
6 years ago
#

Hi Doctrading, thanks for this nice and simple strategy. I really would like to backtest the strategy based on the momentum conditions. Is it possible for you to provide this?

NA
NA
6 years ago
#

j'ai fait quelques test sur d'autres parités de devises et sour d'autres timeframes en prenant la strategie d'origine qui me semble assez optiminée,

fifi743
6 years ago
#

bonsoir , @nicolas j'ai mis le TP = 100 et la un gros bug . il affiche gagnant alors quand on regarde de prêt il est perdant et il touche le TP . position buy et le TP est en dessous de entrée

patmge
6 years ago
#

Hello guys, thanks !

dannydarocha
6 years ago
#

Hello guys, thanks for the code !

vcharlesc
6 years ago
#

Hi Doctrading, Thanks for your code and there is error as follow! could you fix it? c2v = MLTv = startTime and time <= endTime and dayOfWeek 5 and CONDBUY then

Doctrading
6 years ago
#

//---------------------------------------------- // 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

Doctrading
6 years ago
#

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,

ProRealCode ProRealCode
Loading...