Code adjustment to avoid 3 trades per day on Breakout Code

Forums ProRealTime English forum ProOrder support Code adjustment to avoid 3 trades per day on Breakout Code

Viewing 9 posts - 1 through 9 (of 9 total)
  • #14747

    Morning, So the breakout code is working well on 3 markets and over the last 5 weeks everything is in profit so good news there. One issue is that if a trade is opened and closed within the same bar then 3 trades are possible, this is not ideal as it can skew the results and cause unexpected drawdown like yesterday on the DAX with three small losers. I know why it does this but unsure how to fix it. This fix if there is a possible one will also help another strat I’m working on.

    Cheers

    #14751

    I’m also interested in a fix for this. What BO code are you using?

    thanks

    #14752

    One solution that come to mind: store the barindex when you launch a trade and test if the current one is the same as the old one when trying to initiate a new trade..

    #14791

    What you are saying makes sense but I’m not sure how to code it. Is there any examples in the library that you are aware of or a blog?

    Tom: It’s the breakout code I posted in the library which is a port from the original CAC

    #14807

    Could you please remember us why there is this behaviour of the 3 trades possible here? I know we have together already discussed about it, but I don’t remember sorry 🙂

    The code I were thinking of is the same as in this french topic: http://www.prorealcode.com/topic/cloture-systematique-a-la-fin-de-bougie-suivant-le-signal/

    #14864

     

    #14865

    It is your original CAC Breakout code modified to work on DAX. Are you saying that the thread you linked to holds the key to sorting this issue? If so I will spend some time trying to implement it.

    The reason this happens is because the strategy can sometimes open and close a trade within the same bar and so is only recorded as one trade. This creates an option for a third.

    #14931

    Yes it is a common problem that will be solved with multitimeframe support hopefully.

    At the beginning of the code, you can add something like this, that will test is a trade is currently on market:

    Then each time you launch a trade add this just below the trade launch instruction:

    and now you could test if the “currentbar” is not the same as the “savedbar” or at least 1 bar old. I think the tradeindex function can’t help because it needs at least  1 bar to compute.

    Sometimes we have to remember that the code are read from beginning to the end, so it is obviously a good idea to refresh variables state at the beginning of the code.

    This should work .. or not, just a Saturday morning idea, between coffee and children’s cartoons on TV 🙂

     

    1 user thanked author for this post.
    #14982

    Thanks Nicolas, will check this out this week. I did try to implement tradeindex without success.

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

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