# Consolidation Indicator

#### govind1209

##### New Member
Hi Experts, I found a thinkscript strategy for consolidation boxes:

Attempted to convert it AFL, but can not seem to replicate, your help wioll be highly appreciated:

// Consolidation Box Barebones - with Grey Consolidation Box
// tomsk
// 11.23.2019

// As requested by Playstation, this is B3 Consolidation Box with all lines removed
// Only the grey consolidation box remains

// B3 Consolidation Box
// Hammond B3
// 2.2.2019

BarsUsedForRange = 2;
BarsRequiredToRemainInRange = 7;

// Identiif(y Consolidation
HH = HHV(Ref(high,-1), BarsUsedForRange);
LL = LLV(Ref(low,-1), BarsUsedForRange);
maxH = HHV(hh, BarsRequiredToRemainInRange);
maxL = LLV(ll, BarsRequiredToRemainInRange);
HHn=maxH;
LLN=maxL;
CountH[0]=CountL[0]=2;
HHn = iif(maxH == Ref(maxH,-1) or maxL == Ref(maxL,-1) , maxH , Ref(HHn,-1));
LLn = iif( maxH == Ref(maxH,-1) or maxL == Ref(maxL,-1) , maxL , Ref(LLn,-1));
Bh = iif( high <= HHn and HHn == Ref(HHn,-1) , HHn , Null);
Bl = iif( low >= LLn and LLn == Ref(LLn,-1) , LLn , Null);
CountH = iif( isnull(Bh) or isnull(Bl) , 2 , Ref(CountH,-1) + 1);
CountL = iif( isnull(Bh) or isnull(Bl) , 2 , Ref(CountL,-1) + 1);

ExpH[0] = Null;
ExpH = IIf(BarIndex() == 0 , NULL
, IIf( Ref(CountH,BarsRequiredToRemainInRange) >= BarsRequiredToRemainInRange , Ref(HHn,BarsRequiredToRemainInRange)
, IIf(High <= Ref(ExpH,-1) , Ref(ExpH,-1)
, Null)));

ExpL[0] = Null;
ExpL = IIf(BarIndex() == 0 , NULL
, IIf( Ref(CountL,BarsRequiredToRemainInRange) >= BarsRequiredToRemainInRange , Ref(LLn,BarsRequiredToRemainInRange)
, IIf(Low >= Ref(ExpL,-1) , Ref(ExpL,-1)
, Null)));

BoxHigh = IIf( IsNull(Expl) OR IsNull(ExpH) , ExpH , Null);
BoxLow = IIf( IsNull(Expl) OR IsNull(ExpH) , ExpL , Null);

Plot(BoxHigh,"",colorRed,styleDashed);
Plot(BoxLow,"",colorGreen,styleDashed);
Plot(Close,"",IIf(O>C,colorRed,colorLime),styleCandle);

#### stoch

##### Active Member
How can I try it in my MT4 platform? Is it possible to convert the code into MT4 (maybe they are the same)?

#### Hulu Girl

##### Active Member
Consolidation is neither positive nor negative on its own. Sometimes a consolidation period emerges after a healthy price movement. Traders, careful about possible overbought or oversold positions, may look to smooth out movements before another trend emerges.

#### stoch

##### Active Member
Consolidation is neither positive nor negative on its own. Sometimes a consolidation period emerges after a healthy price movement. Traders, careful about possible overbought or oversold positions, may look to smooth out movements before another trend emerges.
I use this indicator in trading with Hotforex and Tickmill, I should say it is very instrumental in defining support and resistance levels thanks to existence of momentum in price movements.

#### govind1209

##### New Member
I use this indicator in trading with Hotforex and Tickmill, I should say it is very instrumental in defining support and resistance levels thanks to existence of momentum in price movements.
Which indicator are you talking about

#### stoch

##### Active Member
Which indicator are you talking about
Combination of long and short RSI. The key to their successful use is to pick correct parameters which is complicated by the fact that they are not constants. In different market and in different sessions you should expect that one RSI setting will fail, while the other one - succeed.