// Downloaded From https://www.WiseStockTrader.com
//One bar reversal patterns
//Inside, Outside, and Key reversal candle stick patterns are believed to be indicators of a Short term reversal, especially after a strong uptrend OR downtrend.

Title="One bar reversal patterns. Inside = Red, Outside = Yellow, Key reversal = Green";
Graph0=Close;
Graph0Style=128; //Candlesticks

//Outside patterns require a volume boost (40% above the past 10 days here). We're also requiring the current range to encompass the previous 2 days here.
Graph0BarColor=IIf(Outside() AND H>Ref(H,-2) AND L<Ref(L,-2) AND V>1.4*(MA(V,10)),7,1);

//Inside patterns require much smaller range (less than 40% here). We also require the range to be smaller than 2 days ago (60% here).
Graph0BarColor=IIf(Inside() AND ((H-L)<0.4*Ref(H-L,-1)) AND Ref(H-L,-2)<0.6*Ref(H-L,-1) ,4,Graph0BarColor);

//Key reversals require a gap up or down, a bigger range (2 times 2 days ago here), AND a Volume boost (40% above the 10 Day average here).
Graph0BarColor=IIf((L>Ref(H,-1)) AND (H-L)>2*(Ref(H-L,-2)) AND V>1.4*(MA(V,10)),8,Graph0BarColor);
Graph0BarColor=IIf((H<Ref(L,-1)) AND (H-L)>2*(Ref(H-L,-2)) AND V>1.4*(MA(V,10)),8,Graph0BarColor);
//Graph0BarColor=IIf((abs((H-L)-(Ref(H-L,-1)))<(H-L)*.05),7,1);