Convert Tradingview indicator

TraderZen

TraderZen

New member
VIP
Hi,

Please consider converting this indicator from TV to TOS - https://tr.tradingview.com/script/sU9molfV/ This is called Profit Maximizer PMAX.

@BenTen as per your suggestion, the source code is posted below.

Thank you!

Rich (BB code):
//@version=4
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © KivancOzbilgic
//developer: @KivancOzbilgic
//author: @KivancOzbilgic

study("Profit Maximizer","PMax", overlay=true)
src = input(hl2, title="Source")
Periods = input(title="ATR Length", type=input.integer, defval=10)
Multiplier = input(title="ATR Multiplier", type=input.float, step=0.1, defval=3.0)
mav = input(title="Moving Average Type", defval="EMA", options=["SMA", "EMA", "WMA", "TMA", "VAR", "WWMA", "ZLEMA", "TSF"])
length =input(10, "Moving Average Length", minval=1)
changeATR= input(title="Change ATR Calculation Method ?", type=input.bool, defval=true)
showsupport = input(title="Show Moving Average?", type=input.bool, defval=true)
showsignalsk = input(title="Show Crossing Signals?", type=input.bool, defval=true)
showsignalsc = input(title="Show Price/Pmax Crossing Signals?", type=input.bool, defval=false)
highlighting = input(title="Highlighter On/Off ?", type=input.bool, defval=true)
atr2 = sma(tr, Periods)
atr= changeATR ? atr(Periods) : atr2
valpha=2/(length+1)
vud1=src>src[1] ? src-src[1] : 0
vdd1=src<src[1] ? src[1]-src : 0
vUD=sum(vud1,9)
vDD=sum(vdd1,9)
vCMO=nz((vUD-vDD)/(vUD+vDD))
VAR=0.0
VAR:=nz(valpha*abs(vCMO)*src)+(1-valpha*abs(vCMO))*nz(VAR[1])
wwalpha = 1/ length
WWMA = 0.0
WWMA := wwalpha*src + (1-wwalpha)*nz(WWMA[1])
zxLag = length/2==round(length/2) ? length/2 : (length - 1) / 2
zxEMAData = (src + (src - src[zxLag]))
ZLEMA = ema(zxEMAData, length)
lrc = linreg(src, length, 0)
lrc1 = linreg(src,length,1)
lrs = (lrc-lrc1)
TSF = linreg(src, length, 0)+lrs
getMA(src, length) =>
    ma = 0.0
    if mav == "SMA"
        ma := sma(src, length)
        ma

    if mav == "EMA"
        ma := ema(src, length)
        ma

    if mav == "WMA"
        ma := wma(src, length)
        ma

    if mav == "TMA"
        ma := sma(sma(src, ceil(length / 2)), floor(length / 2) + 1)
        ma

    if mav == "VAR"
        ma := VAR
        ma

    if mav == "WWMA"
        ma := WWMA
        ma

    if mav == "ZLEMA"
        ma := ZLEMA
        ma

    if mav == "TSF"
        ma := TSF
        ma
    ma
  
MAvg=getMA(src, length)
longStop = MAvg - Multiplier*atr
longStopPrev = nz(longStop[1], longStop)
longStop := MAvg > longStopPrev ? max(longStop, longStopPrev) : longStop
shortStop = MAvg + Multiplier*atr
shortStopPrev = nz(shortStop[1], shortStop)
shortStop := MAvg < shortStopPrev ? min(shortStop, shortStopPrev) : shortStop
dir = 1
dir := nz(dir[1], dir)
dir := dir == -1 and MAvg > shortStopPrev ? 1 : dir == 1 and MAvg < longStopPrev ? -1 : dir
PMax = dir==1 ? longStop: shortStop
plot(showsupport ? MAvg : na, color=#0585E1, linewidth=2, title="Moving Avg Line")
pALL=plot(PMax, color=color.red, linewidth=2, title="PMax", transp=0)
alertcondition(cross(MAvg, PMax), title="Cross Alert", message="PMax - Moving Avg Crossing!")
alertcondition(crossover(MAvg, PMax), title="Crossover Alarm", message="Moving Avg BUY SIGNAL!")
alertcondition(crossunder(MAvg, PMax), title="Crossunder Alarm", message="Moving Avg SELL SIGNAL!")
alertcondition(cross(src, PMax), title="Price Cross Alert", message="PMax - Price Crossing!")
alertcondition(crossover(src, PMax), title="Price Crossover Alarm", message="PRICE OVER PMax - BUY SIGNAL!")
alertcondition(crossunder(src, PMax), title="Price Crossunder Alarm", message="PRICE UNDER PMax - SELL SIGNAL!")
buySignalk = crossover(MAvg, PMax)
plotshape(buySignalk and showsignalsk ? PMax*0.995 : na, title="Buy", text="Buy", location=location.absolute, style=shape.labelup, size=size.tiny, color=color.green, textcolor=color.white, transp=0)
sellSignallk = crossunder(MAvg, PMax)
plotshape(sellSignallk and showsignalsk ? PMax*1.005 : na, title="Sell", text="Sell", location=location.absolute, style=shape.labeldown, size=size.tiny, color=color.red, textcolor=color.white, transp=0)
buySignalc = crossover(src, PMax)
plotshape(buySignalc and showsignalsc ? PMax*0.995 : na, title="Buy", text="Buy", location=location.absolute, style=shape.labelup, size=size.tiny, color=#0F18BF, textcolor=color.white, transp=0)
sellSignallc = crossunder(src, PMax)
plotshape(sellSignallc and showsignalsc ? PMax*1.005 : na, title="Sell", text="Sell", location=location.absolute, style=shape.labeldown, size=size.tiny, color=#0F18BF, textcolor=color.white, transp=0)
mPlot = plot(ohlc4, title="", style=plot.style_circles, linewidth=0,display=display.none)
longFillColor = highlighting ? (MAvg>PMax ? color.green : na) : na
shortFillColor = highlighting ? (MAvg<PMax ? color.red : na) : na
fill(mPlot, pALL, title="UpTrend Highligter", color=longFillColor)
fill(mPlot, pALL, title="DownTrend Highligter", color=shortFillColor)
 
mbeig

mbeig

New member
https://www.tradingview.com/script/TmqiR1jp-RSI-cyclic-smoothed-v2/

Hi - I really like this smoothed RSI with bands and wanted to use it in thinkorswim. Unfortunately, I am really struggling with converting RMA to thinkscript as well as the nz function in tradingview. Hoping one of you guys have done this already or can give me guidance on how to tackle the RMA and the nz issue. Thanks in advance!

Code:
study(title="RSI cyclic smoothed", shorttitle="cRSI")
src = close
domcycle = input(20, minval=10, title="Dominant Cycle Length")
crsi = 0.0
cyclelen = domcycle / 2
vibration = 10
leveling = 10.0
cyclicmemory = domcycle * 2
//set min/max ranges?

h1 = hline(30, color=color.silver, linestyle=hline.style_dashed)
h2 = hline(70, color=color.silver, linestyle=hline.style_dashed)

torque = 2.0 / (vibration + 1)
phasingLag = (vibration - 1) / 2.0

up = rma(max(change(src), 0), cyclelen)
down = rma(-min(change(src), 0), cyclelen)
rsi = down == 0 ? 100 : up == 0 ? 0 : 100 - 100 / (1 + up / down)
crsi := torque * (2 * rsi - rsi[phasingLag]) + (1 - torque) * nz(crsi[1])

lmax = -999999.0
lmin = 999999.0
for i = 0 to cyclicmemory - 1 by 1
    if nz(crsi[i], -999999.0) > lmax
        lmax := nz(crsi[i])
        lmax
    else
        if nz(crsi[i], 999999.0) < lmin
            lmin := nz(crsi[i])
            lmin

mstep = (lmax - lmin) / 100
aperc = leveling / 100

db = 0.0
for steps = 0 to 100 by 1
    testvalue = lmin + mstep * steps
    above = 0
    below = 0
    for m = 0 to cyclicmemory - 1 by 1
        below := below + iff(crsi[m] < testvalue, 1, 0)
        below

    ratio = below / cyclicmemory
    if ratio >= aperc
        db := testvalue
        break
    else
        continue

ub = 0.0
for steps = 0 to 100 by 1
    testvalue = lmax - mstep * steps
    above = 0
    for m = 0 to cyclicmemory - 1 by 1
        above := above + iff(crsi[m] >= testvalue, 1, 0)
        above

    ratio = above / cyclicmemory
    if ratio >= aperc
        ub := testvalue
        break
    else
        continue


lowband = plot(db, "LowBand", color.aqua)
highband = plot(ub, "HighBand", color.aqua)
fill(h1, h2, color=color.silver, transp=90)
fill(lowband, highband, color=color.gray, transp=90)
plot(crsi, "CRSI", color.fuchsia)
 
M

mmgrode73

New member
Hello Everyone,

I recently came across a pinescript indicator set and have been trying to make it work in thinkscript(thinkorswim) but, frankly, I don't know where to start. Here is the pinescript code:

Code:
study(title="SMA 9/50/180 | EMA 20 | BUY/SELL", overlay=true)

//SMA and EMA code
smaInput1 = input(9, title="SMA1")
smaInput2 = input(50, title="SMA2")
smaInput3 = input(180, title="SMA3")
emaInput1 = input(20, title="EMA1")
sma1 = sma(close, smaInput1)
sma2 = sma(close, smaInput2)
sma3 = sma(close, smaInput3)
EMA1 = ema(close, emaInput1)
plot(sma1, color= color.red , title="SMA1")
plot(sma2, color = color.blue, title="SMA2")
plot(sma3, color= color.white, title="SMA3")
plot(EMA1, color = color.yellow, title="EMA1")

//@version=4
no=input(3,title="BUY/SELL Swing")
Barcolor=input(false,title="BUY/SELL Bar Color")
Bgcolor=input(false,title="BUY/SELL Background Color")
res=highest(high,no)
sup=lowest(low,no)
avd=iff(close>res[1],1,iff(close<sup[1],-1,0))
avn=valuewhen(avd!=0,avd,0)
tsl=iff(avn==1,sup,res)
Buy=crossover(close,tsl)
Sell=crossunder(close,tsl)
plotshape(Buy,title="Buy", color=color.green, style=shape.arrowup,location=location.belowbar, text="Buy")
plotshape(Sell,title="Sell", color=color.red, style=shape.arrowdown,text="Sell")
colr = close>=tsl ? color.green : close<=tsl ? color.red : na
plot(tsl, color=colr, linewidth=3, title="BUY/SELL Chart Line")
barcolor(Barcolor ? colr : na)
bgcolor(Bgcolor ? colr :na)
alertcondition(Buy, title="Buy Signal", message="Buy")
alertcondition(Sell, title="Sell Signal", message="Sell")

Is there any way to convert this? Any help with this would be greatly appreciated.

Cheers,
Matt G
 
C

CasualPhoenix

New member
Hello everyone.

If Its possible I'd like to learn how to convert Tradingview code to TOS myself so as to not freeload.
But until then, I'd like to Add more Supply/Demand and Wyckoff Indicators to the Thinkscript list. Is anyone able to convert these batches of tradingview scripts to Think or Swim?

I'll try to make them as neat as possible to anyone that wants to convert these and help test them to see how useful they are.
If I display any duplicates of existing converted TOS Indicators please omit.

I included the.
  1. Title
  2. Code
  3. Source of code.
If my codes pasted here are an issue, I linked the original page so you can copy/paste the codes from there.

_______________________________________________________________________________________________________________

Title: Basing Candles
Code:
Code:
//@version=2
study("Basing Candles",overlay=true)
body = (close>open) ? (close-open) : (open-close)
isBaseCandle = body <= (high-low)/2
plot(isBaseCandle ? (open+close)/2 : na, color=white, style=circles, transp=0, linewidth=2, offset=0)
Source: https://www.tradingview.com/script/xfNGZoer-Basing-Candles/

_______________________________________________________________________________________________________________

Volume Based S/R
Code:
//@version=3
study(title="Volume Based S/R", shorttitle="VSR", precision=0, overlay=true)

length = input(20, minval=1)
change = volume/volume[1] - 1
stdev = stdev(change, length)
difference = change / stdev[1]
Treshold = input(5)
zero = 0
signal = abs(difference)

leveluphi = valuewhen(signal > Treshold,high[1],0)
leveluplo = valuewhen(signal > Treshold,low[1],0)

//plot(UpperTreshold, color=black)
p1 = plot(leveluphi,style=circles,color=blue)
p2 = plot(leveluplo,style=circles,color=blue)
fill(p1,p2,color=green,transp=90)
//plot(abs(sigma), color = palette, style=columns, title="Volume", transp=65)
Source: https://www.tradingview.com/script/XchidFiQ-Volume-Based-S-R/

_______________________________________________________________________________________________________________

Title: Dynamic SUPRES Multi Timeframe Update
Works Similarly to Bollinger Bands

Code:
study(title="Dynamic SUPRES",shorttitle="DySR", overlay=true)

multiplier = input(title="M", type=float, defval=1.21, minval=0.5, maxval=1.9)
timeframe = input(title="Timeframe", type=resolution, defval="60")
barsc = input(title="BarsColor", type=bool, defval=true)

o = security(tickerid,timeframe,open)
c = security(tickerid,timeframe,close)
atr = security(tickerid,timeframe,sma(tr,5))

anomalia = abs(o-c) > multiplier*atr ? 1 : 0
barcolor(anomalia==1 and barsc==1?silver:na,0)

dot = (anomalia == 1 and c<o)?o+atr:(anomalia == 1 and c>o)?o-atr:na
plotshape(dot,style=shape.square, color=black, location=location.absolute, transp=0)
Source: https://www.tradingview.com/script/6cunN0GZ-Dynamic-SUPRES-Multi-Timeframe-Update/

_______________________________________________________________________________________________________________
Title: [PX] MTF Standard Deviation Level
Code:
//@version=4
study(title="[PX] Standard Deviation Level", overlay=true)

//{
len = input(20, "Length")
multi = input(2.0, "Sensitivity")
res = input(title="Resolution", type=input.resolution, defval="D")
rProgressColor = input("orange", title="Resistance Color (in progress)", options=["aqua","black","blue","fuchsia","gray","green","lime","maroon","navy","olive","orange","purple","red","silver","teal","white","yellow"])
rSettledColor = input("aqua", title="Resistance Color (settled)", options=["aqua","black","blue","fuchsia","gray","green","lime","maroon","navy","olive","orange","purple","red","silver","teal","white","yellow"])
rStyle = input("solid", title="Resistance style", options=['solid','dotted','dashed'])
rWidth = input(1, title="Resistance Width")
sProgressColor = input("orange", title="Support Color (in progress)", options=["aqua","black","blue","fuchsia","gray","green","lime","maroon","navy","olive","orange","purple","red","silver","teal","white","yellow"])
sSettledColor = input("aqua", title="Support Color (settled)", options=["aqua","black","blue","fuchsia","gray","green","lime","maroon","navy","olive","orange","purple","red","silver","teal","white","yellow"])
sStyle = input("solid", title="Support style", options=['solid','dotted','dashed'])
sWidth = input(1, title="Support Width")
//} --------------- INPUT
//{
var bool overbought_active = false
var bool oversold_active = false
var float resistance = na
var float support = na
var int rFrom = 0
var int rTo = 0
var int sFrom = 0
var int sTo = 0
var rId = line(na)
var sId = line(na)

src = stdev(close, len)
up = close + (src * multi)
dn = close - (src * multi)
upperThreshold = security(syminfo.tickerid, res, up[1], lookahead=barmerge.lookahead_on)
lowerThreshold = security(syminfo.tickerid, res, dn[1], lookahead=barmerge.lookahead_on)

//} --------------- INIT
//{
//{
f_calc_bar_time(offset) => ret = time + ((time-time[1]) * offset)
//} --- f_calc_bar_time()
//{
f_set_color(selection)=>
    ret = color.black
    if selection == "gray"
        ret := color.gray
    if selection == "green"
        ret := color.green
    if selection == "aqua"
        ret := color.aqua
    if selection == "blue"
        ret := color.blue
    if selection == "fuchsia"
        ret := color.fuchsia
    if selection == "lime"
        ret := color.lime
    if selection == "maroon"
        ret := color.maroon
    if selection == "navy"
        ret := color.navy
    if selection == "white"
        ret := color.white
    if selection == "yellow"
        ret := color.yellow
    if selection == "olive"
        ret := color.olive
    if selection == "orange"
        ret := color.orange
    if selection == "purple"
        ret := color.purple
    if selection == "red"
        ret := color.red
    if selection == "silver"
        ret := color.silver
    if selection == "teal"
        ret := color.teal
    ret
//} --- f_set_color()
//{
f_set_style(selection)=>
    ret = line.style_solid
    if selection == "dotted"
        ret := line.style_dotted
    if selection == "dashed"
        ret := line.style_dashed
    ret
//} --- f_set_style()
//} --------------- FUNCTIONS

//{
if high > upperThreshold and not overbought_active[1]
    overbought_active := true
    resistance := high
    rFrom := bar_index[1]
    rTo := bar_index
    rId := line.new(rFrom, resistance, rTo, resistance, color=f_set_color(rProgressColor), extend=extend.right, width=rWidth, style=f_set_style(rStyle))
if overbought_active[1]
    if high >= resistance
        resistance := high
        line.set_x1(rId, bar_index[1])
        line.set_x2(rId, bar_index)
        line.set_y1(rId, high)
        line.set_y2(rId, high)
    else
        overbought_active := false
        line.set_color(rId, f_set_color(rSettledColor))

if low < lowerThreshold and not oversold_active[1]
    oversold_active := true
    support := low
    sFrom := bar_index[1]
    sTo := bar_index
    sId := line.new(sFrom, support, sTo, support, color=f_set_color(sProgressColor), extend=extend.right, width=sWidth, style=f_set_style(sStyle))
if oversold_active[1]
    if low <= support
        support := low
        line.set_x1(sId, bar_index[1])
        line.set_x2(sId, bar_index)
        line.set_y1(sId, low)
        line.set_y2(sId, low)
    else
        oversold_active := false
        line.set_color(sId, f_set_color(sSettledColor))
//} --------------- LOGIC
Source: https://www.tradingview.com/script/LZpXY92Y-PX-MTF-Standard-Deviation-Level/

_______________________________________________________________________________________________________________

Title: Godmode 4.0.2 [Supply/Demand]
Code:
//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.

//@version=3
tag0 = "Godmode"

study(tag0 + " 4.0.2", tag0 + " Supply/Demand", true)

//Interior
ben0 = input("CRYPTOCAP:BTC", "Benchmark", string)
src0 = input(hlc3, "Source")
len0 = input(9, "Channel Length")
len1 = input(26, "Average Length")
len2 = input(13, "Short length")
cou0 = input(5, "Count")
smo0 = input(false, "Smoothing")

//Engine
src1 = ben0 != tickerid ? security(ben0, period, src0) : security(tickerid, period, src0)

ttsi(_src, _len0, _len1) =>
    pc = change(_src) / avg(_src, _src[1])
    ma0 = ema(pc, _len0)
    ma1 = ema(ma0, _len1)
    apc = abs(_src - _src[1])
    ma2 = ema(apc, _len0)
    ma3 = ema(ma2, _len1)
    ttsi = 100 * (ma1 / ma3)

tci(_src) =>
    ema((_src - ema(_src, len0)) / (0.025 * ema(abs(_src - ema(_src, len0)), len0)), len1) + 50

mf(_src) =>
    rsi(sum(volume * (change(_src) <= 0 ? 0 : _src), len2), sum(volume * (change(_src) >= 0 ? 0 : _src), len2))

willy(_src) =>
    60 * (_src - highest(_src, len1)) / (highest(_src, len1) - lowest(_src, len1)) + 80

csi(_src) =>
    avg(rsi(_src, len2), ttsi(_src, len0, len1) * 50 + 50)

godmode(_src) =>
    avg(tci(_src), csi(_src), mf(_src), willy(_src))

tradition(_src) =>
    avg(tci(_src), mf(_src), rsi(_src, len2))

wt0 = ben0 != tickerid ? godmode(src1) : tradition(src1)
swt0 = sma(wt0, len0)

gm = smo0 ? swt0 : wt0

gr = 0
incrementer_up = gm > 70 ? 1 : 0
if incrementer_up
    gr := nz(gr[1], 0) + incrementer_up
else
    gr = 0
grH = if (gr >= cou0)
    x = high
grL = if (gr >= cou0)
    y = low
grh = fixnan(grH)
grl = fixnan(grL)

gs = 0
incrementer_down = gm < 30 ? 1 : 0
if incrementer_down
    gs := nz(gs[1], 0) + incrementer_down
else
    gs = 0
gsH = if (gs >= cou0)
    x = high
gsL = if (gs >= cou0)
    y = low
gsh = fixnan(gsH)
gsl = fixnan(gsL)

gsdx = 0
incrementer_both = gm > 70 or gm < 30 ? 1 : 0
if incrementer_both
    gsdx := nz(gsdx[1], 0) + incrementer_both
else
    gsdx = 0
gsdH = if (gsdx >= cou0)
    x = high
gsdL = if (gsdx >= cou0)
    y = low
gsdh = fixnan(gsdH)
gsdl = fixnan(gsdL)

//Chassis
p1 = plot(gsh, "High Support", lime, 1, circles)
p2 = plot(gsl, "Low Support", green, 1, circles)
p3 = plot(grh, "High Resistance", red, 1, circles)
p4 = plot(grl, "Low Resistance", fuchsia, 1, circles)
p5 = plot(gsdh, "High Supply Above/Demand Below", orange, 1, circles)
p6 = plot(gsdl, "Low Supply Above/Demand Below", yellow, 1, circles)

fill(p1, p2, olive)
fill(p3, p4, maroon)
fill(p5, p6, blue)
Source: https://www.tradingview.com/script/xP4FsDqA-Godmode-4-0-2-Supply-Demand/
_______________________________________________________________________________________________________________


Title: Demand and Supply Candles-open
Code:
//@version=3
study("Demand and Supply Candles-open", overlay=true, scale=scale.none)
//Input
Sensitivity = input(title="LegoutStrength",type=float,defval=1.5,minval=1.0,maxval=2.0,step=0.5)
//Variable Declaration
Candle_Range = high - low
Body_Range = abs( close - open )
//Boring Candles or Basing Candles Body Range <= 50% of Candle Range
barcolor( (Body_Range <= Candle_Range * 0.5) ? blue : na)
//Explosive Candles Logic
Bar_Lookback = 100
Volatility = atr(Bar_Lookback)
//Sensitivity = 1.5
Strength = Volatility * Sensitivity
barcolor( ( (Body_Range > Candle_Range * 0.6) and (Candle_Range >= Strength) ) ? black : na)

Source: https://www.tradingview.com/script/KRlFYBWy-Demand-and-Supply-Candles-open/

Title: Indicators: Volume Zone Indicator & Price Zone Indicator
Code:
//
// @author LazyBear
//
// If you use this code in its original/modified form, do drop me a note.
//

Code:
study("Volume Zone Oscillator [LazyBear]", shorttitle="VZO_LB")
length=input(20, title="MA Length")

dvol=sign(close-close[1]) * volume
dvma=ema(dvol, length)
vma=ema(volume, length)
vzo=iff(vma != 0, 100 * dvma / vma,0)

hline(60, color=red)
hline(40, color=gray)
hline(20, color=gray)
hline(0, color=gray)
hline(-20, color=gray)
hline(-40, color=gray)
hline(-60, color=green)

plot(vzo, color=maroon, linewidth=2)
Source: https://www.tradingview.com/script/eM057Bu5-Indicators-Volume-Zone-Indicator-Price-Zone-Indicator/

Wyckoff Indicators. Title: JSE Wyckoff Wave Volume Code
Code:
//
// JSE Wyckoff Wave Volume -SteynTrade
//
// The Stock Market Institute (SMI) describes an propriety indicator the "SMI Wyckoff Wave" for US Stocks. This code is an attempt to make a Wyckoff Wave for the Johannesburg Stock Exchange (JSE).
// The JSE Wyckoff Wave is in a separate code. This is the code for the volume of the wave. Please see code for the JSE Wyckoff Wave which goes with this indicator.
//
// The Wave presents a normalized price for the 10 selected stocks (An Index for the 10 stocks).
// The theory is to select stocks that are widely held, market leaders, actively traded and participate in important market moves.
// This is only my attempt to select 10 stocks and a different selection can be made.
// I am not certain how SMI determine their weightings but what I have done it to equalize the Rand value of the stock volume so that moves are of equal magnitude.
// The then provides a view of the overall condition of the market and volume flow in the market.
//
// I have used the September 2018 price to normalize the stock price for the 10 selected stocks based. The stocks and weightings can be changed periodically depending on the performance and leadership.
//
// Please, let me know if there is a better work around this.

study("JSE Wyckoff Wave Volume V 1.0", shorttitle="JSE WW Vol_SteynTrade V1.0")

//Get volume and closing price for stocks and weight them
v=(security("JSE:BTI", period, volume)/0.79+security("JSE:SHP", period, volume)/2.87+
    security("JSE:NPN", period, volume)/0.18+security("JSE:AGL", period, volume)/1.96+security("JSE:SOL", period, volume)+
    security("JSE:CFR", period, volume)/4.42+security("JSE:MND", period, volume)/1.40+security("JSE:MTN", period, volume)/7.63+
    security("JSE:SLM", period, volume)/7.29+security("JSE:FSR", period, volume)/8.25)/10

c=(security("JSE:BTI", period, close)*0.79+security("JSE:SHP", period, close)*2.87+security("JSE:NPN", period, close)*0.18+
    security("JSE:AGL", period, close)*1.96+security("JSE:SOL", period, close)+security("JSE:CFR", period, close)*4.42+
    security("JSE:MND", period, close)*1.40+security("JSE:MTN", period, close)*7.63+security("JSE:SLM", period, close)*7.29+
    security("JSE:FSR", period, close)*8.25)/10

//Determine the color of the bars to help identify high or low volumn
lookback= input(21)
vsma=sma(v,lookback)
vstd=stdev(v,lookback)

col=    iff(c>c[1] and v>(vsma+(2 * vstd)), green,
    iff(c>c[1] and v>vsma, olive,
    iff(c<c[1] and v>(vsma+(2 * vstd)), red,
    iff(c<c[1] and v>vsma, maroon,
    iff (v<(vsma-vstd), fuchsia, gray)))))


plot(v, style=columns, color=col)

Source: https://www.tradingview.com/script/9QRUHhLJ-JSE-Wyckoff-Wave-Volume-Code/

Title: Wyckoff Volume Color

Code:
study("Wyckoff Volume Color", shorttitle="WyckVol")
lookback=input(10)
showMA=input(true)
lengthMA=input(20)
TimesMA=input(2)
p2=close
v2=volume
p1=p2[lookback]
v1=sma(v2, lengthMA)*TimesMA
c=    iff(p2>p1 and v2>v1, green,
    iff(p2>p1 and v2<v1, blue,
    iff(p2<p1 and v2<v1, orange,
    iff(p2<p1 and v2>v1, red, gray))))
plot(v2, style=columns, color=c)
plot(showMA?sma(v2, lengthMA):na, color=black)

Source: https://www.tradingview.com/script/q9vexZTT-Wyckoff-Volume-Color/

Title: JSE Wyckoff Wave
This ones based off Wyckoff method and the 5 Phases of Accumulation and Distribution along with the Mark up and down phases.
I'm unclear how it handles labeling ReAccumulation/ReDistribution

Code:
//
// JSE Wyckoff Wave - SteynTrade V 1.0

// The Stock Market Institute (SMI) describes an propriety indicator the "SMI Wyckoff Wave".
// This is an attempt to make a Wyckoff Wave for the JSE. Please see code for the JSE Wyckoff Wave Volume which goes with this indicator.
// This Wave presents a normalised price for the 10 selected stocks (An Index for the 10 stocks).
// The theory is to select stocks that are widely held, market leaders, actively traded and participate in important market moves.
// The then provides a view of the overall condition of the market and volume flow in the market with the JSE Wyckoff Wave Volume.
//
// This is only my attempt to select 10 stocks and a different selection can be made.
// I am not certain how SMI determine their weightings but what I have done it to equalize the Rand value of the stock so that moves are of equal magnitude.
//
// I have used the September 2018 price to normalize the stock price for the 10 selected stocks based.
// The stocks and weightings can be changed periodically depending on the performance and leadership.
//
// Most Indecies when constructed assume that all high prices and all low prices happen at the same time and therefor inflate the wicks of the bars.
// To make the wave more representatives for the SMI Wyckoff Wave the price is determined on the 5 minute timeframe which removes this bias.
// However, TradingView does not calculate properly when selecting a lower timeframe than in current period.
// A work around is to call the sma of the highs and add these which provides more realistic tails.
// Please, let me know if there is a better work around this.

study("JSE Wyckoff Wave", shorttitle="JSE WW_SteynTrade")

t=iff(isweekly, 720,
    iff(isdaily, 144, 24))

c=(security("JSE:BTI", period, close)*0.79+security("JSE:SHP", period, close)*2.87+security("JSE:NPN", period, close)*0.18+
    security("JSE:AGL", period, close)*1.96+security("JSE:SOL", period, close)+security("JSE:CFR", period, close)*4.42+
    security("JSE:MND", period, close)*1.40+security("JSE:MTN", period, close)*7.63+security("JSE:SLM", period, close)*7.29+
    security("JSE:FSR", period, close)*8.25)/10

h=(security("JSE:BTI", "10", sma(high,t))*0.79+security("JSE:SHP", "10", sma(high,t))*2.87+security("JSE:NPN", "10", sma(high,t))*0.18+
    security("JSE:AGL", "10", sma(high,t))*1.96+security("JSE:SOL", "10", sma(high,t))+security("JSE:CFR", "10", sma(high,t))*4.42+
    security("JSE:MND", "10", sma(high,t))*1.40+security("JSE:MTN", "10", sma(high,t))*7.63+security("JSE:SLM", "10", sma(high,t))*7.29+
    security("JSE:FSR", "10", sma(high,t))*8.25)/10


l=(security("JSE:BTI", "10", sma(low,t))*0.79+security("JSE:SHP", "10", sma(low,t))*2.87+security("JSE:NPN", "10", sma(low,t))*0.18+
    security("JSE:AGL", "10", sma(low,t))*1.96+security("JSE:SOL", "10", sma(low,t))+security("JSE:CFR", "10", sma(low,t))*4.42+
    security("JSE:MND", "10", sma(low,t))*1.40+security("JSE:MTN", "10", sma(low,t))*7.63+security("JSE:SLM", "10", sma(low,t))*7.29+
    security("JSE:FSR", "10", sma(low,t))*8.25)/10

o=(security("JSE:BTI", period, open)*0.79+security("JSE:SHP", period, open)*2.87+security("JSE:NPN", period, open)*0.18+
    security("JSE:AGL", period, open)*1.96+security("JSE:SOL", period, open)+security("JSE:CFR", period, open)*4.42+
    security("JSE:MND", period, open)*1.40+security("JSE:MTN", period, open)*7.63+security("JSE:SLM", period, open)*7.29+
    security("JSE:FSR", period, open)*8.25)/10


// Set the color of the bar
col=iff(c>c[1], green, red)

plotcandle(o, h, l, c, color=col)

Source: https://www.tradingview.com/script/wITsyXKV-JSE-Wyckoff-Wave/

Title: Wyckoff Wave

Code:
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © MartinShkreli

//@version=4
study("Wyckoff Wave")
f_secureSecurity(_symbol, _res, _src) => security(_symbol, _res, _src, lookahead = barmerge.lookahead_on)

o = nz(f_secureSecurity('NYSE:T*79+NYSE:BAC*50+NYSE:BA*39+NYSE:BMY*119+NYSE:CAT*35+NYSE:DOW*24+NYSE:D D*24+NYSE:XOM*32+NYSE:IBM*21+NYSE:GE*90', "D", open))
o := o + nz(f_secureSecurity('NYSE:F*25+NYSE:UNP*60+NYSE:WMT*43+NYSE:CTVA*24', "D", open))
h = nz(f_secureSecurity('NYSE:T*79+NYSE:BAC*50+NYSE:BA*39+NYSE:BMY*119+NYSE:CAT*35+NYSE:DOW*24+NYSE:D
D*24+NYSE:XOM*32+NYSE:IBM*21+NYSE:GE*90', "D", high))
h := h + nz(f_secureSecurity('NYSE:F*25+NYSE:UNP*60+NYSE:WMT*43+NYSE:CTVA*24', "D", high))
l = nz(f_secureSecurity('NYSE:T*79+NYSE:BAC*50+NYSE:BA*39+NYSE:BMY*119+NYSE:CAT*35+NYSE:DOW*24+NYSE:D
D*24+NYSE:XOM*32+NYSE:IBM*21+NYSE:GE*90', "D", low))
l := l + nz(f_secureSecurity('NYSE:F*25+NYSE:UNP*60+NYSE:WMT*43+NYSE:CTVA*24', "D", low))
c = nz(f_secureSecurity('NYSE:T*79+NYSE:BAC*50+NYSE:BA*39+NYSE:BMY*119+NYSE:CAT*35+NYSE:DOW*24+NYSE:D
D*24+NYSE:XOM*32+NYSE:IBM*21+NYSE:GE*90', "D", close))
c := c + nz(f_secureSecurity('NYSE:F*25+NYSE:UNP*60+NYSE:WMT*43+NYSE:CTVA*24', "D", close))

// Set the color of the bar
col=iff(c>c[1], color.green, color.red)

plotcandle(o, h, l, c, color=col)

Source: https://www.tradingview.com/script/WWsqmrNb-Wyckoff-Wave/

Weis Wave Volume
Code:
//@version=4
study("Weis Wave Volume", shorttitle="WWV", overlay=false, resolution="")
method = input(defval="ATR", options=["ATR", "Traditional", "Part of Price"], title="Renko Assignment Method")
methodvalue = input(defval=14.0, type=input.float, minval=0, title="Value")
pricesource = input(defval="Close", options=["Close", "Open / Close", "High / Low"], title="Price Source")
useClose = pricesource == "Close"
useOpenClose = pricesource == "Open / Close" or useClose
useTrueRange = input(defval="Auto", options=["Always", "Auto", "Never"], title="Use True Range instead of Volume")
isOscillating = input(defval=false, type=input.bool, title="Oscillating")
normalize = input(defval=false, type=input.bool, title="Normalize")
vol = useTrueRange == "Always" or useTrueRange == "Auto" and na(volume) ? tr : volume
op = useClose ? close : open
hi = useOpenClose ? close >= op ? close : op : high
lo = useOpenClose ? close <= op ? close : op : low

if method == "ATR"
    methodvalue := atr(round(methodvalue))
if method == "Part of Price"
    methodvalue := close / methodvalue

currclose = float(na)
prevclose = nz(currclose[1])
prevhigh = prevclose + methodvalue
prevlow = prevclose - methodvalue
currclose := hi > prevhigh ? hi : lo < prevlow ? lo : prevclose

direction = int(na)
direction := currclose > prevclose ? 1 : currclose < prevclose ? -1 : nz(direction[1])
directionHasChanged = change(direction) != 0
directionIsUp = direction > 0
directionIsDown = direction < 0

barcount = 1
barcount := not directionHasChanged and normalize ? barcount[1] + barcount : barcount
vol := not directionHasChanged ? vol[1] + vol : vol
res = barcount > 1 ? vol / barcount : vol

plot(isOscillating and directionIsDown ? -res : res, style=plot.style_columns, color=directionIsUp ? color.green : color.red, transp=75, linewidth=3, title="Wave Volume")

Source: https://www.tradingview.com/script/QrCFs0K2-Weis-Wave-Volume/

Title: Money Tree
Code:
//@version=3
//

strategy(title = "Money Tree", shorttitle = "Money Tree", overlay = true,
  pyramiding = 0, default_qty_type = strategy.percent_of_equity, default_qty_value = 100, calc_on_every_tick=true)

//
// Revision:        6
// Original Author: @JayRogers
// Revision Author: JustUncleL revisions 3, 4, 5
// Revison Author: Dozza
//
// * USE AT YOUR OWN RISK *
//  - There are drawing/painting issues in pinescript when working across resolutions/timeframes that I simply
//    cannot fix here.. I will not be putting any further effort into developing this until such a time when
//    workarounds become available.
//    NOTE: Re-painting has been observed infrequently with default settings and seems OK up to Alternate
//          multiplier of 5.
//          Non-repainting mode is available by setting "Delay Open/Close MA" to 1 or more, but the reported
//          performance will drop dramatically.
//
// R6 Changes by Dozza
//  - Add chop indicator to remove false starts and reduce the amount of trades during choppyness. WIP.
//
//
// R5.1 Changes by JustUncleL
//  - Upgraded to Version 3 Pinescript.
//  - Added option to select Trade type (Long, Short, Both or None)
//  - Added bar colouring work around patch.
//  - Small code changes to improve efficiency.
//  - NOTE: To enable non-Repainting mode set "Delay Open/Close MA" to 1 or more.
//  9-Aug-2017
//  - Correction on SuperSmooth MA calculation.
//
// R5 Changes by JustUncleL
//  - Corrected cross over calculations, sometimes gave false signals.
//  - Corrected Alternate Time calculation to allow for Daily,Weekly and Monthly charts.
//  - Open Public release.
// R4 Changes By JustUncleL
//  - Change the way the Alternate resolution in selected, use a Multiplier of the base Time Frame instead,
//    this makes it easy to switch between base time frames.
//  - Added TMA and SSMA moving average options. But DEMA is still giving the best results.
//  - Using "calc_on_every_tick=false" ensures results between backtesting and real time are similar.
//  - Added Option to Disable the coloring of the bars.
//  - Updated default settings.
//
// R3 Changes by JustUncleL:
//  - Returned a simplified version of the open/close channel, it shows strength of current trend.
//  - Added Target Profit Option.
//  - Added option to reduce the number of historical bars, overcomes the too many trades limit error.
//  - Simplified the strategy code.
//  - Removed Trailing Stop option, not required and in my opion does not work well in Trading View,
//    it also gives false and unrealistic performance results in backtesting.
//
// R2 Changes:
//  - Simplified and cleaned up plotting, now just shows a Moving Average derived from the average of open/close.
//  - Tried very hard to alleviate painting issues caused by referencing alternate resolution..
//
// Description:
//  - Strategy based around Open-Close Crossovers.
// Setup:
//  - I have generally found that setting the strategy resolution to 3-4x that of the chart you are viewing
//    tends to yield the best results, regardless of which MA option you may choose (if any) BUT can cause
//    a lot of false positives - be aware of this
//  - Don't aim for perfection. Just aim to get a reasonably snug fit with the O-C band, with good runs of
//    green and red.
//  - Option to either use basic open and close series data, or pick your poison with a wide array of MA types.
//  - Optional trailing stop for damage mitigation if desired (can be toggled on/off)
//  - Positions get taken automagically following a crossover - which is why it's better to set the resolution
//    of the script greater than that of your chart, so that the trades get taken sooner rather than later.
//  - If you make use of the stops, be sure to take your time tweaking the values. Cutting it too fine
//    will cost you profits but keep you safer, while letting them loose could lead to more drawdown than you
//    can handle.
//  - To enable non-Repainting mode set "Delay Open/Close MA" to 1 or more.
//

// === INPUTS ===
useRes      = input(defval = true, title = "Use Alternate Resolution?")
intRes      = input(defval = 5,    title = "Multiplier for Alernate Resolution")
stratRes    = ismonthly? tostring(interval*intRes,"###M") : isweekly? tostring(interval*intRes,"###W") : isdaily?  tostring(interval*intRes,"###D") : isintraday ? tostring(interval*intRes,"####") : '60'
basisType   = input(defval = "DEMA", title = "MA Type: ", options=["SMA", "EMA", "DEMA", "TEMA", "WMA", "VWMA", "SMMA", "HullMA", "LSMA", "ALMA", "SSMA", "TMA"])
basisLen    = input(defval = 8, title = "MA Period", minval = 1)
offsetSigma = input(defval = 6, title = "Offset for LSMA / Sigma for ALMA", minval = 0)
offsetALMA  = input(defval = 0.85, title = "Offset for ALMA", minval = 0, step = 0.01)
scolor      = input(true, title="Show coloured Bars to indicate Trend?")
delayOffset = input(defval = 1, title = "Delay Open/Close MA (Forces Non-Repainting)", minval = 0, step = 1)
tradeType   = input("LONG", title="What trades should be taken : ", options=["LONG", "SHORT", "BOTH", "NONE"])
// === /INPUTS ===

// Constants colours that include fully non-transparent option.
green100 = #008000FF
lime100  = #00FF00FF
red100   = #FF0000FF
blue100  = #0000FFFF
aqua100  = #00FFFFFF
darkred100 = #8B0000FF
gray100 = #808080FF

// === BASE FUNCTIONS ===
// Returns MA input selection variant, default to SMA if blank or typo.
variant(type, src, len, offSig, offALMA) =>
    v1 = sma(src, len)                                                  // Simple
    v2 = ema(src, len)                                                  // Exponential
    v3 = 2 * v2 - ema(v2, len)                                          // Double Exponential
    v4 = 3 * (v2 - ema(v2, len)) + ema(ema(v2, len), len)               // Triple Exponential
    v5 = wma(src, len)                                                  // Weighted
    v6 = vwma(src, len)                                                 // Volume Weighted
    v7 = 0.0
    v7 := na(v7[1]) ? sma(src, len) : (v7[1] * (len - 1) + src) / len    // Smoothed
    v8 = wma(2 * wma(src, len / 2) - wma(src, len), round(sqrt(len)))   // Hull
    v9 = linreg(src, len, offSig)                                       // Least Squares
    v10 = alma(src, len, offALMA, offSig)                               // Arnaud Legoux
    v11 = sma(v1,len)                                                   // Triangular (extreme smooth)
    // SuperSmoother filter
    // © 2013  John F. Ehlers
    a1 = exp(-1.414*3.14159 / len)
    b1 = 2*a1*cos(1.414*3.14159 / len)
    c2 = b1
    c3 = (-a1)*a1
    c1 = 1 - c2 - c3
    v12 = 0.0
    v12 := c1*(src + nz(src[1])) / 2 + c2*nz(v12[1]) + c3*nz(v12[2])
    type=="EMA"?v2 : type=="DEMA"?v3 : type=="TEMA"?v4 : type=="WMA"?v5 : type=="VWMA"?v6 : type=="SMMA"?v7 : type=="HullMA"?v8 : type=="LSMA"?v9 : type=="ALMA"?v10 : type=="TMA"?v11: type=="SSMA"?v12: v1

// security wrapper for repeat calls
reso(exp, use, res) => use ? security(tickerid, res, exp, gaps=barmerge.gaps_off, lookahead=barmerge.lookahead_off) : exp

// === /BASE FUNCTIONS ===

// === SERIES SETUP ===
closeSeries     = variant(basisType, close[delayOffset], basisLen, offsetSigma, offsetALMA)
openSeries      = variant(basisType, open[delayOffset], basisLen, offsetSigma, offsetALMA)
// === /SERIES ===

// === PLOTTING ===

// Get Alternate resolution Series if selected.
closeSeriesAlt = reso(closeSeries, useRes, stratRes)
openSeriesAlt = reso(openSeries, useRes, stratRes)
//
trendColour = (closeSeriesAlt > openSeriesAlt) ? green: red
bcolour    = (closeSeriesAlt > openSeriesAlt) ? green : red
barcolor(scolor?bcolour:na, title = "Bar Colours")
closeP=plot(closeSeriesAlt, title = "Close Series", color = trendColour, linewidth = 2, style = line, transp = 20)
openP=plot(openSeriesAlt, title = "Open Series", color = trendColour, linewidth = 2, style = line, transp = 20)
fill(closeP,openP,color=trendColour,transp=80)

// === /Chop Indicator ===

colorTurquoise = #34dddd
colorDarkGreen = #006400
colorPaleGreen = #98fb98
colorLime = lime
colorDarkRed = #8B0000
colorRed = red
colorOrange = orange
colorLightOrange = #ffc04c
colorYellow = yellow

turquoiseChoppy = input(false, title="Is turquoise considered choppy?")
darkGreenChoppy = input(false, title="Is dark green considered choppy?")
paleGreenChoppy = input(false, title="Is pale green considered choppy?")
limeChoppy = input(false, title="Is lime considered choppy?")
darkRedChoppy = input(true, title="Is dark red considered choppy?")
redChoppy = input(true, title="Is red considered choppy?")
orangeChoppy = input(true, title="Is orange considered choppy?")
lightOrangeChoppy = input(true, title="Is lightOrange considered choppy?")
yellowChoppy = input(true, title="Is yellow considered choppy?")

source = close
avg = hlc3

pi = atan(1) * 4
periods = 30
highestHigh = highest(periods)
lowestLow = lowest(periods)
range = 25 / (highestHigh - lowestLow) * lowestLow

ema34 = ema(source, 34)
x1_ema34 = 0
x2_ema34 = 1
y1_ema34 = 0
y2_ema34 = (ema34[1] - ema34) / avg * range
c_ema34 = sqrt((x2_ema34 - x1_ema34)(x2_ema34 - x1_ema34) + (y2_ema34 - y1_ema34)(y2_ema34 - y1_ema34))
emaAngle_1 = round(180 * acos((x2_ema34 - x1_ema34)/c_ema34) / pi)
emaAngle = iff(y2_ema34 > 0, - emaAngle_1, emaAngle_1)

chopZoneColor = emaAngle >= 5 ? colorTurquoise : emaAngle < 5 and emaAngle >= 3.57 ? colorDarkGreen : emaAngle < 3.57 and emaAngle >= 2.14 ? colorPaleGreen : emaAngle < 2.14 and emaAngle >= .71 ? colorLime : emaAngle <= -1 * 5 ? colorDarkRed : emaAngle > -1 * 5 and emaAngle <= -1 * 3.57 ? colorRed : emaAngle > -1 * 3.57 and emaAngle <= -1 * 2.14 ? colorOrange : emaAngle > -1 * 2.14 and emaAngle <= -1 * .71 ? colorLightOrange : colorYellow

//choppy = chopZoneColor == colorOrange ? true: chopZoneColor == colorDarkRed ? true : chopZoneColor == colorRed ? true : chopZoneColor == colorOrange ? true : false

choppy = chopZoneColor == colorOrange and orangeChoppy ? true : chopZoneColor == colorDarkRed and darkRedChoppy ? true : chopZoneColor == colorRed and redChoppy ? true : chopZoneColor == colorOrange and orangeChoppy ? true : chopZoneColor == colorTurquoise and turquoiseChoppy ? true : chopZoneColor == colorDarkGreen and darkGreenChoppy ? true : chopZoneColor == colorPaleGreen and paleGreenChoppy ? true : chopZoneColor == colorLime and limeChoppy ? true : chopZoneColor == colorLightOrange and lightOrangeChoppy ? true : chopZoneColor == colorYellow and yellowChoppy ? true : false

// plot(1, color=chopZoneColor, linewidth=4, style=columns)


// === /PLOTTING ===
//

//
// === ALERT conditions
xlong       = crossover(closeSeriesAlt, openSeriesAlt)
xshort      = crossunder(closeSeriesAlt, openSeriesAlt)
longCond    = xlong   // alternative: longCond[1]? false : (xlong or xlong[1]) and close>closeSeriesAlt and close>=open
shortCond   = xshort  // alternative: shortCond[1]? false : (xshort or xshort[1]) and close<closeSeriesAlt and close<=open
// === /ALERT conditions.

// === STRATEGY ===
// stop loss
slPoints    = input(defval = 0, title = "Initial Stop Loss Points (zero to disable)", minval = 0)
tpPoints    = input(defval = 0, title = "Initial Target Profit Points (zero for disable)", minval = 0)
// Include bar limiting algorithm
ebar            = input(defval = 8760, title="Number of Bars for Back Testing", minval=0)
dummy           = input(false,        title="- SET to ZERO for Daily or Longer Timeframes" )
//
// Calculate how many mars since last bar
tdays       = (timenow-time)/60000.0  // number of minutes since last bar
tdays       := ismonthly? tdays/1440.0/5.0/4.3/interval : isweekly? tdays/1440.0/5.0/interval : isdaily? tdays/1440.0/interval : tdays/interval // number of bars since last bar
//
//set up exit parameters
TP = tpPoints>0?tpPoints:na
SL = slPoints>0?slPoints:na

// Make sure we are within the bar range, Set up entries and exit conditions
if ((ebar==0 or tdays<=ebar) and tradeType!="NONE")
    strategy.entry("long", strategy.long, when=longCond==true and tradeType!="SHORT" and choppy==false)
    strategy.entry("short", strategy.short, when=shortCond==true and tradeType!="LONG" and choppy==true)
    strategy.close("long", when = shortCond==true and tradeType=="LONG")
    strategy.close("short", when = longCond==true and tradeType=="SHORT")
    strategy.exit("XL", from_entry = "long", profit = TP, loss = SL)
    strategy.exit("XS", from_entry = "short", profit = TP, loss = SL)

// === /STRATEGY ===
// eof

Source: https://www.tradingview.com/script/96Vxbc2C-Money-Tree/

END.

If I need to reformat, repost, or elaborate on anything especially with the code, I'll be glad to. I noticed emojis show up in posting this, but since I'm new I don't know how to remove them in formatting.


Bonus for anyone that knows of any indicators or create indicators that highlight patterns of:
Drop-Base-Rally
Rally-Base-Rally
And marks them as DBR or RBR on a chart. As Demand Zones.

Rally-Base-Drop
Drop-Base-Drop as RBD and DBD on a chart. As Supply Zones.

if I had the knowledge id create an indicator that uses Sam Seidens Odds Enhancers as well.

Thanks for reading all of this seriously, I know its a lot.
 
Last edited by a moderator:
K

krodr090

New member
The name on the other forum is "accurate trading system"
 
BenTen

BenTen

Administrative
Staff
VIP
@CasualPhoenix A lot of those indicators have already been posted. It would be best if you spent some time looking for them. Use the search feature.
 
C

CasualPhoenix

New member
@CasualPhoenix A lot of those indicators have already been posted. It would be best if you spent some time looking for them. Use the search feature.
I figured some of them did , but I couldn't tell with all of them, especially the wyckoff ones, I haven't to my knowledge with the search function seen any of those.

Wasn't sure if they had different names or not for them.
 
A

Ahmar824

Member
VIP
Hello, please take a look at the code below from tradingview and let me know if some can convert it to TOS? it very useful and give very good signal. Thank you.

Kijun-Price Distance by ramsay09 copy

Code:
//@version=4
study("Kijun-Price Distance", overlay=false, shorttitle="kijun dist BG")

kj_dist_plot    = input(title="Plot Kijun-Sen Price Distance Line", type=input.bool, defval=true)
tkkj_dist_plot  = input(title="Plot Tenkan-Sen Kijun-Sen Distance Line", type=input.bool, defval=false)

kj_hist_mtf     = input(title="Plot Kijun-Sen Price Distance Histogram MTF", type=input.bool, defval=true)

bg_plot         = input(title="Plot Background Color", type=input.bool, defval=true)
bg_plot_htf     = input(title="Plot Higher Time Frame Background Color", type=input.bool, defval=true)



//-------------------- Kijun-Sen Distance -------------------

kj_len          = input(26, minval=1, title="Kijun-Sen Length")
kijun           = avg(lowest(kj_len), highest(kj_len))
kijun_dist      = close - kijun

p1              = plot(0, "Equlibrium Line", color=color.white, transp=50)
p2              = plot(kj_dist_plot ? kijun_dist : na, color= kijun_dist > 0 ? color.green : color.red)

kj_dist_htf     = security(syminfo.tickerid, timeframe.period == "1" or timeframe.period == "5" or timeframe.period == "15" ? "60" : timeframe.period == "60" or timeframe.period == "120" ? "240" : timeframe.isintraday ? "D" : timeframe.period == "D" ? "3D" : timeframe.period == "3D" ? "W" : timeframe.isweekly ? "M" : na, kijun_dist)

bgcolor(bg_plot ? (kj_dist_plot ? (bg_plot_htf ? (kj_dist_htf > 0 ? color.green : color.red) : (kj_dist_plot ? (kijun_dist > 0 ? color.green : color.red) : na)) : na) : na, title="Kijun-Sen Background", transp=85)



//----------------- Tenkan-Sen - Kinun-Sen Distance ---------------------

tk_len          = input(9, minval=1, title="Tenkan-Sen Length")
tenkan          = avg(lowest(tk_len), highest(tk_len))
tkkj_dist       = tenkan - kijun

p3              = plot(tkkj_dist_plot ? tkkj_dist : na, color= tkkj_dist > 0 ? color.blue : tkkj_dist < 0 ? color.red : na)

tkkj_dist_htf   = security(syminfo.tickerid, timeframe.period == "1" or timeframe.period == "5" or timeframe.period == "15" ? "60" : timeframe.period == "60" or timeframe.period == "120" ? "240" : timeframe.isintraday ? "D" : timeframe.period == "D" ? "3D" : timeframe.period == "3D" ? "W" : timeframe.isweekly ? "M" : na, tkkj_dist)

bgcolor(bg_plot ? (tkkj_dist_plot ? (bg_plot_htf ? (tkkj_dist_htf > 0 ? color.blue : color.orange) : (tkkj_dist_plot ? (tkkj_dist > 0 ? color.blue : color.orange) : na)) : na) : na, title="Tenkan-Sen and Kijun-Sen Background", transp=85)



//---------------------- Plot Kijun-Sen Price Distance Histogram MTF ----------------------

h4_kj     = security(syminfo.tickerid,"240", kijun)
d_kj      = security(syminfo.tickerid,"D", kijun)
w_kj      = security(syminfo.tickerid,"W", kijun)
m_kj      = security(syminfo.tickerid,"M", kijun)
//m3_kj     = security(syminfo.tickerid,"3M", kijun)

kj_d_4h     = close - h4_kj
kj_d_d      = close - d_kj
kj_d_w      = close - w_kj
kj_d_m      = close - m_kj
//kj_d_3m     = close - m3_kj

hist_4h     = plot(kj_hist_mtf and timeframe.isintraday ? kj_d_4h : na, color= kj_d_4h > 0 ? color.blue : color.red, style= plot.style_histogram, offset= 2, show_last= 1, transp= 0, linewidth= 4)
hist_d      = plot(kj_hist_mtf and (timeframe.isintraday or timeframe.isdaily) ? kj_d_d : na, color= kj_d_d > 0 ? color.blue : color.red, style= plot.style_histogram, offset= 4, show_last= 1, transp= 0, linewidth= 4)
hist_w      = plot(kj_hist_mtf and (timeframe.isintraday or timeframe.isdaily or timeframe.isweekly) ? kj_d_w : na, color= kj_d_w > 0 ? color.blue : color.red, style= plot.style_histogram, offset= 6, show_last= 1, transp= 0, linewidth= 4)
hist_m      = plot(kj_hist_mtf and (timeframe.isintraday or timeframe.isdaily or timeframe.isweekly or timeframe.ismonthly) ? kj_d_m : na, color= kj_d_m > 0 ? color.blue : color.red, style= plot.style_histogram, offset= 8, show_last= 1, transp= 0, linewidth= 4)
//hist_3m     = plot(kj_hist_mtf ? kj_d_3m : na, color= kj_d_3m > 0 ? color.blue : color.red, style= plot.style_histogram, offset= 10, show_last= 1, transp= 0, linewidth= 4)
 
C

CasualPhoenix

New member
@CasualPhoenix A lot of those indicators have already been posted. It would be best if you spent some time looking for them. Use the search feature.
Ben I guess I'm just dumb or blind haha, because some of the ones I posted I do not see here, and for wyckoff for example, I see mentions of people asking about wyckoff indicators on Thinkscript, but I don't see some of the ones I posted here.

Or to not be a pain is there a lesson anywhere, that shows you how to convert tradingview to TOS?

I don't want to be a bother. So I'd be glad to do them myself if possible.
 
A

Ahmar824

Member
VIP
@BenTen @CasualPhoenix Yeah I have checked however this one is not converted. Also it gives you very reliable signals. So if it's not too difficult if we can convert this one I think it will be really nice for the whole community.
 
F

farout60

New member
Can anyone help convert TradingView indicator into TOS?

Code:
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © TradeStation

//@version=4

//MA types are:
// 1 - simple
// 2 - exponential
// 3 - Hull
// 4 - weighted
// 5 - volume weighted


study(title="MA speed")
// these variables are used below to determine direction and color

var Pcolor = color.gray

// accept user inputs for the types of moving average
length = input(50, minval=1, title="Length")
src = input(close, title="Source")
matype = input(1, minval=1, maxval=5, title="AvgType")

// calculate moving averages
simplema = sma(src,length)
exponentialma = ema(src,length)
hullma = wma(2*wma(src, length/2)-wma(src, length), round(sqrt(length)))
weightedma = wma(src, length)
volweightedma = vwma(src, length)

// assign value based on user input
avgval = matype==1 ? simplema : matype==2 ? exponentialma : matype==3 ? hullma : matype==4 ? weightedma : matype==5 ? volweightedma : na

// Calculate MA speed
MA_speed = (avgval / avgval[1] -1 ) *100

// set color as green or red
if ( MA_speed > 0 )
    Pcolor := color.green
if ( MA_speed < 0 )
    Pcolor := color.red

// Plot output
plot(MA_speed, color=Pcolor, linewidth=3)
plot(0,color=color.white, linewidth=1)
 
Last edited by a moderator:
G

GERMANB1990

New member
so ENTROPY is defined as Lack of order or predictability; gradual decline into disorder.

i found an entropy indicator that will on trading view, could someone help convert this idea to tos script? i am new to thins channel, I have some indicators i would like to share on here in the future, thank you.

Code:
//@version=4
//
// @author Kocurekc
// Rev-2, Shannon entropy
// Rev-1, new picture for moderators
// Rev-0, added colors, flipped delta to clean up view
//
// Live a little, publish your scripts...be a John Elhers
//

study(title="Shannon Entropy", shorttitle="Info-S", precision=2)
src = input(close, title="source", type=input.source)
len = input(9, title="Entropy Length", type=input.integer)
range = input(0.015, title="color level", type=input.float)
bc = input(true, title="Include Source", type=input.bool)
vc = input(true, title="Include Volume", type=input.bool)


cr = src/sum(src,len)
vr = log(volume)/sum(log(volume),len)
info = ((vc ? sum(vr*log10(vr)/log10(2),len) : 0) - (bc ? vc ? sum(cr*log10(cr)/log10(2),len) : sum(cr*log10(cr)/log10(2),len) : 0))

hc1 = info > range ? #4caf50 : info > range * -1 ? #ffeb3b : info <= range * -1 ? #f44336 : na

plot(info, style=(bc and vc ? plot.style_columns :plot.style_line ), color=hc1 )
plot((bc and vc ? 0 : na), color=color.gray)

https://www.tradingview.com/script/90gGxKtX-Shannon-Entropy-V2/
 
C

CasualPhoenix

New member
@BenTen @CasualPhoenix Yeah I have checked however this one is not converted. Also it gives you very reliable signals. So if it's not too difficult if we can convert this one I think it will be really nice for the whole community.
I agree,

I've been making a trading rule list that combines Wyckoff, S/D zones and Indicators based on market conditions, so I'm vested in these indicators. But

I see why Ben isn't gung ho to do it, lol i still am struggling to figure out how Tradingview > TOS works. I see some patterns but its not converting like I'd like.
 
P

PocketsofTime

New member
I like this indicator on Trading View however would like to use it in TOS to eliminate having an extra page open during trading. Could someone help me convert this please.

Code:
study("RSI Algo", overlay=true)
myPeriod = input(defval=14, type=integer, title="Period")
myThresholdUp = input(defval=70, type=float, title="Upper Threshold")
myThresholdDn = input(defval=30, type=float, title="Lower Threshold")
myAlgoFlipToggle = input(defval=false, type=bool, title="Imverse Algorthim")
myLineToggle = input(defval=true, type=bool, title="Show Lines")
myLabelToggle = input(defval=true, type=bool, title="Show Labels")
myRSI=rsi(close, myPeriod)
buy = myAlgoFlipToggle ? falling(myRSI,1) and cross(myRSI, myThresholdDn) : rising(myRSI, 1) and cross(myRSI,myThresholdUp)
sell = myAlgoFlipToggle ? rising(myRSI, 1) and cross(myRSI,myThresholdUp) : falling(myRSI,1) and cross(myRSI, myThresholdDn)
myPosition = buy==1 ? 0 : sell==1 or myPosition[1]==1 ? 1 : 0
trendColor = buy ? red : sell ? green : na
plot(myLineToggle ? buy and myPosition[1]==1 ? low - 0.004: sell and myPosition[1]==0 ? high + 0.004 : na : na,
color=trendColor, style=line, linewidth=4, editable=false)
plotshape(myLabelToggle ? buy and myPosition[1]==1 ? low - 0.005 : na : na, style=shape.labelup, location=location.absolute,
text="Buy", transp=0, textcolor = white, color=black, editable=false)
plotshape(myLabelToggle ? sell and myPosition[1]==0 ? high + 0.005 : na : na, style=shape.labeldown,
location=location.absolute, text="Sell", transp=0, textcolor = white, color=black, editable=false)
 
G

gameg2l

New member
Hi all,
Been learning a lot from this forum and learned some awesome scripting in TOS from the threads

I've got some helpful indicators in Tradingview and had been attempting to figure out how to make them into Thinkscript. Unfortunately, I had failed. For this particular one, I was using the KDJ script found in one of the thread to base off of when converting this following script but couldn't understand the base functions defined. Not to mention the variables... Anyways, here's the script if someone more skilled can help me out and take a stab at it.

It's an indicator with histogram indicating relative lows that whales may be loading at. And it's been quite reliable on the larger cap stocks.

I appreciate any help! Thanks!!

Here's the pine script

(Special thanks to the original script creator: Blackcat1402 )

Code:
//L2 KDJ with Whale Pump Detector

// This source code is subject to the terms of the Mozilla Public License 2.0 at [URL]https://mozilla.org/MPL/2.0/[/URL]
// © blackcat1402

//@version=4
study("L2 KDJ with Whale Pump Detector", overlay=false)
//functions
xrf(values, length) =>
    r_val = float(na)
    if length >= 1
        for i = 0 to length by 1
            if na(r_val) or not na(values[I])
                r_val  :=  values
[I]                r_val
    r_val
xsa(src,len,wei) =>
    sumf = 0.0
    ma = 0.0
    out = 0.0
    sumf  :=  nz(sumf[1]) - nz(src[len]) + src
    ma  :=  na(src[len]) ? na : sumf/len
    out  :=  na(out[1]) ? ma : (src*wei+out[1]*(len-wei))/len
    out


// inputs
n1 = input(18, title="n1", type=input.integer, minval = 1)
m1 = input(4, title="m1", type=input.integer, minval = 1)
m2 = input(4, title="m2", type=input.integer, minval = 1)

//define whale pump prepareation behavior modeling
var1 = xrf(low,1)
var2 = xsa(abs(low-var1),3,1)/xsa(max(low-var1,0),3,1)*100
var3 = ema(iff(close*1.2,var2*10,var2/10),3)
var4 = lowest(low,38)
var5 = highest(var3,38)
var6 = iff(lowest(low,90),1,0)
var7 = ema(iff(low<=var4,(var3+var5*2)/2,0),3)/618*var6
var8 = ((close-lowest(low,21))/(highest(high,21)-lowest(low,21)))*100
var9 = xsa(var8,13,8)
//define whale pump variable as var7
whalepump = var7
//plot whale buy histograms
plotcandle(0, var7, 0, var7, color=var7>0?color.yellow:na)

//define KDJ
rsv = (close-lowest(low,n1))/(highest(high,n1)-lowest(low,n1))*100
k = xsa(rsv,m1,1)
d = xsa(k,m2,1)
j = 3*k-2*d
// plot signal
plot(k,color=color.white, linewidth =2)
plot(d,color=color.yellow, linewidth =2)
plot(j,color=color.fuchsia, linewidth =4)

//generate long entry in lime and short entry in lime
bgcolor(crossover(j,0)?color.lime:na, transp=40)
bgcolor(crossunder(j,k) and j>50 ?color.red:na, transp=40)
bgcolor(crossunder(j,90)?color.red:na, transp=40)

//define bottom zone threshold values
zero = hline(0,color=color.yellow, linestyle=hline.style_dotted)
bot = hline(-10, color=color.lime, linestyle=hline.style_dotted)
fill(zero,bot,color=color.lime,transp=80)[/I][/I]
 

Similar threads

Top