Vortex Trend Tracker - PINE to LUA

If you need an Indicator or Signal developed or translated from other language, please post all Indicator development REQUESTS to this section here.

Moderator: admin

Vortex Trend Tracker - PINE to LUA

Postby FabioE » Wed Jan 12, 2022 12:31 pm

Hello Team,
I wonder if it would be possible to convert the Pinescript code here below to LUA.
I'm backtesting this indicator and apparently it would have kept me out of several bad trades, so I want to do some forward testing on FXCM Tradestation :)

Thanks in advance!

//@version=4
study("Vortex Trend Tracker")
// INPUT VARIABLES FOR VORTEX:
vortexLen = input(30, title="Length for Vortex", minval=1)
emaLen = input(10, title="Length of Positive and Negative EMA's", type=input.integer, minval=1)
colorBars = input(true, title="Color Price Bars Based on Vortex?")
plotVLines = input(false, title="Plot VI+ and VI- Lines?")

// VORTEX CALCULATION:
//Returns positive and negative trendlines.
vortex(posSum, negSum, vLen)=>
tRange = sum(atr(1), vLen)
vmPlus = posSum / tRange
vmNeg = negSum / tRange
[vmPlus, vmNeg]

[vPlus, vNeg] = vortex(sum(abs(high - low[1]), vortexLen), sum(abs(low - high[1]), vortexLen), vortexLen)
plusEMA = ema(vPlus, emaLen)
negEMA = ema(vNeg, emaLen)
vDiff = abs(plusEMA - negEMA)

// PLOTTING:
var color vColor = na
vColor := plusEMA > negEMA and plusEMA >= plusEMA[1] ? #1b5e20 : plusEMA > negEMA and plusEMA < plusEMA[1] ? #a5d6a7 : negEMA >= plusEMA and negEMA > negEMA[1] ? #b71c1c : negEMA > plusEMA and negEMA < negEMA[1] ? #c76a72 : nz(vColor[1])
plot(vDiff, style=plot.style_histogram, color=vColor, linewidth=3, transp=0)
plot(plotVLines ? plusEMA : na, title="VI +", color=color.green, linewidth=2)
plot(plotVLines ? negEMA : na, title="VI -", color=color.red, linewidth=2)
barcolor(colorBars ? vColor : na)
FabioE
 
Posts: 11
Joined: Mon Nov 29, 2021 1:15 pm

Re: Vortex Trend Tracker - PINE to LUA

Postby Apprentice » Fri Jan 14, 2022 7:09 am

Your request is added to the development list.
Development reference 34.
User avatar
Apprentice
FXCodeBase: Confirmed User
 
Posts: 36435
Joined: Thu Dec 31, 2009 11:59 am
Location: Zagreb, Croatia


Re: Vortex Trend Tracker - PINE to LUA

Postby FabioE » Fri Jan 14, 2022 10:43 am

Thanks so much, I will try it during the next days :)
FabioE
 
Posts: 11
Joined: Mon Nov 29, 2021 1:15 pm


Return to Indicator and Signal Requests

Who is online

Users browsing this forum: Google [Bot] and 16 guests