Breakout M5 / H4 Nasdaq

Viewing 15 posts - 1 through 15 (of 97 total)
  • Author
    Posts
  • #180852 quote
    phoentzs
    Participant
    Master

    Can someone please check the functionality of my bot? Unfortunately, my coding skills are a bit limited.
    The bot is supposed to
    close crosses over (M5 timeframe)
    high (the last of a closed candle in the H4 timeframe)
    to buy.
    The last closed candle in H4 to which the high refers should be red. (close //Nasdaq M5/H4 Breakout //================================================ DEFPARAM CUMULATEORDERS = false defparam preloadbars = 5000 //Risk Management PositionSize=1 timeframe(4hour, updateonclose) c1 = high c2 = (Close > Open) //green c3 = (Close < Open) //red MAxx = Average[20,1](close) mylongx = MAxx > MAxx[1] timeframe(default) // trading window ONCE BuyTime = 050000 ONCE SellTime = 210000 // position management IF Time >= BuyTime AND Time <= SellTime THEN If (close crosses over c1) and c3 and mylongx Then //and not TradeOFF Buy PositionSize CONTRACTS AT MARKET SET STOP pLOSS hl //100 SET TARGET pPROFIT gl //175 ENDIF endif if time = 220000 and dayofweek=5 and (PositionPerf * PositionPrice / PipSize) >= 1 then // sell at market endif

    #180858 quote
    robertogozzi
    Moderator
    Master

    Yes, it works perfectly!

    You can append this line to check correct entries:

    graphonprice c1
    phoentzs thanked this post
    x-2.jpg x-2.jpg
    #180906 quote
    nonetheless
    Participant
    Master

    thanks for sharing, this looks interesting.

    Here’s a variation you might want to try. Quite good over the last 5 years, a bit flat before that – can be improved I’m sure.

    Optimized on 100% data so needs more testing etc

    phoentzs and thanked this post
    NAS-5m-Breakout-v2.jpg NAS-5m-Breakout-v2.jpg NAS-5m-Breakout-v2.itf
    #180914 quote
    nonetheless
    Participant
    Master

    this is the performance from 2017, when almost all the gains were made. Might make sense to optimize for just that period.

    NAS-5m-Breakout-v2-2017-21.jpg NAS-5m-Breakout-v2-2017-21.jpg
    #180933 quote
    phoentzs
    Participant
    Master

    So you enter the market with every H4 high break and don’t wait for a drop with a red candle? Do I see that correctly?

    #180934 quote
    nonetheless
    Participant
    Master

    Yes, i tried it with either of the conditions you had (green or red) and neither seemed to help, so this enters with any break above the 4h.

    I was thinking maybe an RSI condition might help, so that it only enters near the bottom of the run? or maybe use a change of direction in the MA?

    ma > ma[1] and ma[1] < ma[2]
    #180936 quote
    phoentzs
    Participant
    Master

    Manually you would use a red candle … or maybe a lower high of the H4 candles?

    #180937 quote
    nonetheless
    Participant
    Master

    You mean a succession of lower highs – and then the break above?

    cb3 = high < high [1] and high [1] < high[2]

    that might work but will result in fewer trades.

    #180938 quote
    phoentzs
    Participant
    Master

    Right, just tested. And drawdown remains almost the same.

    #180963 quote
    nonetheless
    Participant
    Master

    Also interesting with cumulateorders = True

    timeframe(4 hour, updateonclose)
    h1 = high
    
    MA = Average[p,t](typicalprice)
    cb1   = MA > MA[1]
    
    timeframe(1 hour, updateonclose)
    h2 = high
    
    timeframe(default)
    cb2 = close crosses over h1
    cb3 = close crosses over h2
    
    If Tradetime and cb1 and cb2  then
    Buy PositionSize CONTRACTS AT MARKET
    elsif longonmarket and CB1 and cb3 and COUNTOFLONGSHARES < PosMax then
    BUY positionsize CONTRACT AT MARKET
    ENDIF
    NAS-5m-Breakout-v4.4T.jpg NAS-5m-Breakout-v4.4T.jpg NAS-5m-Breakout-v4.4T.itf
    #180971 quote
    VinzentVega
    Participant
    Veteran

    Nice setup. It also runs in 3m too.

    #180974 quote
    phoentzs
    Participant
    Master

    I’ll have a look tomorrow. I use EMA15> EMA15 [1] as the H4 filter. I tested it over 10 years ago. I think that it is not optimized too much. I’m not sure about the outbreaks yet. I tested red highs when I got a big drawdown in the summer of 2019. But … same with green highs. If you take all the highs, the drawdown is almost gone. Would be nice to know why, of course. Maybe my stop is too close? I’m at 100Pips SL. In my strategies in the M15, that’s usually enough. You use 1.8% … I find that almost too far. Or what do you think?

    #180975 quote
    phoentzs
    Participant
    Master

    @Vinzentvega Yes, it looks good in the M3. But also just knows there were no sideways phases in the time. That’s why I’m undecided.

    #180978 quote
    nonetheless
    Participant
    Master

    I’m at 100Pips SL

    at present values, 100 points is nothing – around 0.6% – your position will close out way too soon.

    10 years ago the NAS was at 1600 so at that point your backtest would be working with a stoploss of around 6%, which no one would use. Even 5 years ago 100pts would have been over 2%

    % STOP LOSS keeps it relative to the price level, gives a more realistic picture.

    1.8% gave the lowest DD in my tests, 2% shows slightly higher profit

    #180983 quote
    phoentzs
    Participant
    Master

    You are right. I also use SL / TP in the DAX. It didn’t really work for me on the Nasdaq, so I use points there. I have to check that again.

Viewing 15 posts - 1 through 15 (of 97 total)
  • You must be logged in to reply to this topic.

Breakout M5 / H4 Nasdaq


ProOrder: Automated Strategies & Backtesting

New Reply
Author
author-avatar
phoentzs @phoentzs Participant
Summary

This topic contains 96 replies,
has 9 voices, and was last updated by murre87
4 years, 2 months ago.

Topic Details
Forum: ProOrder: Automated Strategies & Backtesting
Language: English
Started: 11/03/2021
Status: Active
Attachments: 21 files
Logo Logo
Loading...