Smart Money Concept - BISI

DEAR, ALL

I am trying to code this SMC concept called BISI- buy side imbalanced sellside inefficiency

For this to implement I have tried the code below --

_SECTION_BEGIN("Price");
SetChartOptions(0,chartShowArrows|chartShowDates);
_N(Title = StrFormat("{{NAME}} - {{INTERVAL}} {{DATE}} Open %g, Hi %g, Lo %g, Close %g (%.1f%%) {{VALUES}}", O, H, L, C, SelectedValue( ROC( C, 1 ) ) ));
Plot( C, "Close", ParamColor("Color", colorDefault ), styleNoTitle | ParamStyle("Style") | GetPriceStyle() ); 
_SECTION_END();

// FVG- FAIR VALUE GAP 


//==================================================================================================================================================================
//   BISI - BUYSIDE IMBALANCE -SELL SIDE INEFICIENCY===>> [ ONLY BUY SIDE OFFERED ]
//==================================================================================================================================================================

// THREE CANDLE PATTERN 
// CURRENT, REF (CURRENT ,-1),REF(CURRENT,-2)
// LAST 2 CANDLES ARE GREEN , FIRST CANDLE COULD BE GREEN OR RED
// GAP BW 1ST CANDLE HIGH AND AND 3RD CANDLE LOW IS GAP

FcHigh             = Ref(H,-2);
LastCandLow        = Low;
SecondCisGreen     = Ref(C,-1) > Ref(O,-1);
SecondCishigher    = Ref(C,-1) > Ref(H,-2);
ThirdCisgreen      = C > O ;
ThirdLowIshigher   = L > Ref(H,-2);


BISIisComplete     = SecondCisGreen AND SecondCishigher AND ThirdCisgreen AND ThirdLowIshigher ;

BISIzoneUper       = ValueWhen(BISIisComplete,L);
BISIzoneLower      = ValueWhen(BISIisComplete,Ref(H,-2));

BISIzoneUper       = IIf(BISIisComplete,Null,BISIzoneUper);
BISIzoneLower      = IIf(BISIisComplete,Null,BISIzoneLower);

Plot(BISIzoneUper,"bisi up ",colorRed,styleLine);
Plot(BISIzoneLower,"bisi dn ",colorRed,styleLine);

In output some random Gaps are Missed .

Here is the Output -

Can anyone Please spot my mistake ,and Hint me to correct it .

you could also use this:

gap = 0.5 * ATR( 100 );
SecondCisGreen = Ref( C, -1 ) > Ref( O, -1 );
ThirdCisgreen = C > O ;
GapBetweenFirstAndThird = L - Ref( H, -2 ) > gap;

BISIisComplete = SecondCisGreen AND ThirdCisgreen AND GapBetweenFirstAndThird;
2 Likes

@PunitRaj, you have consecutive (back-to-back) BISIisComplete conditions (use an explore to identify them clearly), and your code handles/shows only the most recent ones.

1 Like

Thanks for guidance @beppe . I will do it .

Thanks for Reply @empottasch . The idea of using ATR to filter narrow gap is very nice . But if I am not using any filter like ATR then , Formula should plot all such gaps including small one . If it is not working means there is any Logical bug inside my code . I am interested to know the BUG . If you find any please point me .

Thanks again,

in my opinion your code is correct. I tried to compare using the code below. There is a small difference because you also add the constraint "SecondCishigher". But looking at you chart they should be visible. I do not have that data to check it but imo your code is correct.

sw = ParamToggle( "switch", "mine|his", 0 );

if( sw )
{
    FcHigh             = Ref( H, -2 );
    LastCandLow        = Low;
    SecondCisGreen     = Ref( C, -1 ) > Ref( O, -1 );
    SecondCishigher    = Ref( C, -1 ) > Ref( H, -2 );
    ThirdCisgreen      = C > O ;
    ThirdLowIshigher   = L > Ref( H, -2 );
    BISIisComplete     = SecondCisGreen AND SecondCishigher AND ThirdCisgreen AND ThirdLowIshigher ;
    
    BISIzoneUper       = ValueWhen( BISIisComplete, L );
    BISIzoneLower      = ValueWhen( BISIisComplete, Ref( H, -2 ) );
    BISIzoneUper       = IIf( BISIisComplete, Null, BISIzoneUper );
    BISIzoneLower      = IIf( BISIisComplete, Null, BISIzoneLower );
    _TRACE( "his" );
}
else
{
    gap = 0;//0.5 * ATR( 100 );
    SecondCisGreen = Ref( C, -1 ) > Ref( O, -1 );
    ThirdCisgreen = C > O ;
    GapBetweenFirstAndThird = L - Ref( H, -2 ) > gap;
    BISIisComplete = SecondCisGreen AND ThirdCisgreen AND GapBetweenFirstAndThird;

    BISIzoneUper = ValueWhen( BISIisComplete, L );
    BISIzoneLower = ValueWhen( BISIisComplete, Ref( H, -2 ) );
    BISIzoneUper = IIf( Ref( BISIisComplete, 1 ), Null, BISIzoneUper );
    BISIzoneLower = IIf( Ref( BISIisComplete, 1 ), Null, BISIzoneLower );
    _TRACE( "mine" );
}
2 Likes

yes I know what it is. It is because of:

    BISIzoneUper       = IIf( BISIisComplete, Null, BISIzoneUper );
    BISIzoneLower      = IIf( BISIisComplete, Null, BISIzoneLower );

if there are multiple BISI's next to each other then these 2 lines of code with remove them. Just comment these 2 lines out and you will see the BISI's are indeed detected. But after they are detected you remove them again with these 2 lines of code.

So you have to use a different form of display. For instance use GFX

Basically I see now Beppe also said the same. I did not understand his comment at first.

Just use this line of code at the bottom of your code and you will see they are all detected:

PlotShapes( IIf( BISIisComplete, shapeSmallCircle, shapeNone ), colorAqua, 0, L, -20 );
3 Likes

Thanks @empottasch for your kind guidance and for your time you have given to me explaining the code . Now I have better Understanding of the problem , And Possible solution also .
Thanks @beppe for Pointing Out my mistake that , BISIisComplete is allways ON is The problem .

1 Like

This topic was automatically closed 100 days after the last reply. New replies are no longer allowed.