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

Enter exit on stoploss and target

May 9, 2021 - 7:21 AM

Viewed 419 times

https://best-trading-indicator.com/community/bti/forums/4180/topics/24023 COPY
  • Hi Friends. I want to code a tricky situation.
    I want to trade base on some fibonacci ratios as per below condition

    Condition:

    • As per previous day high and low, i can find 50% retracement.
      Let say i saved that retracement level value into variable retracement1.

    • Now I will wait for scenario whever, 5 candle first cross this retracement.

    • Later if same candle close above 50% retracement I will place long order at exact 50%

    • SL is stoploss variable value.

    • target is target variable value.

    I did coding till finding and saving 50% retracement, SL and target values into some variable.
    Please help me to proceed further.

    1
  • Hi there

    You could use my strategy template as a framework to manage your SL and target
    https://www.tradingview.com/script/2lGyzYkC-Ultimate-Strategy-Template

    Dave

    1
  • Dave (@dave):
    Hi there
    You could use my strategy template as a framework to manage your SL and target
    https://www.tradingview.com/script/2lGyzYkC-Ultimate-Strategy-Template
    Dave

    Thanks Dave.

    Actually I am struggling to set loop which can check if any candle broke support but closed above. Or any other candle after that closed above support.

    Can you please help me to code this?

    1
  • Would be something like this

    // support_line variable
    condition_buy = crossover(close, support_line_variable)
    
    if condition_buy
      strategy.close("Long")
    
    0
CONTENTS