may i have some help on this indicator, i want to make it strategy

Forums ProRealTime English forum ProOrder support may i have some help on this indicator, i want to make it strategy

  • This topic has 8 replies, 5 voices, and was last updated 4 months ago by avatarJS.
Viewing 9 posts - 1 through 9 (of 9 total)
  • #234392

    xatr = averagetruerange[c](close)
    nLoss = a * xatr

    if heikin then
    src = (open+close+high+low)/4
    else
    src = close
    endif

    if barindex < c then
    xatrTrailingStop = undefined
    pos = 0
    else
    if src > xatrTrailingStop[1] and src[1] > xatrTrailingStop[1] then
    xAtrTrailingStop = max(xatrTrailingStop[1],src-nLoss)
    else
    if src < xatrTrailingStop[1] and src[1] < xatrTrailingStop[1] then
    xAtrTrailingStop = min(xatrTrailingStop[1],src+nLoss)
    else
    if src > xatrTrailingStop[1] then
    xAtrTrailingStop = src-nLoss
    else
    xAtrTrailingStop = src+nLoss
    endif
    endif
    endif

    if src[1] < xatrTrailingStop[1] and src > xAtrTrailingStop[1] then
    pos = 1
    r=250
    g=0
    b=0
    else
    if src[1] > xatrTrailingStop[1] and src < xatrTrailingStop[1] then
    pos = -1
    r=0
    g=0
    b=250
    else
    pos = pos[1]
    endif
    endif
    endif

    ///////Trading conditions
    ema = average[1](src)
    above = ema crosses over xatrTrailingStop
    below = ema crosses under xatrTrailingStop

    buy1 = src > xatrTrailingStop and above
    sell1 = src < xatrTrailingStop and below

    barbuy = src > xatrTrailingStop
    barsell = src < xatrTrailingStop

    //////Plot signals and candles
    if drawsignals then
    if buy1 then
    drawarrowup(barindex,low-0.15*averagetruerange[10])coloured(“green”)
    elsif sell1 then
    drawarrowdown(barindex,high+0.15*averagetruerange[10])coloured(“red”)
    endif
    endif

    if colorcandles then
    if barbuy then
    rbar=0
    gbar=250
    bbar=0
    elsif barsell then
    rbar=250
    gbar=0
    bbar=0
    else
    rbar=125
    gbar=125
    bbar=125
    endif
    DRAWCANDLE(open, high, low, close)coloured(rbar,gbar,bbar)
    endif
    return xatrTrailingStop as “Trailing Stop” coloured(r,g,b)style(line,2)

    #234414

    Hi. Next time you share a code please define all variables (a, c, heikin, etc)

    Here you have the code:

     

    #234426

    @IVAN

    Hi, I’m testing the above bot.

    Please clarify what is heikin at third row and why you put 1.

    It’s not a PRT command.

    Many thanks in advance

    #234433

    Hi
    Heikin is a boolean variable (1/0 or true/false).
    It gives you the way to calculate the src variable (check rows 8-12).

    1 user thanked author for this post.
    #234475

    هل يمكنك جعله فعالا على مؤشر ناسداك في فترة 5 دقائق والتوافق مع حركة الشموع في استراتيجية تنبيهات UT bot؟

    Can you make it effective on Nasdaq in 5 minutes period and match the candle movement in UT bot alerts strategy?

    #234487
    JS

    Hi @Iván

    I think line 50 is wrong, shouldn’t there be a “period” here…?

    #234525

    @Haidar ali

    Only post in the language of the forum that you are posting in. For example English only in the English speaking forums and French only in the French speaking forums.

    Thanks 🙂

     

    #234653

    Hi!
    I didn’t check it. I just copied code from Haidar.
    Anyway, average[1](src) equals src. Maybe somebody has checked average[period](src) and the best is period=1…
    I don’t know 🙂

    #234658
    JS

    Hi,

    I think the 1 was used for the EMA…

    EMA=Average[Period,1](scr)

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

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