• Get $30 off VIP with code SUMMER30. Ends July 27. Happy trading!

Supply and Demand Candles for ThinkorSwim

BenTen

Administrative
Staff
VIP
Another approach toward looking for areas of when the price level is balance or imbalance.

Notes by the original developer:

This Script helps you identify the basing and explosive candles which can be used for Supply and Demand Analysis methodology
  • Blue Candle represents the Boring Candles ==> Demand and Supply is in balance
  • Black Candle (the one in ThinkorSwim is white) represents the Exciting Candles ==> imbalance between Demand and Supply

7TScVaY.png


thinkScript Code

Code:
# Supply and Demand Candles
# Assembled by BenTen at useThinkScript.com
# Converted from https://www.tradingview.com/script/KRlFYBWy-Demand-and-Supply-Candles-open/

input Sensitivity = 1.5;
def Candle_Range = high - low;
def Body_Range = AbsValue(close - open);
def Bar_Lookback = 100;
def Volatility = atr(Bar_Lookback);
def Strength = Volatility * Sensitivity;
def Exciting = (Body_Range > Candle_Range* 0.6) and (Candle_Range >= Strength);
def Boring = Body_Range <= Candle_Range * 0.5;
assignPriceColor(if Exciting then Color.WHITE else if Boring then Color.Blue else Color.Current);
 
Last edited:

Michaeljon

New member
Hello, I am trying to turn my study into a scanner. It right now successfully paints candles colors when they are "exciting" candles.

But when I try to turn it into a scanner all my watchlist shows up. Do I need to turn it into a true / false value? If so how? Thanks so much see code below.

Code:
plot Data = close;
# Calculate the length of the candle's wicks. EXCITING CANDLE ONLY
def UpperWick = high - Max(open, close);
def LowerWick = Min(open, close) - low;
def Wick = UpperWick + LowerWick;

# Calculate the length of the candle's body
def CandleBody = AbsValue(open - close);

input Sensitivity = 1.5;
def Candle_Range = high - low;
def Body_Range = AbsValue(close - open);
def Bar_Lookback = 100;
def Volatility = atr(Bar_Lookback);
def Strength = Volatility * Sensitivity;
def Exciting = (Body_Range > Candle_Range* 0.6) and (Candle_Range >= Strength);

assignPriceColor(if Exciting and open<close then Color.DARK_GREEN else Color.Current);

assignPriceColor(if Exciting and close<open then Color.DARK_RED else Color.Current);
 

MerryDay

Well-known member
VIP
@tradeimbalances This study is not a strategy in itself upon which one can measure 'success'. This indicator might have some validity as part of your existing overall strategy.

The ancient laws of Supply and Demand is the amount of an instrument that is available and the desire of buyers for it, drive the price. It identifies zones on the chart where demand overwhelms supply (the demand zone), driving the price up or where supply overwhelms demand (the supply zone), driving the price down. If this indicator is not in a 'boring' zone, supply and demand are not in balance, lending credence to your strategy that something is going to happen.
 

tradeimbalances

New member
Well said.

So is there any way to identify basing candles in charts with a TOS script ?

I know there are patterns available in TOS.

Has anyone worked out a way to cut down teh screen time looking for the basing candles?
 

MerryDay

Well-known member
VIP
@Six6God This study identifies 'boring' and 'exciting' zones. If the equity does not have any boring or exciting zones at the moment. There will not be anything to see.
 

Similar threads

Top