Volume Based Reversal Candles for ThinkorSwim


This indicator was requested by a member of ours. Here is his concept of the script:
  • When volume is drying up while the RSI is overbought = bearish
  • When volume is rising while the RSI is oversold = bullish
Test it out and let us know if it helps. Give the candles sometime to play the trend out even if it's already in overbought or oversold territory.

Paintbars and arrows are being plotted by default. You can easily turn either one off via the indicator's setting. No need to touch the code.

thinkScript Code

# Volume Based Reversal Candles
# When volume is drying up while it's overbought = bearish
# When volume is rising while it's oversold = bullish
# Assembled by BenTen at useThinkScript.com

input paintbar = yes;
input arrows = yes;

# Start RSI
input length = 14;
input over_Bought = 65;
input over_Sold = 35;
input price = close;
input averageType = AverageType.WILDERS;
def NetChgAvg = MovingAverage(averageType, price - price[1], length);
def TotChgAvg = MovingAverage(averageType, AbsValue(price - price[1]), length);
def ChgRatio = if TotChgAvg != 0 then NetChgAvg / TotChgAvg else 0;
def RSI = 50 * (ChgRatio + 1);
def OverSold = over_Sold;
def OverBought = over_Bought;

def bearish_vol = VOLUMEAVG(LENGTH = 20) < VOLUMEAVG(LENGTH = 20)[5];
def bullish_vol = VOLUMEAVG(LENGTH = 20) > VOLUMEAVG(LENGTH = 20)[5];

def bullish_signal = RSI(length = length, averageType = averageType) < over_Sold and bullish_vol;
def bearish_signal = RSI(length = length, averageType = averageType) > over_Bought and bearish_vol;

assignPriceColor(if paintbar and bullish_signal then color.green else if paintbar and bearish_signal then color.red else if paintbar then color.white else color.current);

# Plot Signals
plot bullish = if arrows and bullish_signal then bullish_signal else double.nan;
plot bearish = if arrows and bearish_signal then bearish_signal else double.nan;
Last edited:

Similar threads