1

I'm new to pine script and I am trying to figure out how to make an indicator highlighting:

Price when the current candle cross below the wick low of previous candle + previous candle should be completely detached (even the wick) above the EMA100 line

Please help anyone :)

I tried something like this but it doesn't work :(

ema100 = ta.ema(close, 100) emaGapBelow = high < ema100 emaGapAbove = low > ema100 entryCandle = close < emaGapAbove

plotshape(entryCandle)

1 Answers1

1

In pinescript the number in brackets is used to acces previous data. For example to get the previous low, you use :

low[1]

For your code, you should try :

ema100 = ta.ema(close,100)
currentcrossbelow = close < low[1]
previousdetached = low[1] > ema100[1]

if currentcrossbelow and previousdetached
    // Here, your conditions are met
G.Lebret
  • 2,826
  • 2
  • 16
  • 27
  • Thanks this helped but i also want to trigger an alert as soon as my current candle price (not close price) cuts below the low of previous candle. How do i do that sir? – user20537640 Nov 18 '22 at 13:40
  • Please ask a new question, so that we can answer – G.Lebret Nov 18 '22 at 15:27