Help porting Volume Impact indicator to ToS

Risto Benji

New member
Hey guys, not new to the site but just registered. This site has been a great resource as I have been lurking, much thanks to those who contribute to its success. As the title suggests, I'm wondering if anyone with knowledge of Tradingview code can port this indicator...... Thanks in advance.

Code:
//Written by Umur Ozkul
//@version=3
study(title="Volume Impact", shorttitle="UO_VI")
TrigLen = input(7, minval=1)
FastX = input(34, minval=1)
SlowX = input(55, minval=1)
hline(0, color=gray, linestyle=line)
xTrend = iff(hlc3 > hlc3[1], volume * 100, -volume * 100)
xFast = ema(xTrend, FastX)
xSlow = ema(xTrend, SlowX)
xKVO = xFast - xSlow
xTrigger = ema(xKVO, TrigLen)

p = close - close[1]
pTrigger = ema(p, TrigLen)

volumeImpact = (xKVO - xTrigger)*1.2

buyColor=green
sellColor=red

xDirection = xTrigger - xTrigger[1]
pDirection = pTrigger - pTrigger[1]

buyit=1
sellit=-1
donothing=0

suggestion = (volumeImpact - volumeImpact[1]) > 0 ? buyit : sellit

paint=suggestion
impactColor= paint==buyit ? green : paint==sellit ? red : gray
plot(volumeImpact, color=impactColor, style=area, title="KVO")

triggerColor = xTrigger>=0 ? green : red
plot(xTrigger, linewidth=4, color=triggerColor, title="Trigger")

//barColor
//triggerColor
kvoColor = xKVO >= 0 ? green : red
impactFlipColor = volumeImpact >= 0 ? green : red

plot(xKVO, title="KVO")
priceColorOpt = input(title="Bar Color", defval="Impact>0", options=["Default", "KVO,Impact Direction", "Impact>0", "Trigger>0", "KVO>0"])
priceColor0 = priceColorOpt == "Default" ? na : priceColorOpt == "KVO,Impact Direction" ? impactColor :  priceColorOpt=="Impact>0"? impactFlipColor : priceColorOpt == "Trigger>0" ? triggerColor : kvoColor
priceColor = priceColor0 == green ? lime : orange
//priceColor = close > open and priceColor0 == green or close < open and priceColor0 == red ? priceColor1 : na

barcolor(priceColor)

Link to the indicator details
 
Last edited by a moderator:

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

@Risto Benji @JohnsonM Rough conversion but should be the same as the one from TradingView.

Code:
# Volume Impact
# Assembled by BenTen at useThinkScript.com
# Converted from https://www.tradingview.com/script/CBUdx2Wo-Volume-Impact/

declare lower;

input TrigLen = 7;
input FastX = 34;
input SlowX = 55;

def xTrend = if(hlc3 > hlc3[1], volume* 100, -volume* 100);
def xFast = expAverage(xTrend, FastX);
def xSlow = expAverage(xTrend, SlowX);
def xKVO = xFast - xSlow;
def xTrigger = expAverage(xKVO, TrigLen);

def p = close - close[1];
def pTrigger = expAverage(p, TrigLen);

def volumeImpact = (xKVO - xTrigger) * 1.2;

def xDirection = xTrigger - xTrigger[1];
def pDirection = pTrigger - pTrigger[1];

def buyit = 1;
def sellit = -1;

def suggestion = if (volumeImpact - volumeImpact[1]) > 0 then buyit else sellit;

def paint = suggestion;

plot KVO = volumeImpact;
KVO.SetPaintingStrategy(PaintingStrategy.HISTOGRAM);
KVO.AssignValueColor(if paint == buyit then color.green else if paint == sellit then color.red else color.gray);
plot Trigger = xTrigger;
Trigger.AssignValueColor(if xTrigger>=0 then color.green else color.red);
plot c = xKVO;
c.AssignValueColor(color.CYAN);
 
Looks interesting. Can this study be modified so that it only shows the buy/sell signals as arrows on the chart instead of using the lower study? @BenTen
 

Similar threads

Not the exact question you're looking for?

Start a new thread and receive assistance from our community.

87k+ Posts
357 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