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".

Need help with my buy/sell levels

Nov 17, 2020 - 3:27 PM

Viewed 328 times

https://best-trading-indicator.com/community/bti/forums/4180/topics/21351 COPY
  • Hi everybody!

    I'm new in this forum, so the first thing I'd like to say hello and thank you for expending with me this little time.

    I have an issue with my script. My buy/sell lines dissapear each time the buy/sell condition happens again, and I want that levels to be static until the price reaches them.

    Here that part of the indicator:
    if xxxxxx[1]

    sellLevel := high + (perc * high)
    buyLevel := low - (perc * low)
    
    pos := 0
    

    So the first time that condition happens a buy/sell order is set, but when the condition happens again, the previous buy/sell level dissapears and appears the new one. Do you know how to get those levels to be static until the price reaches them?

    Thank you in advance!

    1
  • Hi @javierm

    I would use the high, low values when you get your buy/sell signal

    Let's assume a buy_signal and sell_signal conditions

    buy_signal_value = valuewhen(buy_signal, high, 0)
    sell_signal_value = valuewhen(sell_signal, low, 0)
    
    signal = buy_signal or sell_signal
    
    if (signal[1])
      sellLevel := buy_signal_value + (perc * buy_signal_value )
      buyLevel := sell_signal_value - (perc * sell_signal_value )
    
    0

    Dave - Helping traders becoming the best version of themselves
CONTENTS