End Of Day – YEN M15

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,

Share this

Risk disclosure:

No information on this site is investment advice or a solicitation to buy or sell any financial instrument. Past performance is not indicative of future results. Trading may expose you to risk of loss greater than your deposits and is only suitable for experienced investors who have sufficient financial means to bear such risk.

ProRealTime ITF files and other attachments : How to import ITF files into ProRealTime platform?

PRC is also on YouTube, subscribe to our channel for exclusive content and tutorials

  1. Doctrading • 05/22/2020 #

    Here is a improvement with MOMENTUM.
    For M15 TIMEFRAME
    Thanks to a friend, “Calvin”.

    The performance is better :

    • Stanko • 05/22/2020 #

      Ciao doctrading, grazie per il tuo contributo. Volevo chiederti se hai tenuto in osservazione il tuo sistema (sono passati 3 anni …). Ho provato a ritestare FINE GIORNATA ed attualmente ho riscontrato risultati molto interessanti anche con timeframe a 1 minuto anche introducendo il bel programma KAMA di Roberto Gozzi per gestire la posizione. Vorrei, se vuoi, proporre il codice.

  2. Doctrading • 05/22/2020 #

    // END OF DAY – YEN
    // http://www.doctrading.fr
    // + MOMENTUM (Calvin)

    Defparam cumulateorders = false

    // TAILLE DES POSITIONS
    n = 1

    // PARAMÈTRES
    // Plus le “ratio” monte, moins il y a de positions
    // USD/JPY : ratio = 0.4 / SL = 1 / TP = 0.8 / Period = 10

    ratio = 0.4

    // 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 CONDBUY then
    buy n shares at ouverture – amplitude*ratio limit
    ENDIF
    if time >= startTime and time <= endTime and dayOfWeek 5 and CONDSELL THEN
    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

    • Nicolas • 05/22/2020 #

      Peut-être un poil sur-optimisé ? Une idée de la performance OOS ?

    • BobFlynn • 05/22/2020 #

      Hello,

      Problème de copié collé ici : c2v = MLTv = startTime
      Si je comprend bien on devrait pluto avoir c2v = MLTv > OTv ?

    • choco • 05/22/2020 #

      Hello doctrading.
      Thank you for you sharing.
      I try this strategy “+MOMENTUM “ver.
      There is something I don’t understand.
      It is written as ”CONDBUY” and “CONDSELL”and”s2v”, what should I define?
      Also, please tell me the time zone you set.
      In “dayofweek 5” where other errors occurred, “” (difference operator) was missing.

      I can’t use it well except Japanese, so I’m sorry if it’s strange English.
      Waiting for your answer.

  3. Artemois • 05/22/2020 #

    Thank You for sharing.
    PRT v10.3 says : Syntax error line 34 char 58, it’s pointig at the 5 [dayOfWeek 5].
    Am I doing something wrong or is v11 needed ?
    Cheers!

  4. denottes • 05/22/2020 #

    Bonjour et merci pour le partage,
    Je n’arrive pas à exécuter le code avec le Momentum. J’ai une erreur de syntaxe. could y help 🙂 Thx

  5. Calvin Teddy • 05/22/2020 #

    Avec plaisir ! 😉
    Qu’entendez-vous par performance OOS Nicolas ?

    • Nicolas • 05/22/2020 #

      Hors échantillon, puisqu’il me semble que la stratégie a été optimisée sur tout l’historique ? Voir les vidéos sur l’optimisation avec walk forward dans le blog.

    • Calvin Clark • 05/22/2020 #

      Ah je n’utilise jamais le Walk Forward c’est pour ça.

    • Nicolas • 05/22/2020 #

      Attention à la suroptimisation dans ce cas ! Si c’était aussi simple.. 😉 Tu devrais regarder les vidéos du blog sur le walk forward, toujours vérifier la robustesse d’une stratégie, c’est la base, à minima sur 30% de données post optimisation ( hors échantillon ou Out Of Sample en anglais).

  6. pjanin972 • 05/22/2020 #

    bonjour Calvin,
    merci pour votre contribution, sur quel critère avez-vous définis les valeurs du momuntum.
    je souhaite l’adapter à mes stratégies, peut-on en discuter sur un forum ?

    • Calvin Clark • 05/22/2020 #

      Bonjour pjanin972, c’est de l’optimisation.
      C’est ces paramètres qui ont le mieux marché durant le backtest.

  7. Doctrading • 05/22/2020 #

    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,

  8. Doctrading • 05/22/2020 #

    //———————————————-
    // Code principal : End Of Day – USD/JPY M15
    // http://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

  9. vcharlesc • 05/22/2020 #

    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

  10. dannydarocha • 05/22/2020 #

    Hello guys, thanks for the code !

  11. patmge • 05/22/2020 #

    Hello guys, thanks !

  12. fifi743 • 05/22/2020 #

    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

  13. NA • 05/22/2020 #

    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,

  14. rburger • 05/22/2020 #

    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?

  15. jamescoop • 05/22/2020 #

    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

  16. Doctrading • 05/22/2020 #

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

  17. Doctrading • 05/22/2020 #

    //———————————————-
    // Code principal : End Of Day – USD/JPY M15
    // http://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

  18. Artemois • 05/22/2020 #

    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 • 05/22/2020 #

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

  19. pat95162 • 05/22/2020 #

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

  20. Lucho0712 • 05/22/2020 #

    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!

  21. delynot • 05/22/2020 #

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

  22. Doctrading • 05/22/2020 #

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

  23. Doctrading • 05/22/2020 #

    Essayez donc cette version :

    //———————————————-
    // End Of Day – USD/JPY M15
    // http://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 • 05/22/2020 #

      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?

  24. FernetTrader • 05/22/2020 #

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

  25. Luciole • 05/22/2020 #

    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.

  26. jissey • 05/22/2020 #

    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.

  27. Giddy • 05/22/2020 #

    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

  28. Stanko • 05/22/2020 #

    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 • 322 days 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 ^^

avatar
Register or

Likes

avatar avatar avatar avatar avatar avatar avatar avatar avatar avatar avatar avatar avatar avatar avatar avatar

+16 more likes

Related users ' posts
juanj @Holy Grail, glad you like it. Would you perhaps mind sharing your results here: https://www...
CaptainCaveman I am reluctant to say this buy I was a member of Dr Elder trading group for a while . The fa...
micquan The design is too complex and the performance is low.
Francesco78 Hi Pepmartorell, please let's continue the discussion on the forum thread so that we can sha...
Francesco78 Hi Pepmartorell, please let's continue the discussion on the forum thread so that we can sha...
Jusmih1 Hi there, i am looking at your Strategy however when you put in automatic trading mode its ...
GraHal Hi Pascal There's lots not clear to me! :) Are you referring to C1 = PARABOLIC>HIGH //R...
volpiemanuele hi, can I have the latest full code of this strategy ? Thansk
Steve Hey Grizzly, I know this probably doesn't belong to this post, however, don't know how else ...
Doctrading Defparam cumulateorders = false n=1 // Plus le "ratio" monte, moins il y a de positions ...
Malloc Bonjour :) Je sais que cette stratégie a été partagée il y a de ça plusieurs années mais ...
lilo789 Hi guys! Do you know if it is possible to set the buy size to a relative % of the available...

Top