Ochoa's Candlestick Reversal System for ThinkorSwim

BenTen

BenTen

Administrative
Staff
VIP
This indicator consists of different candlestick patterns and reversal system, as explained by Franklin Ochoa in his book.
  • Wick Reversal System
  • Extreme Reversal System
  • Outside Reversal System
  • Doji Reversal System
I included the ability to turn off any of the reversal signals above within the indicator's setting. You can use this with the ToS scanner as well.

Note: I could not incorporate the wick reversal system, so it's not part of the script. Credit goes to the original developer LonesomeTheBlue from TradingView.



Code:
# Candlestick Reversal System
# Assembled by BenTen at useThinkScript.com
# Converted from https://www.tradingview.com/script/H5290fLn-Candlestick-Reversal-System/

input extreme_reversal = yes;
input outside_reversal = yes;
input doji_reversal = yes;

def O = open;
def C = close;
def H = high;
def L = low;

input bodysize = 0.525;
input barsback = 50;
input bodymultiplier = 2;

def mybodysize = absValue(C - O);
def AverageBody = simpleMovingAvg(mybodysize, barsback);
def mycandlesize = (H - L);
def AverageCandle = simpleMovingAvg(mycandlesize, barsback);

def Elongsignal = ((O[1] - C[1]) >= (bodysize * (H[1] - L[1]))) and ((H[1] - L[1]) > (AverageCandle * bodymultiplier)) and ((O[1] - C[1]) >  AverageBody) and (C > O);
def Eshortsignal = ((C[1] - O[1]) >= (bodysize * (H[1] - L[1]))) and ((H[1] - L[1]) > (AverageCandle * bodymultiplier)) and ((C[1] - O[1]) >  AverageBody) and (O > C);

input BarMultiplier = 1.25;

def AverageCandle1 = simpleMovingAvg(mycandlesize, BarsBack);

def Olongsignal = L < L[1] and C > H[1] and (H - L) >= AverageCandle1 * BarMultiplier;
def Oshortsignal = H > H[1] and C < L[1] and (H - L) >= AverageCandle1 * BarMultiplier;

input percentage = 0.1;

def frangehl = H[1] - L[1];
def frangeco = absValue(C[1] - O[1]);
def sma10 = simpleMovingAvg(close, 10);

def Dshortsignal = (frangeco <= frangehl * percentage and C < L[1] and L[1] > sma10 and C < O)  or (C < L[2] and C[1] >= L[2] and frangeco <= frangeco * percentage and C < O and L[2] > sma10);
def Dlongsignal = (frangeco <= frangehl * percentage and C > H[1] and H[1] < sma10 and C > O)  or (C > H[2] and C[1] <= H[2] and frangeco <= frangeco * percentage and C > O and H[2] < sma10);

plot bullish_extreme = if extreme_reversal then Elongsignal else double.nan;
plot bearish_extreme = if extreme_reversal then Eshortsignal else double.nan;

plot bullish_outside = if outside_reversal then Olongsignal else double.nan;
plot bearish_outside = if outside_reversal then Oshortsignal else double.nan;

plot bullish_doji = if doji_reversal then Dlongsignal else double.nan;
plot bearish_doji = if doji_reversal then Dshortsignal else double.nan;

bullish_extreme.SetPaintingStrategy(PaintingStrategy.BOOLEAN_ARROW_UP);
bullish_extreme.SetDefaultColor(Color.CYAN);
bullish_extreme.SetLineWeight(1);
bearish_extreme.SetPaintingStrategy(PaintingStrategy.BOOLEAN_ARROW_DOWN);
bearish_extreme.SetDefaultColor(Color.CYAN);
bearish_extreme.SetLineWeight(1);

bullish_outside.SetPaintingStrategy(PaintingStrategy.BOOLEAN_ARROW_UP);
bullish_outside.SetDefaultColor(Color.MAGENTA);
bullish_outside.SetLineWeight(1);
bearish_outside.SetPaintingStrategy(PaintingStrategy.BOOLEAN_ARROW_DOWN);
bearish_outside.SetDefaultColor(Color.MAGENTA);
bearish_outside.SetLineWeight(1);

bullish_doji.SetPaintingStrategy(PaintingStrategy.BOOLEAN_ARROW_UP);
bullish_doji.SetDefaultColor(Color.YELLOW);
bullish_doji.SetLineWeight(1);
bearish_doji.SetPaintingStrategy(PaintingStrategy.BOOLEAN_ARROW_DOWN);
bearish_doji.SetDefaultColor(Color.YELLOW);
bearish_doji.SetLineWeight(1);
 
MerryDay

MerryDay

Member
VIP
@BenTen, you present us with so many interesting scripts. Thank you for all your time!
 

Similar threads

Top