Tradingview Convert Tradingview VWAP + Fibo Dev Extensions Strategy

Tradingview

OGK

New member
found this trading strategy pine code on tradinview. can this be coded for TOS?
https://fr.tradingview.com/script/EaBACrDi/

it allows for a various resolutions so you can set it on a 1 min chart with a 1 week resolution, so as you change your chart time frame the indicator stays put on the chart and does not rearrange unless you change it in the settings.
any help would be appreciated.
thanks

here is an example of TSLA as you can see the indicator stays put for each week and also you can see how price reacts with it. below is 3 weeks and 2 days worth of view with one week resolution on the indicator.

mO0Edwuv

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

//@version=4
strategy(title="VWAP + Fibo Dev Extensions Strategy", overlay=true, pyramiding=5, commission_value=0.08)

// -------------------------------------
// ------- Inputs Fibos Values ---------
// -------------------------------------

fib1 = input(title="Fibo extension 1", type=input.float, defval=1.618)
fib2 = input(title="Fibo extension 2", type=input.float, defval=2.618)
reso = input(title="Resolution VWAP", type=input.resolution, defval="W")
dev = input(title="Deviation value min.", type=input.integer, defval=150)


// -------------------------------------
// -------- VWAP Calculations ----------
// -------------------------------------

t = time(reso)
debut = na(t[1]) or t > t[1]

addsource = hlc3 * volume
addvol = volume
addsource := debut ? addsource : addsource + addsource[1]
addvol := debut ? addvol : addvol + addvol[1]
VWAP = addsource / addvol

sn = 0.0
sn := debut ? sn : sn[1] + volume * (hlc3 - VWAP[1]) * (hlc3 - VWAP)
sd = sqrt(sn / addvol)

Fibp2 = VWAP + fib2 * sd
Fibp1 = VWAP + fib1 * sd
Fibm1 = VWAP - fib1 * sd
Fibm2 = VWAP - fib2 * sd


// -------------------------------------
// -------------- Plots ----------------
// -------------------------------------

plot(VWAP, title="VWAP", color=color.orange)
pFibp2 = plot(Fibp2, color=color.red)
pFibp1 = plot(Fibp1, color=color.red)
pFibm1 = plot(Fibm1, color=color.lime)
pFibm2 = plot(Fibm2, color=color.lime)

fill(pFibp2,pFibp1, color.red)
fill(pFibm2,pFibm1, color.lime)


// -------------------------------------
// ------------ Positions --------------
// -------------------------------------

bull = crossunder(low[1],Fibm1[1]) and low[1]>=Fibm2[1] and low>Fibm2 and low<Fibm1 and sd>dev
bear = crossover(high[1],Fibp1[1]) and high[1]<=Fibp2[1] and high<Fibp2 and high>Fibp1 and sd>dev

//plotshape(bear, title='Bear', style=shape.triangledown, location=location.abovebar, color=color.red, offset=0)
//plotshape(bull, title='Bull', style=shape.triangleup, location=location.belowbar, color=color.green, offset=0)


// -------------------------------------
// --------- Strategy Orders -----------
// -------------------------------------

strategy.entry("Long", true, when = bull)
strategy.close("Long", when = crossover(high,VWAP) or crossunder(low,Fibm2))

strategy.entry("Short", false, when = bear)
strategy.close("Short", when = crossunder(low,VWAP) or crossover(high,Fibp2))
 
Last edited by a moderator:

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.
Top