Welcome to the BEST forum for traders

Did you know we're sharing tons of exclusive content here?
Our community is growing quickly. Take a look around and say "Hello".

Value Does not update in real time

Aug 3, 2021 - 8:37 PM

Viewed 473 times

https://best-trading-indicator.com/community/bti/forums/4180/topics/25372 COPY
  • i have a condition ,when a candle hits a target the value which was false become true and alert fires,
    problem is when it hits the target several time in same time frame in 1 candle the value remains same and alert keeps on comming till that candle is closed.
    i tried using variable with var keyword also with varip keyword

    if(crossunder(close,trailprice) and trailprice!=0.0 and long==false)
    long:=true
    alert(you hit the target)

    this code keeps on running on same bar even if long becomes true

    0
  • try this

    if(crossunder(close,trailprice) and trailprice!=0.0 and long==false)
    long:=true
               alert("you hit the target", alert.freq_once_per_bar_close)
    

    Documentation: https://www.tradingview.com/pine-script-reference/v4/#fun_alert

    This post was edited Aug 4, 2021 09:11AM
    0
  • did not worked

    0
CONTENTS