Closing non-profitable trades based on x-candles

Forums ProRealTime English forum ProOrder support Closing non-profitable trades based on x-candles

Viewing 5 posts - 1 through 5 (of 5 total)
  • #50455

    Hi all!

    Im wondering if someone could help me with a, probably, small problem.

    in one of my strategies i see that alot of the loosing trades never make any profit at all (meaning after trade is activated the market just keeps going down (long trades only)

    Is there a way to code in the following: “If no profit has been made (if the trade does not go into profit-making) within X candles, stop trade” ?

     

    edit: or maybe even better: “If trade has not generated X amounts of pips within X amounts of candles, close trade”

    This could potentially save me from some of the stop losses! 🙂

     

    Big thanks!

     

    Edit: I think ive seen it on this forum before but now i cant find it. Is it possible to code the following: “If MFE >= 25 (or X) pips then stop trade if it falls below 0 pips in profit.” ?

    In other words: if a trade goes to 50$ profit active trade, i dont want to see -50$ closed trade 🙂 If it goes to 50$ then to 0$ i want to close it there.

    #50458

    What you describe sounds like a trailing SL to me. If there is x amount of profit, set the SL to breakeven. There are several trailing SL codes in the forum, also using MFE.

    #50465

    Hi Despair, thanks for the reply.

    So yea, it is indeed trailing stop, i just dont know how to code them.

    Idea #1: “If trade has not generated X amounts of pips, within X amounts of candles, close trade”

    Idea #2: “If there is x amount of profit, set the SL to breakeven.”

    I know i’ve seen a post regarding idea #2, but i cant recall which post or what words i can use to search for it. I believe it was mixed in someones code for some strategy, no idea which one.

    #50469

    Nicolas posted a whole article on trailing SL. There you will find code you can use.

    #50487

    As for breakeven (Idea #2), there’s Nicolas‘s code here that is ready to be included in your code:https://www.prorealcode.com/blog/learning/breakeven-code-automated-trading-strategy/

    As for Idea #1 you may try this one (I haven’t tested it):

    Roberto

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

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