“End of Day” forex trading strategy for USD/JPY

“End of Day” forex trading strategy for USD/JPY

Hello everyone,

I wrote this code from a strategy that seemed extremely effective on the pair “USD / JPY “.

The problem is that the backtest I had seen did not use the spread, and had been tested over the last few years, which anyway were profitable.

So I rewrote a backtest with adaptation in H1 c
harts and spread of 1.5 points.

As you can see, the strategy

– is profitable in recent years

– can be positive on every forex pair (with some improvements for each pair)

– requires no indicator

Actually, we take position only between 22H and 23H, depending on the distance from the range period : 18H – 22H (this period can change with other pairs)

 

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. noisette • 04/19/2016 #

    Hello,
    This seems to be an interresting strategy.
    I tried to quickly improve this program and having better result with:
    . Close all trades friday evening.
    . Open trades only the first 3 days of the week.
    Thanks
    . Add a stop loss (0,7%).

  2. Doctrading • 04/19/2016 #

    We get better results with stop loss to %0.6, and no trades on Friday.
    But I don’t see the end of my code !
    It is : 
    // ACHAT & VENTE entre 22H et 23H
    IF time >= 220000 and time <= 230000 and dayofweek <> 5 THEN
    Buy n shares at ouverture - amplitude limit
    Sellshort n shares at ouverture + amplitude limit
    ENDIF

    // STOP & OBJECTIF
    SET STOP %LOSS 0.6
    SET TARGET %PROFIT 1.2

    // SORTIE
    IF time = 100000 THEN
    SELL AT MARKET
    EXITSHORT AT MARKET
    ENDIF
     

    • Nicolas • 04/19/2016 #

      I added this line to your code. Now it’s complete I believe.. does it?

  3. Doctrading • 04/19/2016 #

    Here is the new screenshot, with stop loss 0,6%, an no trades on Friday.
    http://www.doctrading.fr/wp-content/uploads/2016/04/End-of-Day-UsdJpy-V2.png
    Better !

  4. Doctrading • 04/19/2016 #

    Yes, it will be complete with, for line  30 : 
    IF time >= 220000 and time <= 230000 and dayofweek <> 5 THEN

    Thanks !

  5. noisette • 04/19/2016 #

    I tried some other backtests.
    I found better results with:

     “IF time >= 220000 and time <= 230000 and  dayofweek < 4 THEN…”
    Close only friday night intead of everyday at 10.
    and add a condition in order to trade only in the trend simply calcutated with the difference between 2 different moving average.

    then Ratio became over 2 ( with 1.5 pips spread and 150 yen fees to estimate overnight fees)
    thanks

    • volpiemanuele • 04/19/2016 #

      Hi, 
      can i send me the strategy with your improvement ? Thanks

  6. Doctrading • 04/19/2016 #

    Hi,
    Could you send us the PRT code ?
    Thanks, I will try.

  7. volpiemanuele • 04/19/2016 #

    Hi, 
    can i have the complete strategy wish the correct parameters for eurusd? Thanks emanuele

  8. noisette • 04/19/2016 #

    Here the modified code.
    I’ll start paper trading with this code, because last week, I compared backtest and paper trading with a code like your and it was completly different (better results with paper trading).
    Backtest give bad results with “Sell” and “Buy” “at market”. And also, it looks likes “DayOfWeek” fonction is not respaected.
    // Graphes H1
    // Paire : USD/JPY
    Defparam cumulateorders = false

    //nombre de lots
    N = 1

    // Bougies de référence à 22H
    IF time = 220000 THEN
    amplitude = highest[4](high) - lowest[4](low)
    variable = amplitude * 0.4
    ouverture = close
    tandence = average[83] - average[45]
    ENDIF

    // ACHAT & VENTE entre 22H et 23H
    IF time >= 220000 and time <= 230000 and DAYOFWEEK < 4 THEN
    IF tandence > 0 THEN
    Buy n shares at ouverture - variable limit
    ENDIF
    IF tandence < 0 THEN
    Sellshort N shares at ouverture + variable limit
    ENDIF
    ENDIF

    // SORTIE le vendredi soir
    IF dayofweek =5 AND time >=230000 THEN
    SELL AT MARKET
    EXITSHORT AT MARKET
    ENDIF

    // STOP & OBJECTIF
    SET STOP %LOSS .8
    SET TARGET %PROFIT 5
     

  9. Doctrading • 04/19/2016 #

    Hello,
    Interesting.But I see a 150.000 yen drawdown, for a inital capital of 200.000.My code has a 62.000 drawdown.It is too risky, according to me. Maybe I did miss something ?

  10. noisette • 04/19/2016 #

    Yes I found more or less same results.
    It comes from stop loss & target profit values.
    Then with 0.6% and 1.2% (values of you code), you will find quite the same drawdown you have with your code but with a better ratio.
    0.8% and 5% gives the better final results but of course an important drawdown, the come from 9 successive lost trades.
    If someone have a solution to decrease drawdown with the same final result, please don’t hesitate.
     

  11. Doctrading • 04/19/2016 #

    To get the same result with less drawdown, the solution is simple : 
    you just use the original code, and bet x2 per trade.
    The drawdown will double (120.000), but the result be more profitable that your code.
    I suggest just betting x1.5

  12. Johan Holmberg • 04/19/2016 #

    Hi,
    I’m new to ProOrder and have imported the original code you posted and backtested it. Only get 3 trades. I’m a doing anything wrong?

  13. noisette • 04/19/2016 #

    After some week of demo mode, I can say:

    Backtests are completly wrong, but reality is better than backtest with your code.
    Results are better without adding indicator.

    Have a nice day.

  14. Doctrading • 04/19/2016 #

    Thanks for your return.
    I think that backtests are good with orders at market, with each new candles ; but there are bad backtests with stop ordres / several orders on same candle.Best Regards,

  15. Michael • 04/19/2016 #

     I’m using this code in real trading !  since  6 weeks , the result is verry profitable. The only difference i using  10min chart
     

  16. Wilko • 04/19/2016 #

    Nicolas,
    Thanks for this idea! It is an interesting concept to use mean reversion during the non-main sessions.
    Kind regards,
    Wilko

  17. Haydn Allbutt • 04/19/2016 #

    What do you mean by this Wilko?  I don’t see any comments here by anyone called Nicolas, but more importantly what do you mean by using mean reversion during non-main sessions?  Could you explain this in more detail?  Are you suggesting that there is a better indicator that could be programmed into this strategy (ie what you describe as a “mean reversion”) and that there is a better time frame to use the strategy (what you describe as the “non-main sessions” – do you mean for this that the strategy should only be active say during the Sydney and Tokyo sessions?)

    • Nicolas • 04/19/2016 #

      For a full list of posts been tagged  “mean reversion” in the library:  https://www.prorealcode.com/tag/mean-reversion/

  18. Haydn Allbutt • 04/19/2016 #

    Thanks Nicolas, I will have a look at those posts you suggest.  I take it you are suggesting that these posts will give a definition of what a “Mean Reversion” is or how to program a mean reversion into a strategy.  I am hoping to learn to program in ProRealTime in some detail so any suggestion is greatly appreciated.

  19. tested4perfection • 04/19/2016 #

    Hi,
    Many thanks for posting this trading system. I know it is old – but I just found it and the backtesting looks fantastic – but that is also where I have issues. When I run backtesting on IG with real trading account I have very nice results. If I try backtesting on my demo account – I get really bad numbers. The quotes are the same, the stops and spreads are the same as well as the paper traded (USD/JPY). It is very peculiar! Anyone knows why?
    Regards.

    • Nicolas • 04/19/2016 #

      As for today, a new backtest engine is deployed for IG demo accounts, this one has a better accuracy for STOP and LIMIT orders, rounding them correctly for the instrument’s ticksize.
      For a proper backtest, you should also always use the tick by tick box checked.

  20. Doctrading • 04/19/2016 #

    Hi all,
    Here is an improvement from a friend, Philippe :

    Best Regards

  21. Doctrading • 04/19/2016 #

    Defparam cumulateorders = false

    n=1
    // Plus le “ratio” monte, moins il y a de positions prises
    ratio=0.7

    // Bougie référence 18 à 22H
    if time = 220000 THEN
    amplitude = highest[4](high) – lowest[4](low)
    ouverture = close
    endif

    // achat & vente en semaine hors vendredi, entre 22H et minuit
    if time >= 220000 and time <= 230000 and dayOfWeek 5 then
    buy n shares at ouverture – amplituderatio limit sellShort 2.5n shares at ouverture + amplitude*ratio limit
    endif

    // stop & objectif
    sell at ouverture – amplituderatio – 4amplitude stop
    exitShort at ouverture + amplituderatio + 3amplitude stop
    set target %profit 0.8

    // sortie
    if time = 50000 then
    exitshort at market
    endif
    if time = 210000 then
    sell at market
    endif

  22. Doctrading • 04/19/2016 #

    Sorry for the mistakes… My “Copy – Paste” did’nt work properly.

    Defparam cumulateorders = false

    n=1

    // Plus le “ratio” monte, moins il y a de positions prises
    ratio=0.7

    // Bougie référence 18 à 22H
    if time = 220000 THEN
    amplitude = highest[4](high) – lowest[4](low)
    ouverture = close
    endif

    // achat & vente en semaine hors vendredi, entre 22H et minuit
    if time >= 220000 and time <= 230000 and dayOfWeek 5 then
    buy n shares at ouverture – amplitude*ratio limit
    sellShort 2.5*n shares at ouverture + amplitude*ratio limit
    endif

    // stop & objectif
    sell at ouverture – amplitude*ratio – 4*amplitude stop
    exitShort at ouverture + amplitude*ratio + 3*amplitude stop
    set target %profit 0.8

    // sortie
    if time = 50000 then
    exitshort at market
    endif
    if time = 210000 then
    sell at market
    endif

  23. Doctrading • 04/19/2016 #

    Hi all,

    Here is the new version, which is better :

  24. Doctrading • 04/19/2016 #

    Defparam cumulateorders = false
    n=1

    // Plus le “ratio” monte, moins il y a de positions prises
    ratio = 0.95

    // Bougie référence 18 à 22H
    if time = 220000 THEN
    amplitude = highest[4](high) – lowest[4]low
    ouverture = close
    endif

    // achat & vente en semaine hors vendredi, entre 22H et minuit
    if time >= 220000 and time <= 230000 and dayOfWeek 5 then
    buy n shares at ouverture – amplitude*ratio limit
    sellshort 2.5*n shares at ouverture + amplitude*ratio limit
    endif

    // stop & objectif
    sell at ouverture – amplituderatio – 10*amplitude stop
    exitShort at ouverture + amplituderatio + 3*amplitude stop
    set target %profit 0.9

    // sortie
    if time = 50000 then
    exitshort at market
    endif
    if time = 210000 then
    sell at market
    endif

    Unhappily, I can’t join a picture…

  25. Malloc • 324 days ago #

    Bonjour 🙂

    Je sais que cette stratégie a été partagée il y a de ça plusieurs années mais elle a retenu mon attention et je voudrais savoir si certain d’entre vous l’utilisent encore ou l’ont utilisé par le passé ?

    Au passage, je suis en train de backtester ma propre adaptation de cette stratégie et j’aurais voulu vos avis sur les résultats que j’obtiens, et notamment celui de Doctrading s’il est encore parmi nous.
    Voici la comparaison entre le backtest de la version de Doctrading du 04/19/2016 et ma propre adaptation :

    Dates des backtests : du 14/08/16 22:00:00 au 13/08/2021 22:00:00
    Actif : USD/JPY en 1h

    Nb de trades : Doc 137 _ Malloc 118
    Gain : Doc 87 (63.5%) _ Malloc 56 (47.46%)
    Flat : Doc 4 (2.92%) _ Malloc 21 (17.8%)
    Perte : Doc 46 (33.58%) _ Malloc 41 (34.75%)

    Ratio G/P : Doc 2.12 _ Malloc 3.38

    Gain moyen : Doc 420.11 _ Malloc 319.11
    Gain max : Doc 1260 _ Malloc 1060
    Perte moyenne : Doc -373.91_ Malloc -129.02
    Perte max : Doc -2060 _ Malloc -540

    Runup max : Doc 20140 _ Malloc 12750
    Drawdown max : Doc -6340 _ Malloc -1240

    Étant assez novice sur le backtesting, je suis preneur de tout avis !

    Merci par avance,
    Malloc

  26. lilo789 • 186 days ago #

    Hi guys!
    Do you know if it is possible to set the buy size to a relative % of the available equity / deposit?
    I would like to backtest compound profit by doing “buy 100% of available equity” instead of “buy n shares”.

    Thanks a lot

avatar
Register or

Likes

avatar avatar avatar avatar avatar avatar avatar avatar avatar avatar avatar avatar avatar avatar avatar avatar
Related users ' posts
smp I also have an End Of Day (EOD) cash pivot indicator for use on cash markets; this indicator...
Doctrading
2 years ago
jissey Bonjour Doctrading, avez-vous un programme qui tourne en réel depuis plus d'un an et compare...
Giddy Thanks Doctrading, I have modified the ratio, number of periods, close trade time slightly a...
choco Hello doctrading. Thank you for you sharing. I try this strategy "+MOMENTUM "ver. There ...
Dom Hello, hello....je commence le trading et découvre par la même occasion le codage....et ce n...
Nicolas Merci, ça fait plaisir !
Be-n Bonjour tout le monde ! Dans l'indicateur de tendance, j'ai du mal à saisir la nuance entre ...
Theo D'accord merci
tobytarczy Hi, I have been looking for something like this. I have a f questions about the indicator. ...
tobytarczy Hi have been trying to modify the code you so kindly shared to reflect to the image you have...
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...
Maik2404 es sind leider nur long Positionen und keine Short zu erkennen.
Maik2404 Vytautas: es bleibt aber nur bei long Auslösungen
ullle73 this one is not a winner, have backtested it on almost all pairs, does not have an edge
Leo Does it opens pending orders?... maybe they were not trigger.
Mattzi Dont know, all i can see is that it opened an order yesterday in backtest but not live. Th...
Jean-Christophe Hello Leo, when running the strategy from 29/12/2015 to 31/08/2018 on ProRealTime Premium, I...
Nicolas Please add a request on forums for any MT4 code conversion, thank you. Follow these easy ste...
mecon I will do so, thank you!
avatar
Anonymous @mecon, did you ever get one?
apachx Hi. Please, describe the algorithm in words. I want to understand how it works, but for now...
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 ...
Doctrading Hello, Higher timeframes are better. I suggest D1 or H4.Best regards,
Pinkybouh hello, I propose to add another conditions: ie: haussier: close > open and close >...
TheHovisTrader I'd be interested in the actual profit of this - in the example the stop range is at least 2...
Dimi.A Awesome mate.
mora87 Hi David and Nicola, I'd like to share idea with you guys which is related to David's Idea. ...
Nicolas Please ask for custom coding in forums instead.
Naren Yanan what is    diplus  diminus  please
Barney Has anyone tested this algon now when PRT 10.3 was released?
Yngve does anyone know if the issue with the TP/SL is resolved ?
JakeDB Answered my own question....Sorry about this question. 5 positions, take profit at 15, loss ...
maxxb sto facendo girare in demo questa strategia modificata a 10 minuti con stop e profit ottimiz...
Manuel9z Hello, this strategy improves with the SL 30 and the TP 10. I have done backtesting and it w...
Doctrading Hello, As I said, I didn't use spread for the screenshot as I don't trade Gold and I don't ...
smurfy Hi, I had been losing on gold and after I manually go through the 5min chart using IG and w...
eiffel Hi Smurfy, hope you are still there... I would like to help you to write and test the code.
Wilko This code is the work of a simple genius! Profitability lies in simplicity and repetition.
Nicolas Good joke. FYI, you'll find many identified recurring patterns there: http://paststat.com G...
Yngve i added a MA as a filter, that improved the equity curve quit nice actually
Doctrading Hello,  The strategy should be improved, no doubt. But it was just one of my ideas, which h...
ALEALE Yes Nicolas is very difficult, macro economic data can destroy any work!!  
styrke depends which.. I personally think that it's much more easier to trade on XBTUSD, try to co...
raviesco Hello Nicolas, Thanks for the post. Do you have an updated version of this screener/indi...

Top