coding a variable stopplacement

Forums ProRealTime English forum ProOrder support coding a variable stopplacement

Viewing 3 posts - 1 through 3 (of 3 total)
  • #185274

    Hello everybody,

     

    Hope someone can help me.

    I am trying to code a stopplacement depending on the position of the close to the EMA20, ema50 and ema 100.

    The idea is simple. If the close is above the ema 20 and the distance to the ema20 is greater then 6 the stop is placed at the ema20.

    If the distance is smaller then 6 or the close is smaller then the ema20 and the the distance to the ema50 is greater then 6 the stop is placed at the ema50. and so on…

    I wrote the following code, but clearly i have made a mistake, cause it doen not influence the outcome.

    Hope someone can tell me what i did wrong 🙂

    Kind regards,

    Jaldidee

     

    #185275

    Hi Jalidee,

    Put this on top of the code you just showed (thus after the EMA20 is known) :

    and you will see what’s the culprit …

    #185283

    In line 1 you use EMA20 in the expression, while in line 2 you use EMA20[2], which is the value retained two bars prior to the current one.
    I think this is the culprit.
    Try removing [2].

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

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