1

I am trying to code a long condition using Ichimoku.

I want to set a condition when the current closing price is :-

a) Above the Tenkan sen (Conversion Line) - this is straight forward.

b) Below the Chikou span (Lagging Span) - i am not able to figure out how to get the value into a variable.

Here is the code for Ichimoku and my unsuccessful attempt -

//Ichimoku Code 

conversionPeriods = input.int(9, minval=1, title="Conversion Line Length")
basePeriods = input.int(26, minval=1, title="Base Line Length")
laggingSpan2Periods = input.int(52, minval=1, title="Leading Span B Length")
displacement = input.int(26, minval=1, title="Lagging Span")
donchian(len) => math.avg(ta.lowest(len), ta.highest(len))
conversionLine = donchian(conversionPeriods)
baseLine = donchian(basePeriods)
leadLine1 = math.avg(conversionLine, baseLine)
leadLine2 = donchian(laggingSpan2Periods)

//-----Calculating Lagging Span-----//
LagSpan = ?? 

//-----Ichimoku Buy Condition-----//
IchiLong = close > conversionLine and close < LagSpan ? 1 : 0

I have tried the following methods for trying to detect current close below Lagging Span(Chikou)

a) close < high[displacement] b) ta.mom(close, displacement - 1) < 0

Any ideas would be much welcome !!

samir7399
  • 13
  • 2

0 Answers0