Breakout after 5 candles

Forums ProRealTime English forum ProOrder support Breakout after 5 candles

Viewing 15 posts - 1 through 15 (of 15 total)
  • #204107

     

    Dear ones.
    I need your help again. I’m sorry, but that’s the way it is. Please. Maybe one or the other can shake it from the sleeve.

    We have for the sake of simplicity an Outside.
    Now I would like to set the buy stop 5 points above the high of the candles. But the buy stop should only be executed within 5 candles (n -candles).
    This kind of stops after trigger candles can be found in the strategies of e.g. the Hikkake here
    https://www.prorealcode.com/prorealtime-indicators/hikkake-pattern/.

    Please, do anyone help?

    #204186

    There you go:

     

    1 user thanked author for this post.
    #204467

    Hello Roberto.

    Thank you very much for the code. I just got around to looking at it today and ! – I want to say your code really helps me a lot. Now I can implement it in several (known) strategies. I will offer the strategies here if done. Thank you very much.

    As I see the program performs the buy stop several times within the 5 candles provided the conditions are met. See the screenshot and more detailed there after the 2.Outside.

    Can you change me the code so that it enters only 1 position within the predefined 5 candles? “not onmarket” does not help because the SL/TP is very low and new positions can be entered again and again. If I set the SL/TP on my 200 points, then it works, but is not in my sense. One ( first) position should be opened and then no more within the 5 candles.

    very kind regards to you

    #204470

    Thank you! It should be like this?

     

     

    #204521

    I tried it to optimize this setup, but the results are in all timeframes with tick-by-tick backup, horrible.

    #204527

    with tick-by-tick backup, horrible.

    Any ideas why this is so and / or any ideas for improvement?

    1 user thanked author for this post.
    #204528

    with tick-by-tick backup, horrible.

    Any ideas why this is so and / or any ideas for improvement?

    Well, I think SL/TP are to close

    1 user thanked author for this post.
    #204540

    Please excuse me. It was not about the strategy of trading exactly this breakout. It was about the coding itself, how the code can look like – to trade the breakout after n candles after one candle.

    1 user thanked author for this post.
    #204541

    Examples

    We have a new 20 candle high that is immediately sold. We want to buy on a breakout above the high candle, but only within 10 candles.

    We are trading an IDNR4 and want to buy/sell on a breakout (long/short) within the next 2 candles.

    The same with PopGuns.

    Or finer. We buy on a breakout above a bearish divergence within the next n candles.
    Etc etc

    I miss the basic programming skills, I’m sorry, thanks for your help

    #204543
    JS

    Hi @f1_maik

    I tried Roberto’s first code and don’t see that the code opens multiple positions within 5 candles…
    In your answer #204467 you talk about a screenshot and more details but unfortunately this screenshot has not been uploaded…
    Can you post it again?

    #204550

    Enclosed is the screenshot, 4H candle in the Dax
    You can try it yourself, big candle small SL/TP

    #204681

    Try replacing line 9 with this one, to account for trades opened and closed on the same bar:

     

    1 user thanked author for this post.
    #204695

    Thank you Roberto for making this clear.
    My mistake not to read you correctly, I would never have noticed otherwise
    Thank you

    #209690

    Hello Roberto.
    Again me and again on the subject of breakout in the next 5 candles.

    The problem is as follows.
    Above we have the SL and TP with 20 points and the trade starts directly in the 1.candle after the Outside and wins.
    Then the price immediately falls below the StopBuy and in the next candle we trigger the StopBuy and a 2nd trade is started within the 5 candles. This 2nd or 3rd or 4….. Trade I would like to prevent.

    How to code that the breakout is traded only once within the 5 candles? Cumulateorders false does not work sufficiently, dito not onmarket and the like. It must be ensured that the trade starts only 1x.

    Can it solve countofposition? Countofposition <= 1 within the last 5 candles? Something like that? Can this be programmed in PRT, what would be the code for it?

    lg

    #210296

    This should work (I added the OTD check, One Trade per Day):

     

    2 users thanked author for this post.
Viewing 15 posts - 1 through 15 (of 15 total)

Create your free account now and post your request to benefit from the help of the community
Register or Login