Godmode 4.0.2 [Supply/Demand] For ThinkOrSwim

jagat

New member
The author states: This is the third iteration of Godmode. The idea here is to input the appropriate benchmark tickerid to the asset class you're trading and to paint zones according to the price activity of the selected tickerid. This works very well trying to paint meaningful zones against noisy stocks, currencies, commodities etc. Use a correlation coefficient to determine the best benchmark for your asset class.
A79ker1.png

The original Tradingview script can be found:
https://www.tradingview.com/script/xP4FsDqA-Godmode-4-0-2-Supply-Demand/

The new ThinkOrSwim code can be found below.
 
Last edited by a moderator:
check below:

CSS:
# Indicator for TOS
#//Massive thank you to LEGION, LazyBear, xSilas, Ni6HTH4wK, sco77m4r7and, SNOW_CITY, oh92,
#//... alexgrover, cI8DH, DonovanWall and shtcoinr for doing the initial builds, building
#//... indicators that I incorporated into this script or just generally giving me a hand
#//... when needed.
#tag0 = "Godmode"
#study(tag0 + " 4.0.2", tag0 + " Supply/Demand", true)
# Converted by Sam4Cok@Samer800    - 10/2024

input Benchmark = "SPY"; #("CRYPTOCAP:BTC", "Benchmark", string)
input Source = FundamentalType.HLC3; #, "Source")
input ChannelLength = 9; #, "Channel Length")
input AverageLength = 26; #, "Average Length")
input ShortLength = 13; #, "Short length")
input Count = 5; #, "Count")
input Smoothing = no; #(false, "Smoothing")

def na = Double.NaN;
def last = IsNaN(close);
def cond = Benchmark == GetSymbol();
def len0 = ChannelLength;
def len1 = AverageLength;
def len2 = ShortLength;
#//Engine
def src1 = Fundamental(FundamentalType = Source, Symbol = Benchmark);

script csi {
    input _src = hlc3;
    input len0 = 9;
    input len1 = 26;
    input len2 = 13;
    def nRSI = RSI(Price = _src, Length = len2);
    def avg = (_src + _src[1]) / 2;
    def change = _src - _src[1];
    def pc = change / avg;
    def ma0 = ExpAverage(pc, len0);
    def ma1 = ExpAverage(ma0, len1);
    def apc = AbsValue(_src - _src[1]);
    def ma2 = ExpAverage(apc, len0);
    def ma3 = ExpAverage(ma2, len1);
    def ttsi = 100 * (ma1 / ma3) * 50 + 50;
    def csi = (nRSI + ttsi) / 2;
    plot out = csi;
}
script tci {
    input _src = hlc3;
    input len0 = 9;
    input len1 = 26;
    def ema1 = ExpAverage(_src, len0);
    def diff = _src - ema1;
    def ema2 = ExpAverage(AbsValue(diff), len0);
    def tci1 = (diff) / (0.025 * ema2);
    def tci = ExpAverage(tci1, len1) + 50;
    plot out = tci;
}
script mf {
    input _src = hlc3;
    input len2 = 13;
    def change = _src - _src[1];
    def sum1 = Sum(volume * (if change <= 0 then 0 else _src), len2);
    def sum2 = sum(volume * (if change >= 0 then 0 else _src), len2);
    def diff = sum1 - sum2;
    def mf = RSI(Price = diff, Length = len2);
    plot out = mf;
}
script willy {
    input _src = hlc3;
    input len1 = 26;
    def hh = Highest(_src, len1);
    def ll = Lowest(_src, len1);
    def willy = 60 * (_src - hh) / (hh - ll) + 80;
    plot out = willy;
}

def nRSI = RSI(Price = src1, Length = len2);
def tci = tci(src1, len0, len1);
def csi = CSI(src1, len0, len1, len2);
def mf = mf(src1, len2);
def willy = willy(src1, len1);
def tradition = (tci + nRSI + mf) / 3;
def godmode = (tci + csi + mf + willy) / 4;
def wt0 = if !cond then godmode else tradition;
def swt0 = Average(wt0, len0);
def gm = if Smoothing then swt0 else wt0;
def incrementer_up = if gm > 70 then 1 else 0;
def incrementer_both = if gm > 70 or gm < 30 then 1 else 0;
def incrementer_down = if gm < 30 then 1 else 0;

def gr = if incrementer_up then gr[1] + incrementer_up else 0;
def grH1 = if (gr >= Count) then high else grH1[1];
def grL1 = if (gr >= Count) then low else grL1[1];
def grh = if grH1 then grH1 else grH[1];
def grl = if grL1 then grL1 else grL[1];

def gs = if incrementer_down then gs[1] + incrementer_down else 0;
def gsH1 = if (gs >= Count) then high else gsH1[1];
def gsL1 = if (gs >= Count) then low else gsL1[1];
def gsh = if gsH1 then gsH1 else gsH[1];
def gsl = if gsL1 then gsL1 else gsL[1];

def gsdx = if incrementer_both then gsdx[1] + incrementer_both else 0;
def gsdH1 = if (gsdx >= Count) then high else gsdH1[1];
def gsdL1 = if (gsdx >= Count) then low else gsdL1[1];
def gsdh = if gsdH1 then gsdH1 else gsdH[1];
def gsdl = if gsdL1 then gsdL1 else gsdL[1];

#/Chassis
plot p1 = if gsh and gsh==gsh[1] then gsh else na; #, "High Support", lime, 1, circles)
plot p2 = if gsl and gsl==gsl[1] then gsl else na; #, "Low Support", green, 1, circles)
plot p3 = if grh and grh==grh[1] then grh else na; #, "High Resistance", red, 1, circles)
plot p4 = if grl and grl==grl[1] then grl else na ;#, "Low Resistance", fuchsia, 1, circles)
def p5 = if gsdh and gsdh==gsdh[1] then gsdh else na; #, "High Supply Above/Demand Below", orange, 1, circles)
def p6 = if gsdl and gsdl== gsdl[1] then gsdl else na; #, "Low Supply Above/Demand Below", yellow, 1, circles)

p1.SetDefaultColor(Color.DARK_GREEN);
p2.SetDefaultColor(Color.GREEN);
p3.SetDefaultColor(Color.RED);
p4.SetDefaultColor(Color.DARK_RED);
p1.SetPaintingStrategy(PaintingStrategy.HoRIZONTAL);
p2.SetPaintingStrategy(PaintingStrategy.HoRIZONTAL);
p3.SetPaintingStrategy(PaintingStrategy.HoRIZONTAL);
p4.SetPaintingStrategy(PaintingStrategy.HoRIZONTAL);

AddCloud(p1, p2, Color.DARK_GREEN);
AddCloud(p3, p4, Color.DARK_RED);
AddCloud(p5, p6, Color.GRAY);

# End of CODE
 

Join useThinkScript to post your question to a community of 21,000+ developers and traders.

Thread starter Similar threads Forum Replies Date
S Previous HOD and LOD for Supply Demand for ThinkOrSwim Custom 1
A RSI Supply/Demand For ThinkOrSwim Custom 12

Similar threads

Not the exact question you're looking for?

Start a new thread and receive assistance from our community.

87k+ Posts
224 Online
Create Post

Similar threads

Similar threads

The Market Trading Game Changer

Join 2,500+ subscribers inside the useThinkScript VIP Membership Club
  • Exclusive indicators
  • Proven strategies & setups
  • Private Discord community
  • ‘Buy The Dip’ signal alerts
  • Exclusive members-only content
  • Add-ons and resources
  • 1 full year of unlimited support

Frequently Asked Questions

What is useThinkScript?

useThinkScript is the #1 community of stock market investors using indicators and other tools to power their trading strategies. Traders of all skill levels use our forums to learn about scripting and indicators, help each other, and discover new ways to gain an edge in the markets.

How do I get started?

We get it. Our forum can be intimidating, if not overwhelming. With thousands of topics, tens of thousands of posts, our community has created an incredibly deep knowledge base for stock traders. No one can ever exhaust every resource provided on our site.

If you are new, or just looking for guidance, here are some helpful links to get you started.

What are the benefits of VIP Membership?
VIP members get exclusive access to these proven and tested premium indicators: Buy the Dip, Advanced Market Moves 2.0, Take Profit, and Volatility Trading Range. In addition, VIP members get access to over 50 VIP-only custom indicators, add-ons, and strategies, private VIP-only forums, private Discord channel to discuss trades and strategies in real-time, customer support, trade alerts, and much more. Learn all about VIP membership here.
How can I access the premium indicators?
To access the premium indicators, which are plug and play ready, sign up for VIP membership here.
Back
Top