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 :

  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 • 344 days ago #

      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

avatar
Register or

Likes

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

+10 more likes

Related users ' posts
Holy Grail Thank you juanj for sharing this code, Backtests looks great in USDJPY and Crude Oil Is a...
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...
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