Get the time of last Stop Loss (not bars ago)

Forums ProRealTime English forum ProOrder support Get the time of last Stop Loss (not bars ago)

  • This topic has 5 replies, 4 voices, and was last updated 1 day ago by avatarJS.
Viewing 6 posts - 1 through 6 (of 6 total)
  • #254028

    Hi

    I want to avoid a new entry if last trade triggered a stop loss and it happened less than 10 minuttes ago.

    How can I program that?

     

    #254039

    It depend on which time frame the code is running and if you have several ways of exiting a running trade… (if there is no instruction to get that exact time)

    #254047

    The code is on 1 minute timeframe and there are other ways to exit the trade also. But I want only the stop loss give the break of 10 minuttes.  Here is a simplified version:

    DEFPARAM CumulateOrders = False

    // Conditions to enter long positions
    timeframe(1 minutes)
    indicator1 = Average[1](Stochastic[9,3](close))
    c93lav = (indicator1 <= 23)
    indicator2 = Average[1](Stochastic[60,10](close))
    c6010hoej = (indicator2 >= 80)

    IF c93lav AND c6010hoej THEN
    BUY 1 SHARES AT MARKET
    ENDIF

    // Conditions to exit long positions
    timeframe(1 minutes)
    EMA200 = ExponentialAverage[200](close)
    c3 = (EMA200 – 5 >= close)
    IF c3 THEN
    SELL AT MARKET
    ENDIF

    // Stops and targets
    SET STOP pLOSS 4.7
    SET TARGET pPROFIT 5.8

    #254051

    Here you have an example to control exit:

    3 users thanked author for this post.
    #254098

    At first i thought of the same simple solution as Ivan posted just above, but then i though about a more sophisticated solution that seems not working any better than the simple one… If Someone knows why this kind of solution works well in Probuilder as an indicator, but not in probacktest…
    https://www.prorealcode.com/topic/array-variables-availability-in-prorealtime/page/2/#post-120663

    2 users thanked author for this post.
    #254123
    JS

    @LucasBest

    In ProBuilder, the code is triggered on every tick, whereas in ProBackTest the code is only triggered on the close

    3 users thanked author for this post.
Viewing 6 posts - 1 through 6 (of 6 total)

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