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

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

    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

+1 more likes

Related users ' posts
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...
GraHal Ooops got that excited I sent that last one twice! ha (and can't delete it, sorry) I got it...
Eric n = 3  dont forget to allow 3 contract in proorder
UkCoopDownUnder Tried EURUSD GMT and GMT -1, as far back as I can go, Nov 2018 on 15mn Tf, 22% loss
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 Hello, Someone asked me something (his results seemed to be different) on my email, but it ...
Glen Marquis Not your best..So what is your best strategy? :)
Benjamin Costa Ok thank you for your answers. Gianpiero, i have an Interactive brokers account. Noisette, i...
oldup It works on ProOrder - but  I don't like the maxWin = MaxLoss.    
oldup Just divise StopLoss /2 - Result is better  
Doctrading Bonjour, Tu as raison, il faut faire attention à la fiabilité de certains backtests. Le pro...
Duccio Hi DocTrading, I've backtested your strategy and I notice that 75% of position have been cl...
Doctrading Hello,  No, I don't use this strategy on real account, because my own strategies (that you ...
komiko 9a marche pas ? le code sur prorealtime "erreur de syntaxe l'instruction retur et autorisée ...
Nicolas En effet, il s'agit bien du code d'un indicateur et non d'un screener ou d'une stratégie de ...
RussJ Hey people Some great screeners on here but I'm pulling up too many stocks when I s...
luigiR Hallo doc, thank again for your strategy but can you suggest me  an example of the optimizat...
Wilko Do NOT take this system live! The backtest results will never be repeated live due to a shor...
mrripley99 So I've played around with this just recently and have achieved some good results in an IG d...
Doctrading Maybe you can also change the hourly beginning of the day (not 23PM but 12AM, OOH in french)...
Duccio Hi Doctrading,there is a way to control the max loss of the positions in this code? For exa...
Doctrading Hello, Yes, there is a command I think, but I don't know it. Nicolas knows it. You can als...
Pierreee That a realy great strategy !!!  It's realy profitable in daily trade. I'm gonna put some ...
entony hello timeframe on what works best and how couples ??grazie
111111dw i am running this on the cac 5m time frame but the results are very different from the backt...
Doctrading Hello fesxeurex, It can display both : when it is in formation, and when it has been formed...
the_giorgio Bonjour Doc, Je crois que votre définition du harami est erronée Critères du Harami D...
dfl3tch3r Great screener...Has anyone got code for trade/backtest the next bar breakout (short or long...

Top