“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?

New! PRC is also now 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 • 268 days ago #

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

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

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

    Best Regards

  21. Doctrading • 123 days ago #

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

    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

avatar
Register or

Likes

avatar avatar avatar avatar avatar avatar avatar avatar avatar
Related users ' posts
juanj @zebra would you be so kind as to post your latest 4H USD/JPY results here: https://www.pror...
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...
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!
firemyst @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...
GraHal I adjusted for GMT (minus 1 hour on all times) ... no trades. Might it be because the code ...
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
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 ...

Top