How to prevent recently closed trade from reopening

Forums ProRealTime English forum ProOrder support How to prevent recently closed trade from reopening

Viewing 11 posts - 1 through 11 (of 11 total)
  • #120088

    I’m finding that with trailing stops a trade will often close at a profit only to reopen a few candles later if entry conditions persist, even if it’s near the top of the run and not actually a sensible place to buy. Is there an easy way to prevent this? such as, only opening at a price better than wherever last trade closed?

    #120089

    You can use this example https://www.prorealcode.com/reply/95908/

     

    1 user thanked author for this post.
    #120091

    Ciao Roberto, thanks for that – could definitely work. Is there no way to do it base on price rather than time (bars) ?

    #120092

    Is there no way to do it base on price rather than time (bars) ?

    The problem with doing it on price is that if you say I will only enter again at a lower price and then the market just goes up from there then your strategy will never open a trade ever again. I guess you could have this rule and then maybe reset things once or twice a day or week to get the strategy trading again.

    #120093

    Something like this perhaps:

     

    1 user thanked author for this post.
    #120095

    Yeah, that looks good too. I’ll play around with both solutions and see which works best. Thanks to you both!

    #120158

    @Vonasi unfortunately this results in no trades at all, unless I added it wrong? I tried altering the reset time, but no difference.

     

    #120161

    Have you analysed the trades to ensure that the reentries are not profitable?

    Your comment suggests that you see the second entry as less optimal, are you able to define the optimal state that you would want for entry in the code ie more than 30 points from high of day? That you could add as an opening condition to support the averages and supertrend that you are using that are more persistent conditions

    #120164

    Insert an ENDIF after line 72. It seems there was one missing in my code (I didn’t test it as it was ust a general idea to work with).

    I’ll edit the code in my earlier post to correct it.

    #120169

    Thanks Vonasi, that solves the problem I thought I had … but sadly doesn’t make the algo any more effective. Back to the proverbial…

    @Robo Futures Trader tbh I haven’t gone through the backtest trade by trade, it’s more of an instinctive thing. The win rate is 87% so it’s getting it mostly right, but when the price retraces and closes a position it just ‘feels wrong’ to see it reopen 15 minutes later at a worse price. I’ve tried all kinds of things to redefine the entry conditions but nothing seems to help. Perhaps as you suggest, some sort of fixed price criteria rather than the combination of averages i tend to work with…

    #120200

    If you get the entries into Excel, convert the entry date to only be the date and then use a countif formula which will give you a column with the entry number on that day, you can then pivot to compare first, second entries etc

    I was not saying to drop the use of moving averages but if you can define what you see as ideal and less ideal entries then it may be that you can add a further condition to allow the system to only take the first entry

    1 user thanked author for this post.
Viewing 11 posts - 1 through 11 (of 11 total)

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