Hi all,
I am trying to count continuous lower low bars , following code used but it limits barcount
isLowerLowCount=L < Ref(L,-1) AND Ref(L,-1)<Ref(L,-2) AND Ref(L,-2) < Ref(L,-3);
Title = Title + "3 lows: " +isLowerLowCount;
Hi all,
I am trying to count continuous lower low bars , following code used but it limits barcount
isLowerLowCount=L < Ref(L,-1) AND Ref(L,-1)<Ref(L,-2) AND Ref(L,-2) < Ref(L,-3);
Title = Title + "3 lows: " +isLowerLowCount;
i think you mean "consecutive" or "successive".
code below show an example. So 3 consecutive Lower Lows would be:
ThreeLL = ConsecutiveDownBarsL == 3;
see:
// consecutive lower Close
ConsecutiveDownBarsC = BarsSince( C >= Ref( C, -1 ) );
"ConsecutiveDownBarsC: " + ConsecutiveDownBarsC;
// consecutive lower Low
ConsecutiveDownBarsL = BarsSince( L >= Ref( L, -1 ) );
"ConsecutiveDownBarsL: " + ConsecutiveDownBarsL;
// consecutive higher Close
ConsecutiveUpBarsC = BarsSince( C <= Ref( C, -1 ) );
"ConsecutiveUpBarsC: " + ConsecutiveUpBarsC;
// consecutive Higher High
ConsecutiveUpBarsH = BarsSince( H <= Ref( H, -1 ) );
"ConsecutiveUpBarsH: " + ConsecutiveUpBarsH;
ThreeLL = ConsecutiveDownBarsL == 3;
Plot( C, "Price", colorAqua, styleCandle, Null, Null, 0, 0, 1 );
PlotShapes( IIf( ThreeLL, shapeCircle, shapeNone ), colorGreen, 0, L, -50 );
PlotShapes( IIf( ConsecutiveUpBarsH == 3, shapeCircle, shapeNone ), colorRed, 0, H, 50 );
here an idea for signals
nbar = Param( "N consecutive bars", 3, 1, 20, 1 );
// consecutive lower Close
ConsecutiveDownBarsC = BarsSince( C >= Ref( C, -1 ) );
// consecutive lower Low
ConsecutiveDownBarsL = BarsSince( L >= Ref( L, -1 ) );
// consecutive lower high
ConsecutiveDownBarsH = BarsSince( H >= Ref( H, -1 ) );
// consecutive higher Close
ConsecutiveUpBarsC = BarsSince( C <= Ref( C, -1 ) );
// consecutive Higher High
ConsecutiveUpBarsH = BarsSince( H <= Ref( H, -1 ) );
// consecutive Higher Low
ConsecutiveUpBarsL = BarsSince( L <= Ref( L, -1 ) );
SetChartOptions( 0, chartShowDates );
Plot( C, "Price", colorAqua, styleCandle, Null, Null, 0, 0, 1 );
//Buy = Ref( ConsecutiveDownBarsC >= nbar, -1 ) AND H > Ref( H, -1 );
Buy = Ref( ConsecutiveDownBarsL >= nbar AND ConsecutiveDownBarsC >= nbar, -1 ) AND H > Ref( H, -1 );
BuyPrice = Ref( H, -1 );
PlotShapes( IIf( Buy, shapeUpArrow, shapeNone ), colorGreen, 0, L, -20 );
PlotShapes( IIf( Buy, shapeSmallCircle, shapeNone ), colorYellow, 0, BuyPrice, 0 );
This topic was automatically closed 100 days after the last reply. New replies are no longer allowed.