Hi Experts, I found a thinkscript strategy for consolidation boxes:
https://usethinkscript.com/threads/...kout-breakdown-indicator-for-thinkorswim.103/
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);
https://usethinkscript.com/threads/...kout-breakdown-indicator-for-thinkorswim.103/
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);