Avoiding re-entering the market after target met

Forums ProRealTime English forum ProRealTime platform support Avoiding re-entering the market after target met

Viewing 7 posts - 1 through 7 (of 7 total)
  • #35836

    I am struggling to code in order to avoid re-entering of trade once set profit target is met. For instance if I am long and set profit target is met, the code shouldn’t enter a new long trade although the conditions to go long is still true. Any help?

    #35840

    Depends of the code, do you also have a sell conditon?

    i use sometimes a binary indicator buy = 1 and sell = -1 then i check if that indicator < 0 for buy

     

     

     

    #35849

    Yes I do have sell condition as well

    #36172

    It is taking another long position because the conditions you specified are still being met, if you don’t want it to take another position then you must change the long entry condition or refine it in some way.  What you haven’t stated is what you want the system to do after closing a long position, presumably you want it to be able to take another long position at some point?  You can tell e.g. to take another long position if the long entry conditions are met after so many bars since the close of the last trade or after a certain amount of  time has passed but you need to say what you want it to do.

    #36212

    I would like the system to only take another long position after it had taken a short position, i.e. no 2 successive longs or shorts entries

    #36378

    Assuming you have different conditions for entering longs and shorts then setting and testing a flag will do what you need, see example in attached code sample I used to test it.

     

    #36468

    Thanks, i.t really helped. Exactly what I have been looking for.

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

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