Strategy · Pine Script v5 · On the chart

5msm VISHNU

by hasnocool

This strategy overlays several classic studies on the price chart.

View on GitHub

GitHub stars106on the repository
Pine versionv5runs as is
Lines of code360
Settings30inputs
LicenceGPL-3.0
Last update2 years ago18 Sep 2024

Add It to Your TradingView Chart

  1. 1Copy the scriptPress Copy script above, or the copy button on the code below.
  2. 2Open the Pine EditorOpen a TradingView chart and choose Pine Editor at the bottom of the screen.
  3. 3Paste over the templateCreate a new strategy, select all of the template text and paste. Press Save and give it a name.
  4. 4Add it to the chartPress Add to chart. The trades and results appear in the Strategy Tester tab; adjust the settings with the gear icon.

Source Code

360 lines of Pine Script v5 from 5MSM VISHNU.pine, published under GPL-3.0. Keep the author's credit and licence lines when you reuse it.

5MSM VISHNU.pine
//@version=5
strategy("5msm VISHNU", overlay=true, overlay=true,process_orders_on_close=true, pyramiding = 1)
//indicator(title="mahakaal", shorttitle="mahakaal", timeframe="", timeframe_gaps=true,process_orders_on_close=true),calc_on_every_tick=true
green = #26A69A
red = #FF0000
//Yellow = #fcf932
// Getting inputs
fast_length = input(title="Fast Length", defval=12)
slow_length = input(title="Slow Length", defval=26)
src3 = input(title="Source", defval=close)
signal_length = input.int(title="Signal Smoothing",  minval = 1, maxval = 50, defval = 9)
sma_source = input.string(title="Oscillator MA Type",  defval="EMA", options=["SMA", "EMA"])
sma_signal = input.string(title="Signal Line MA Type", defval="EMA", options=["SMA", "EMA"])
// Plot colors
// col_macd = input(#2962FF, "MACD Line  ", group="Color Settings", inline="MACD")
// col_signal = input(#FF6D00, "Signal Line  ", group="Color Settings", inline="Signal")
// col_grow_above = input(#26A69A, "Above   Grow", group="Histogram", inline="Above")
//col_fall_above = input(#B2DFDB, "Fall", group="Histogram", inline="Above")
//col_grow_below = input(#FFCDD2, "Below Grow", group="Histogram", inline="Below")
//col_fall_below = input(#FF5252, "Fall", group="Histogram", inline="Below")
// Calculating
fast_ma = sma_source == "SMA" ? ta.sma(src3, fast_length) : ta.ema(src3, fast_length)
slow_ma = sma_source == "SMA" ? ta.sma(src3, slow_length) : ta.ema(src3, slow_length)
macd = fast_ma - slow_ma
signal = sma_signal == "SMA" ? ta.sma(macd, signal_length) : ta.ema(macd, signal_length)
hist = macd - signal
//hline(0, "Zero Line", color=color.new(#787B86, 50))
//@version=5
//indicator(title="Moving Average Exponential", shorttitle="EMA", overlay=true, timeframe="", timeframe_gaps=true)
len = input.int(200, minval=1, title="Length")
src2 = input(close, title="Source")
//offset = input.int(title="Offset", defval=0, minval=-500, maxval=500)
Bahubali = ta.ema(src2, len)
//plot(out, title="EMA", color=color.blue, offset=offset)
//@version=5
//indicator(title="Williams Alligator", shorttitle="Alligator", overlay=true, timeframe="", timeframe_gaps=true)
smma(src, length) =>
    smma =  0.0
    smma := na(smma[1]) ? ta.sma(src, length) : (smma[1] * (length - 1) + src) / length
    smma
jawLength = input.int(13, minval=1, title="Jaw Length")
teethLength = input.int(8, minval=1, title="Teeth Length")
lipsLength = input.int(5, minval=1, title="Lips Length")
jawOffset = input(8, title="Jaw Offset")
teethOffset = input(5, title="Teeth Offset")
lipsOffset = input(3, title="Lips Offset")
jaw = smma(hl2, jawLength)
teeth = smma(hl2, teethLength)
lips = smma(hl2, lipsLength)
tyme = time("1440", "0930-2300")
//plot(jaw, "Jaw", offset = jawOffset, color=#2962FF)
//@version=5
//indicator(title="Volume Weighted Average Price", shorttitle="VWAP", overlay=true, timeframe="", timeframe_gaps=true)
hideonDWM = input(false, title="Hide VWAP on 1D or Above", group="VWAP Settings")
var anchor = input.string(defval = "Session", title="Anchor Period",
 options=["Session", "Week", "Month", "Quarter", "Year", "Decade", "Century", "Earnings", "Dividends", "Splits"], group="VWAP Settings")
src9 = input(title = "Source", defval = hlc3, group="VWAP Settings")
offsetvwap = input(0, title="Offset", group="VWAP Settings")
if barstate.islast and ta.cum(volume) == 0
    runtime.error("No volume is provided by the data vendor.")
new_earnings = request.earnings(syminfo.tickerid, earnings.actual, barmerge.gaps_on, barmerge.lookahead_on, ignore_invalid_symbol=true)
new_dividends = request.dividends(syminfo.tickerid, dividends.gross, barmerge.gaps_on, barmerge.lookahead_on, ignore_invalid_symbol=true)
new_split = request.splits(syminfo.tickerid, splits.denominator, barmerge.gaps_on, barmerge.lookahead_on, ignore_invalid_symbol=true)
isNewPeriod = switch anchor
    "Earnings"  => not na(new_earnings)
    "Dividends" => not na(new_dividends)
    "Splits"    => not na(new_split)
    "Session"   => timeframe.change("D")
    "Week"      => timeframe.change("W")
    "Month"     => timeframe.change("M")
    "Quarter"   => timeframe.change("3M")
    "Year"      => timeframe.change("12M")
    "Decade"    => timeframe.change("12M") and year % 10 == 0
    "Century"   => timeframe.change("12M") and year % 100 == 0
    => false
isEsdAnchor = anchor == "Earnings" or anchor == "Dividends" or anchor == "Splits"
if na(src9[1]) and not isEsdAnchor
    isNewPeriod := true
float vwapValue = na
if not (hideonDWM and timeframe.isdwm)
    [_vwap, _stdevUpper, _] = ta.vwap(src9, isNewPeriod, 1)
    vwapValue := _vwap
    //stdevAbs = _stdevUpper - _vwap
//plot(vwapValue, title="VWAP", color=#2962FF, offset=offsetvwap)
bullbody = close - open
bearbody = open - close
vwapup = (close > vwapValue) and (open > vwapValue) and (hist > 0) and (low[1] < vwapValue) and (bullbody > 5) and tyme
vwapdwn = (close < vwapValue) and (open < vwapValue) and (hist < 0) and (high[1] > vwapValue) and (bearbody > 5) and tyme
plotshape(vwapup, style=shape.arrowup, color=color.green,location=location.belowbar, title="vwap uptrend", size = size.normal) //
plotshape(vwapdwn, style=shape.arrowdown, color=color.red,location=location.abovebar, title="vwap down trend", size = size.normal) //
// Get ATR inputs
//indicator('ATR Trailing Stop Indicator [Chart]', 'S/L+', overlay=true)
atrLength = input.int(title='ATR Length', defval=14, minval=1, group='ATR Settings')
lookback = input.int(title='Bars To Look Back For Highs/Lows', defval=7, minval=1, group='ATR Settings')
multiplier = input.float(title='ATR Multiplier', defval=1.0, minval=0.1, group='ATR Settings')
trailType = input.string(title='Trailing Stop Type', defval='Open', options=['High/Low', 'Close', 'Open'], group='ATR Settings')
// Get display table inputs
showATR = input.bool(title='Show ATR?', defval=true, group='Display Settings')
atrColor = input.color(title='ATR Color', defval=color.new(color.blue, 100), group='Display Settings')
// atrLocation = input.string(title='ATR Location', defval='BR', options=['TR', 'TC', 'BR', 'BC'], group='Display Settings')
// Calculate data
atr = ta.atr(atrLength) - 5
longStopatr = (trailType == 'High/Low' ? ta.lowest(low, lookback) : trailType == 'Close' ? close : open) - atr * multiplier
shortStopatr = (trailType == 'High/Low' ? ta.highest(high, lookback) : trailType == 'Close' ? close : open) + atr * multiplier
//@version=5
//strategy(title='Range Filter Buy and Sell 5min [Strategy]', overlay=true, commission_type=strategy.commission.percent, commission_value=0.025, default_qty_type=strategy.cash, default_qty_value=10000, initial_capital=10000, slippage=0)
sources = input(defval=close, title='Source')
isHA = input(false, 'Use HA Candles')
heikenashi_1 = ticker.heikinashi(syminfo.tickerid)
security_1 = request.security(heikenashi_1, timeframe.period, sources)
srcz = isHA ? security_1 : sources
// Sampling Period
// Settings for 5min chart, BTCUSDC. For Other coin, change the paremeters
per = input.int(defval=50, minval=1, title='Sampling Period')
// Range Multiplier
mult = input.float(defval=3.0, minval=0.1, title='Range Multiplier')
// Smooth Average Range
smoothrng(x, t, m) =>
    wper = t * 2 - 1
    avrng = ta.ema(math.abs(x - x[1]), t)
    smoothrng = ta.ema(avrng, wper) * m
    smoothrng
smrng = smoothrng(srcz, per, mult)
// Range Filter
rngfilt(x, r) =>
    rngfilt = x
    rngfilt := x > nz(rngfilt[1]) ? x - r < nz(rngfilt[1]) ? nz(rngfilt[1]) : x - r : x + r > nz(rngfilt[1]) ? nz(rngfilt[1]) : x + r
    rngfilt
filt = rngfilt(srcz, smrng)
// Filter Direction
upward = 0.0
upward := filt > filt[1] ? nz(upward[1]) + 1 : filt < filt[1] ? 0 : nz(upward[1])
downward = 0.0
downward := filt < filt[1] ? nz(downward[1]) + 1 : filt > filt[1] ? 0 : nz(downward[1])
// Break Outs 
longCond = bool(na)
shortCond = bool(na)
longCond := srcz > filt and srcz > srcz[1] and upward > 0 or srcz > filt and srcz < srcz[1] and upward > 0
shortCond := srcz < filt and srcz < srcz[1] and downward > 0 or srcz < filt and srcz > srcz[1] and downward > 0
CondIni = 0
CondIni := longCond ? 1 : shortCond ? -1 : CondIni[1]
longCondition = longCond and CondIni[1] == -1
shortCondition = shortCond and CondIni[1] == 1
//Alerts
plotshape(longCondition, title='Buy Signal', text='b_z', textcolor=color.new(color.white, 0), style=shape.labelup, size=size.normal, location=location.belowbar, color=color.new(color.green, 0))
plotshape(shortCondition, title='Sell Signal', text='s_z', textcolor=color.new(color.white, 0), style=shape.labeldown, size=size.normal, location=location.abovebar, color=color.new(color.red, 0))
// indicator(title='UT Bot', overlay=true)
//CREDITS to HPotter for the orginal code. The guy trying to sell this as his own is a scammer lol. 
srcUT = close
keyvalue = input.float(3, title='Key Vaule. \'This changes the sensitivity\'', step=.5)
atrperiod = input(10, title='ATR Period')
xATR = ta.atr(atrperiod)
nLoss = keyvalue * xATR
xATRTrailingStop = 0.0
iff_1 = srcUT > nz(xATRTrailingStop[1], 0) ? srcUT - nLoss : srcUT + nLoss
iff_2 = srcUT < nz(xATRTrailingStop[1], 0) and srcUT[1] < nz(xATRTrailingStop[1], 0) ? math.min(nz(xATRTrailingStop[1]), srcUT + nLoss) : iff_1
xATRTrailingStop := srcUT > nz(xATRTrailingStop[1], 0) and srcUT[1] > nz(xATRTrailingStop[1], 0) ? math.max(nz(xATRTrailingStop[1]), srcUT - nLoss) : iff_2
pos = 0
iff_3 = srcUT[1] > nz(xATRTrailingStop[1], 0) and srcUT < nz(xATRTrailingStop[1], 0) ? -1 : nz(pos[1], 0)
pos := srcUT[1] < nz(xATRTrailingStop[1], 0) and srcUT > nz(xATRTrailingStop[1], 0) ? 1 : iff_3
xcolor = pos == -1 ? color.red : pos == 1 ? color.green : color.blue
// plot(xATRTrailingStop, color=xcolor, title='Trailing Stop')
buyUT = ta.crossover(srcUT, xATRTrailingStop)
sellUT = ta.crossunder(srcUT, xATRTrailingStop)
barcolor = srcUT > xATRTrailingStop
plotshape(buyUT, title='Buy', text='BOD', style=shape.labelup, location=location.belowbar, color=color.new(color.green, 0), textcolor=color.new(color.white, 0), size=size.tiny)
plotshape(sellUT, title='Sell', text='SOR', style=shape.labeldown, color=color.new(color.red, 0), textcolor=color.new(color.white, 0), size=size.tiny)
// srcUT
barcolor(barcolor ? color.green : color.red)
// alertcondition(buy, title='UT BOT Buy', message='UT BOT Buy')
// alertcondition(sell, title='UT BOT Sell', message='UT BOT Sell')
// Compose alert message
// Entry
alert_msg_long_entry =  
             "BUY 💚 NIFTY50 CE " + str.tostring(math.floor((close + 150)/100)*100)       + "\n"   + 
             "BUY Within 60 seconds at Current Market Price" + "\n"   +  
             "⏰💸⏰💸⏰💸⏰💸⏰💸\n\n" + 
             "{{strategy.order.id}}💹 Target 1: PAID "  + "\n"   +  
             "ENTRY PRICE: " + str.tostring(math.round(close))        + "\n"   +   
             "ITM NIFTY CE " + str.tostring(math.floor((close - 100)/100)*100)           
// Entry
alert_msg_short_entry =  
             "BUY 💚 NIFTY50 PE " + str.tostring(math.floor((close - 150)/100)*100)       + "\n"   + 
             "BUY Within 60 seconds at Current Market Price" + "\n"   +  
             "⏰💸⏰💸⏰💸⏰💸⏰💸\n\n" + 
             "{{strategy.order.id}}💹 Target 1: PAID "  + "\n"   +  
             "ENTRY PRICE: " + str.tostring(math.round(close))        + "\n"   +   
             "ITM NIFTY PE " + str.tostring(math.floor((close + 100)/100)*100)    
// EXIT
alert_msg_long_exit =  
             "🚨 EXIT NIFTY50 CE LONG POSITION  ! \n" +
             "EXIT PRICE: "                  + str.tostring(math.round(close))            + "\n"   + 
             "\n"   + 
             "For 💯% profitable 💰💰💰 exit BUY our COURSE \n" +
             "https://wa.me/917020641496?text=hi"
// EXIT
alert_msg_short_exit =  
             "🚨 EXIT NIFTY50 PE Short POSITION  ! \n" +
             "EXIT PRICE: "                  + str.tostring(math.round(close))            + "\n"   + 
             "\n"   + 
             "For 💯% profitable 💰💰💰 exit BUY our COURSE \n" +
             "https://wa.me/917020641496?text=hi"
bullrejection = close[1] - open[1]
bearrejection = open[1] - close[1]
//sideways = (Bahubali - lips) * (Bahubali - lips)plot(hist, title="Histogram", style=plot.style_columns, color=(hist > 0 ? ( bullishtrend ? green : Yellow ) : ( bearishtrend ? red : Yellow ) ))
bullishtrend = ((hist > 0)  and (close > lips ) and (open > lips )   and tyme  and (vwapValue < close) and upward and (high > teeth )  and (lips > jaw) and (bullrejection < 40) ) //and (bullbody < 40) and (sideways > 700) and (close > Bahubali) and (lips > jaw)
bearishtrend = ((hist < 0)  and (close < lips ) and (open < lips )   and tyme and (vwapValue > close) and downward and (high < teeth )  and (lips < jaw) and (bearrejection < 40)) // and (bearbody < 40) and (sideways > 700) and (close < Bahubali) and (lips < jaw)
//plot(hist, title="Histogram", style=plot.style_columns, color=(hist > 0 ? ( bullishtrend ? green : Yellow ) : ( bearishtrend ? red : Yellow ) ))
if strategy.position_size != 1
    strategy.entry("C_ENT", strategy.long, when = bullishtrend , alert_message = alert_msg_long_entry )
if strategy.position_size != -1
    strategy.entry("P_ENT",strategy.short,when = bearishtrend , alert_message = alert_msg_short_entry)
longexit = ((close < lips) and (hist < -1.4))  //or (close < Bahubali) or time("1440", "1515-1530")  and (vwapValue > close)
shortexit = ((close > lips) and (hist > 1.4)) //or (close > Bahubali) or time("1440", "1515-1530")  and (vwapValue < close)
//strategy.exit("long tsl", "long", trail_points = close * 0.01 / syminfo.mintick, trail_offset = close * 0.01 / syminfo.mintick)
//strategy.exit("shoty tsl", "short", trail_points = close * 0.01 / syminfo.mintick, trail_offset = close * 0.01 / syminfo.mintick)
strategy.exit("C_EX", "C_ENT", stop = vwapValue ,when = longexit, alert_message = alert_msg_long_exit) //limit = lips ,
strategy.exit("P_EX","P_ENT", stop = vwapValue , when = shortexit, alert_message = alert_msg_short_exit) //,limit = lips 
//PLOT FIXED SLTP LINE
// LONG POSITION
long_take_level_1 = strategy.position_avg_price + 30
//long_stop_level2 = strategy.position_avg_price - 40
long_stop_level = strategy.position_avg_price - 30
//long_take_level_2 = (close - lips) > 30 ? strategy.position_avg_price + 30 : strategy.position_avg_price + 45
//long_take_level_2 = high > shortStopatr
//long_stop_level2 = low < lips
plot(strategy.position_size > 0 ? long_take_level_1 : na, style=plot.style_linebr, color=color.blue, linewidth=2, title="1st Long Take Profit")
//plot(strategy.position_size > 0 ? long_take_level_2 : na, style=plot.style_linebr, color=color.black, transp = 60, linewidth=1, title="2nd Long Take Profit")
//plot(strategy.position_size > 0 ? long_stop_level : na, style=plot.style_linebr, color=color.red, linewidth=2, title="Long Stop Loss")
//plot(strategy.position_size > 0 ? long_stop_level2 : na, style=plot.style_linebr, color=color.red, transp = 60, linewidth=2, title="Long Stop Loss2")
//PLOT FIXED SLTP LINE
// SHORT POSITION
SHORT_take_level_1 = strategy.position_avg_price - 30
//SHORT_stop_level2 = strategy.position_avg_price + 45
SHORT_stop_level = strategy.position_avg_price + 30
//SHORT_take_level_2 = ( lips - close) < 30 ? strategy.position_avg_price - 30 : strategy.position_avg_price - 45
//SHORT_take_level_2 = low < longStopatr
//SHORT_stop_level2 = high > lips
plot(strategy.position_size < 0 ? SHORT_take_level_1 : na, style=plot.style_linebr, color=color.blue, linewidth=2, title="1st SHORT Take Profit")
//plot(strategy.position_size < 0 ? SHORT_take_level_2 : na, style=plot.style_linebr, color=color.black, transp = 60, linewidth=1, title="2nd SHORT Take Profit")
//plot(strategy.position_size < 0 ? SHORT_stop_level : na, style=plot.style_linebr, color=color.red, linewidth=2, title="SHORT Stop Loss")
//plot(strategy.position_size < 0 ? SHORT_stop_level2 : na, style=plot.style_linebr, color=color.red, transp = 60, linewidth=2, title="SHORT Stop Loss")
plot(strategy.position_size < 0 ? shortStopatr : na, color=color.new(#84f588, 28), style=plot.style_linebr, title='Long Trailing Stop')
plot(strategy.position_size > 0 ? longStopatr: na, color=color.new(#84f588, 28), style=plot.style_linebr, title='Short Trailing Stop')
// shortStopatr
///////////////////////////////////////////////////////////////
LT1 = (strategy.position_size > 0) and (high > long_take_level_1) and (open < long_take_level_1)
// LT1 = (strategy.position_size > 0) and (ta.crossover(close, long_take_level_1))
//LT1 = (strategy.position_size > 0) and long_take_level_2
LSL = (strategy.position_size > 0) and (close[1] < longStopatr[1]) and (close[1] < strategy.position_avg_price)
// LSL = (strategy.position_size > 0) and (ta.crossunder(close, long_stop_level))
//LSL = (strategy.position_size > 0) and long_stop_level2
ST1 = (strategy.position_size < 0) and (low < SHORT_take_level_1) and (open > SHORT_take_level_1)
// ST1 = (strategy.position_size < 0) and (ta.crossunder(close, SHORT_take_level_1))
//ST1 = (strategy.position_size < 0) and SHORT_take_level_2
SSL = (strategy.position_size < 0) and (close[1] > shortStopatr[1])  and (close[1] > strategy.position_avg_price)
// SSL = (strategy.position_size < 0) and (ta.crossover(close, SHORT_stop_level))
//SSL = (strategy.position_size < 0) and SHORT_stop_level2
//LT2 = (strategy.position_size > 0) and long_take_level_2
//LSL2 = (strategy.position_size > 0) and long_stop_level2
//ST2 = (strategy.position_size < 0) and SHORT_take_level_2
//SSL2 = (strategy.position_size < 0) and SHORT_stop_level2
if LT1
    alert(message= "NIFTY50 TARGET1 HIT !L! book profit now !!" , freq=alert.freq_once_per_bar)
if LSL
    alert(message= "NIFTY50 STOPLOSS HIT !L! Exit with loss !!" , freq=alert.freq_once_per_bar_close)
if SSL
    alert(message= "NIFTY50 STOPLOSS HIT !S! Exit with loss !! " , freq=alert.freq_once_per_bar)
if ST1
    alert(message= "NIFTY50 TARGET1 HIT !S! book profit now !!" , freq=alert.freq_once_per_bar_close)
//////
//if LT2
//    alert(message= "NIFTY TARGET2 HIT !L! book profit now !!" , freq=alert.freq_once_per_bar)
//if LSL2
//    alert(message= "NIFTY STOPLOSS2 HIT !L! Exit with loss !!" , freq=alert.freq_once_per_bar)
//if SSL2
//    alert(message= "NIFTY STOPLOSS2 HIT !S! Exit with loss !! " , freq=alert.freq_once_per_bar)
//if ST2
//    alert(message= "NIFTY TARGET2 HIT !S! book profit now !!" , freq=alert.freq_once_per_bar)
///////////////////ALERTCONDITION IS ABOVE/////////////////////////////////////
// This work is licensed under a Attribution-NonCommercial-ShareAlike 4.0 International (CC BY-NC-SA 4.0) https://creativecommons.org/licenses/by-nc-sa/4.0/
// © LuxAlgo
//@version=5
//indicator('The Echo Forecast [LUX]', 'ECHO [LuxAlgo]', overlay=true, max_bars_back=1000, max_lines_count=200)
//lengths = input.int(50, 'Evaluation Window', minval=0, maxval=200)
//fcast = input.int(50, 'Forecast Window', minval=1, maxval=200)
//fmode = input.string('Similarity', 'Forecast Mode', options=['Similarity', 'Dissimilarity'])
//cmode = input.string('Cumulative', 'Forecast Construction', options=['Cumulative', 'Mean', 'Linreg'])
//srcf = input(close)
//fcast_col = input.color(#2157f3, 'Forecast Style', inline='fcast_style', group='Style')
//fcast_style = input.string('· · ·', '', options=['──', '- - -', '· · ·'], inline='fcast_style', group='Style')
//show_area = input.bool(true, 'Show Area', inline='areas', group='Style')
//fcast_area = input.color(color.new(#ffffff, 95), '', inline='areas', group='Style')
//corr_area = input.color(color.new(#ffffff, 95), '', inline='areas', group='Style')
//eval_area = input.color(color.new(#ffffff, 95), '', inline='areas', group='Style')
//----
//var lines = array.new_line(0)
//if barstate.isfirst
 //   for i = 0 to fcast - 1 by 1
 //       array.push(lines, line.new(na, na, na, na))
//----
//n = bar_index
//d = ta.change(srcf)
//top = ta.highest(srcf, lengths + fcast * 2)
//btm = ta.lowest(srcf, lengths + fcast * 2)
//if barstate.islast
//    float val = na
//    k = 0
//    A = array.new_float(0)
//    X = array.new_int(0)
//    for i = 0 to fcast * 2 + lengths by 1
//        array.push(A, srcf[i])
//        if cmode == 'Linreg'
//            array.push(X, n[i])
//    a = array.slice(A, 0, fcast - 1)
//    for i = 0 to lengths - 1 by 1
//        b = array.slice(A, fcast + i, fcast * 2 + i - 1)
//        r = array.covariance(a, b) / (array.stdev(a) * array.stdev(b))
//        if fmode == 'Similarity'
//            val := r >= nz(val, r) ? r : val
//            val
//        else
//            val := r <= nz(val, r) ? r : val
//            val
//        k := val == r ? i : k
//        k
//    prev = srcf
//    current = srcf
//    for i = 0 to fcast - 1 by 1
//        e = d[fcast + k + fcast - i - 1]
//        if cmode == 'Mean'
//            current := array.avg(a) + e
//            current
//        else if cmode == 'Linreg'
//            a = array.slice(A, 0, fcast)
//            x = array.slice(X, 0, fcast)
//            alpha = array.covariance(a, x) / array.variance(x)
//            beta = array.avg(a) - alpha * array.avg(x)
//            current := alpha * (n + i + 1) + beta + e
//            current
//        else
//            current += e
//            current
//
//        l = array.get(lines, i)
//        line.set_xy1(l, n + i, prev)
//        line.set_xy2(l, n + i + 1, current)
//        line.set_color(l, fcast_col)
//        if fcast_style == '- - -'
//            line.set_style(l, line.style_dashed)
//        else if fcast_style == '· · ·'
//            line.set_style(l, line.style_dotted)
//        prev := current
//        prev
//
//    if show_area
//        box.delete(box.new(n - lengths - fcast * 2 + 1, top, n - fcast + 1, btm, border_color=na, bgcolor=eval_area)[1])
//        box.delete(box.new(n - fcast + 1, top, n, btm, border_color=na, bgcolor=fcast_area)[1])
//        box.delete(box.new(n - k - fcast * 2 + 1, btm, n - k - fcast, top, border_color=na, bgcolor=corr_area)[1])
Expand (432 lines)

Overview

5msm VISHNU calculates a MACD-style oscillator from fast and slow moving averages with a signal line, a 200-period exponential moving average, and Williams Alligator smoothed averages for the jaw, teeth, and lips. It also builds a volume-weighted average price with a selectable anchor and an optional daily hide setting. ATR length, lookback, multiplier, and trailing-stop type inputs are present, but the shown code does not define entry or exit orders.

Details

Published by

hasnocool on GitHub

Type

Strategy, Pine Script v5

Draws

On the price chart

Category

Trend, Oscillators & momentum, Moving averages, Volatility & bands

Markets

Any symbol

Timeframes

Any timeframe

Risk Notes

No repainting, lookahead or stacked entries were found in its code or README. That says nothing about how well it works: test it first.

Topics

analysisbtcusdtcryptocurrencydatapandaspythonsimulationtradingtradingview

Settings

The inputs you can change from the gear icon on the chart. Defaults are the author's.

SettingTypeDefaultVariable
Fast Lengthint12fast_length
Slow Lengthint26slow_length
Sourcesourceclosesrc3
Signal Smoothingint9signal_length
Oscillator MA TypestringEMAsma_source
Signal Line MA TypestringEMAsma_signal
Lengthint200len
Sourcesourceclosesrc2
Jaw Lengthint13jawLength
Teeth Lengthint8teethLength
Lips Lengthint5lipsLength
Jaw Offsetint8jawOffset
Show all 30 settings
SettingTypeDefaultVariable
Teeth Offsetint5teethOffset
Lips Offsetint3lipsOffset
Hide VWAP on 1D or AboveboolfalsehideonDWM
Anchor PeriodstringSessionanchor
Sourcesourcehlc3src9
Offsetint0offsetvwap
ATR Lengthint14atrLength
Bars To Look Back For Highs/Lowsint7lookback
ATR Multiplierfloat1.0multiplier
Trailing Stop TypestringOpentrailType
Show ATR?booltrueshowATR
ATR Colorcolorcolor.new(color.blue, 100)atrColor
Sourcesourceclosesources
Use HA CandlesboolfalseisHA
Sampling Periodint50per
Range Multiplierfloat3.0mult
Key Vaule. 'This changes the sensitivity'float3keyvalue
ATR Periodint10atrperiod
Third-party code. ForexR did not write, test or endorse this script, and the summary above was generated automatically from its code and README. Indicators describe the past, and a strategy's backtest can look better than live trading, especially when a script repaints. Check it in the Strategy Tester and on a demo account before you rely on it.

Similar Pine Scripts

Momentum Rider DAILY FINAL

by greenpeas007
58 stars

This strategy combines exponential moving averages (EMA 9, 21, 50), RSI, MACD, and Supertrend indicators to enter long positions. It triggers trades using six dynamic setups based on momentum breakouts, EMA crossovers, and pullbacks. Position sizing is compute

Strategy v6 TrendOscillators & momentum Repaints
Updated 4 months ago · Custom licence GitHub repository of Momentum Rider DAILY FINAL

CombinedBinHAndClucV6

by viktors1982
36 stars

CombinedBinHAndClucV6 is a trading strategy based on the popular BinHV45 and ClucMay72018 algorithms. It calculates dual Bollinger Bands, Exponential Moving Averages, Relative Strength Index, Average True Range, and volume metrics across primary and one-hour h

Strategy v4 Volatility & bandsOscillators & momentum Repaints
Updated 2 years ago · None stated GitHub repository of CombinedBinHAndClucV6

BB Swing

by benso87
24 stars

This strategy calculates Bollinger Bands, a configurable moving average slope, Stochastic RSI, ATR, and ADX directly on the price chart. It evaluates trend bias and momentum conditions to generate long and short swing entries using percent-of-equity sizing. Th

Strategy v5 Volatility & bandsOscillators & momentum
Updated 4 years ago · MPL-2.0 GitHub repository of BB Swing

This strategy trades long and short on the price chart using a multi-timeframe TradingLatino setup. It requires EMA 10 to cross or sit above or below EMA 55 on the one-hour, four-hour, and daily charts, together with a positive ADX slope, a directional monitor

Strategy v5 TrendMoving averages
Updated 1 year ago · None stated GitHub repository of Ruckard ABCBitcoin TradingLatino A010

More strategys

Trade Your Charts With a Regulated Broker

Compare brokers that connect to TradingView, with spreads, minimum deposits and leverage side by side.

Compare brokers