Retain Buy/Sell condition

Forums ProRealTime English forum ProOrder support Retain Buy/Sell condition

  • This topic has 3 replies, 3 voices, and was last updated 3 years ago by avatarJS.
Viewing 4 posts - 1 through 4 (of 4 total)
  • #186107
    SVK

    Hi All,

    again I’m turning to you knowledgable folks for a small help.

    I have attempted to do it myself but I’m getting nowhere unfortunately.
    Threads I have reviewed:
    https://www.prorealcode.com/topic/how-to-keep-a-condition-active-for-more-than-one-bar/

    https://www.prorealcode.com/topic/wait-for-x-bars-before-entry/

    https://www.prorealcode.com/topic/x-bars-in-a-row-code/

    I’m looking for a code which will retain the trigger point but will delay it for 1 or 2 bars and will execute trade only if we are still in downtrend or uptrend.

     

    Price crosses under the 200MA – trigger bar (#1)

    Code retains this information but doesn’t execute the order on next bar(#2).

    When second bar(#3) since trigger opens it needs to check if previous bar(#2) closed below bar (#1 trigger bar).

    If bar #2 didn’t close below bar #1 then order is cancelled.

    If bar #2 closed below bar#1 then order is executed on bar#3.

    First photo is the situation I’m trying to avoid.

    Second photo is a succesfull trade execution.

     

    Thank you very much for your help

    #186113

     

    SVK, If you require a fully working code, then this is not for me. In that case the above may be helpful for others.
    It is not that exciting. But when to reset and why, could be (very much).

    Regards,
    Peter

    1 user thanked author for this post.
    avatar SVK
    #186122
    JS

    Hi @SVK

     

    1 user thanked author for this post.
    avatar SVK
    #186125
    JS

    Edit line 9 : Cond4 = S1 < S1[1]

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

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