Channel breakout created by undecided bar

Forums ProRealTime English forum General trading discussions Channel breakout created by undecided bar

Viewing 8 posts - 1 through 8 (of 8 total)
  • #38621

    Hi all,

    Here’s my code. Strategy looks pretty good but unable to get the code to work. The idea is a range is set by a longer than average (1.5xaverage of last 20bars) bar.

    A trade is then entered following a close outside of the limits (high or low) of this undecided bar.

    If higher a buy trade is entered, if lower a sell trade is executed.

    The stop strategy is simple and looks effective. It uses either the low of the undecided bar if a buy is activated (or the high of the undecided bar if sell is activated).

    However 1 major and 1 minor problem

    1. The code doesnt work
    2. The pprofit distance needs optimising

    Fine tuning/help welcomed.

    Thanks

    Linden

     

    Many

     

     

    #38624

    For clarity of messages on ProRealCode’s forums, please use the “insert code PRT” button to separate the text of the code part! Thank you! <<

    Did you try to graph all your “c” conditions already? The no trading problem might come from these conditions not met all at the same time.

    You should also try to GRAPH the “BottomofBar” and “TopofBar” to know if your price levels are correctly calculated.

    It seems that you have copy/paste some of the codes from another strategy? I can see french words in the code 😉

    #38681

    You don’t need five conditions to enter a trade.

    Did not test the code but the idea is clear, i hope.

    #38682

    Instead of optimizing the pprofit you can also look for prolonged periods of contraction. If the price has been trading inside the range for X+ bars already the final breakout might be more vicious.

    Or maybe look into volume confirmation to filter false signals.

    #38828

    Thanks for your input.

    Yep I did copy and paste some code when I got stuck 😉

    That looks good Derek, I’ve just got 2 questions

    1. Why do you need the line 9) Rangebar = 0
    2. The code you wrote doesnt account for a short body in the middle of a long long spike either side. How would I factor this in?
    3. Many thanks for your time 🙂
    #38915

    Hey,

    1. To avoid reentry after a false breakout. You can leave it out if you can work without referring to the event later in your code. Or you go testing if your strategy performs better on a later breakout attempt.
    2. That’s intended. Otherwise wait for confirmation of the range. See 1.
    3. I love simplicity in a furios world.

     

    But now for 1.: are you referring to extra long bars with a full body and a close very near the top, or the bottom respectively? We can shortcut around both issues.

    Since the market doesn’t care what timeframe we’re trading on, the top of the range is confirmed by the retracement! So, we wait for a Rangebar to occur and then look for a follow up event to differentiate a forming range from a straight forward breakout. This way, we don’t need to look at the rangebar when it occurs because they are all equal.

    Here is my code (not tested):

    Don’t let your eyes fool you. The initial hypothesis is more likely to be correct if there actually is a range following a rangebar before the breakout 🙂

    edit: added the lower range

    1 user thanked author for this post.
    #38917

    Ok, this should work. Replace with lines 7-11:

     

    1 user thanked author for this post.
    #40262

    Hi Derek,

    Just back from hols to find this excellent piece of help (and code)

    Definitely prefer the simplicity of it – in a furious world 🙂

    Many many thanks

    Linden

Viewing 8 posts - 1 through 8 (of 8 total)

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