# Need help in finding out if Chikou is free

Hi,

I need help. I am not able to write condition to tell chikou should be clear of all the prices. I can visually tell but how to tell it via code.

Chikou span is the current close price shifted back 26 periods.

Below is the code

``````TPERIOD = Param( "Tenken Sen Period", 9, 3, 10, 1 );
KPERIOD = Param( "Kijun Sen Period", 26, 5, 26, 1 );
CPERIOD = Param( "Chikou Period", 26, 4, 26, 1 );
SPERIOD = Param( "Senkou Span Period", 52, 10, 52, 1 );

TL = ( HHV( H, TPERIOD ) + LLV( L, TPERIOD ) ) / 2;
SL = ( HHV( H, KPERIOD ) + LLV( L, KPERIOD ) ) / 2;
Chikou_Span = Ref( C, -CPERIOD );
Sp1 = ( SL + TL ) / 2;
Sp2 = ( HHV( H, SPERIOD ) + LLV( L, SPERIOD ) ) / 2;

Plot( SL, "Kijun Sen", colorRed, styleThick | styleNoLabel );
Plot( TL, "Tenken Sen", colorGreen, styleThick | styleNoLabel );
Plot (C, "Chikou", ParamColor("Chikou Line Color",colorOrange), styleDashed | styleNoLabel | styleNoTitle, Null, Null, -CPERIOD);
Plot(Sp1, "SENKU_SPAN_A", colorDefault, styleNoLine | styleOwnScale);
Plot(Sp2, "SENKU_SPAN_B", colorDefault, styleNoLine | styleOwnScale);
Plot(Chikou_Span, "Chikou Span", colorDefault, styleNoLine | styleOwnScale);

color = IIf( Sp1 > Sp2, ParamColor( "Senkou Span A Color", ColorRGB( 230, 255, 153) ), ParamColor( "Senkou Span B Color", ColorRGB( 255, 184, 77 ) ) );
PlotOHLC ( Sp1, Sp1, Sp2, Sp2, "Kumo (Cloud)", Color, styleCloud | styleNoLabel, Null, Null, CPERIOD);
``````

I guess,

Bullish Chikou is current close should be above Chikou span and Bearish Chikou is current close should be below Chikou span..

BULLISH = C > CHIKOU_SPAN;
BEARISH = C < CHIKOU_SPAN;

Please comment if I am wrong..