Conversion of SuperTrendVolatility Indicator from TradingView
Forums › ProRealTime English forum › ProBuilder support › Conversion of SuperTrendVolatility Indicator from TradingView
- This topic has 26 replies, 4 voices, and was last updated 2 years ago by Nicolas.
-
-
05/18/2022 at 4:33 PM #19339205/18/2022 at 4:48 PM #193400
Hi Nicolas, so I use it on dax daily, nasdaq daily and 4 hours, crude oil 4 hours and daily, it doesn’t work anywhere; the units are 10000; however I noticed that when I download the prc_supertrendvolatility it appears with -1 instead of -2 as it is reported on the link … maybe the correct file has not been loaded?
05/18/2022 at 4:59 PM #19340405/18/2022 at 5:02 PM #193405Yes, because there are no volumes far back in history (which are needed for the correct calculation of the indicator), so limit the units displayed and add Volume indicator on the chart to be sure volumes are present.
1 user thanked author for this post.
05/18/2022 at 5:09 PM #19340805/21/2022 at 4:54 AM #193552Hi Nicolas,
Thanks so much for your great help on conversion!
May I ask you for further favor? Can you show me how to translate this indicator to a screener to indicate which stock fulfill the BUY/SELL signal?i.e. based on the following part of the original script
long = trend == 1 and trend[1] == -1
short = trend == -1 and trend[1] == 1
//
last_long = 0.0
last_short = 0.0
last_long := long ? time : nz(last_long[1])
last_short := short ? time : nz(last_short[1])buy = crossover(last_long, last_short)
sell = crossover(last_short, last_long)05/23/2022 at 12:24 PM #193714Here is the screener version of that indicator:
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100//PRC_SuperTrend Volatility | screener//Nicolas @ www.prorealcode.com// --- settingsstmult = 2 //Trend Multiplier minval = 0, maxval = 100, step = 0.01stperiod = 10 //Trend Periodfactor = 0.5 //Volatility Factor minval=0.1, maxval=5// --- end of settingsif barindex>28 thenhilow = max(pointsize,((high - low)*100))openclose = ((close - open)*100)if volume<>volume[1] thenif close>close[1] thenmyobv=myobv+volumeelsif close<close[1] thenmyobv=myobv-volumeendifendifvol = (myobv / hilow)spreadvol = (openclose * vol)//VPT = spreadvol + cumsum(spreadvol)windowlen = 28vlen = 14pricespread = std[windowlen](range)vx = spreadvol + cumsum(spreadvol)smooth = average[vlen,1](vx)vspread = std[windowlen](vx - smooth)shadow = (vx - smooth) / vspread * pricespreadif shadow > 0 thenout = high + shadowelseout = low + shadowendif// CALCULATIONS //uplev =out - (stmult * averagetruerange[stperiod])dnlev = out + (stmult * averagetruerange[stperiod])//iVolatility = 100 * summation[1](100 * averagetruerange[1] / low) / 100perc = (iVolatility*0.01) *factorc=barindexn = dnlevx =uplevonce lb = nonce hb = xonce l1 = outonce hl = outif c = 0 thenif x >= hb[1] thenhb = xhl = outtrend = 1elselb = nl1 = outtrend = -1endifendifif c > 1 thenif trend[1] > 0 thenhl = max(hl[1], out)if x >= hb[1] thenhb = xelseif n < hb[1] - hb[1] * perc thenlb = nl1 = outtrend = -1endifendifelsel1 = min(l1[1], out )if n <= lb[1] thenlb = nelseif x > lb[1] + lb[1] * perc thenhb = xhl = outtrend = 1endifendifendifendifendifscreener[trend<>trend[1]]06/25/2022 at 11:41 AM #196078Hi Nicholas,
I try the screener version of SuperTrendVolatility SCREENER as provided by your last posted.
I encountered 2 issues:
- The screener always return NO RESULT. However, when I try to comment out the condition “if barindex>28 then …“, there is result. Can you enlight me? Is this condition need for screener?
- After commented out the barindex condition, I try to further analyze the result by try scanning out the stock with trend = -1 with the clause “SCREENER[trend = -1]“. There is result available. However, when I try to further analyze the result by try scanning out the stock with trend = 1, there is NO result available. I have ensure there is stock has trend = 1 by finding one stock manually, putting it in my personal list, and use the screener with clause “SCREENER[trend = 1]“, but no result is available. See attached for the stock chart with SuperTrendVolatility trend captured. Any idea?
Appreciate your professional input!
Mike
07/02/2022 at 7:51 AM #196597Hi Nicolas,
do you have any idea of my queues on 25/Jun as recapped below, many thanks!
I try the screener version of SuperTrendVolatility SCREENER as provided by your last posted.
I encountered 2 issues:
- The screener always return NO RESULT. However, when I try to comment out the condition “if barindex>28 then …“, there is result. Can you enlight me? Is this condition need for screener?
- After commented out the barindexcondition, I try to further analyze the result by try scanning out the stock with trend = -1 with the clause “SCREENER[trend = -1]“. There is result available. However, when I try to further analyze the result by try scanning out the stock with trend = 1, there is NO result available. I have ensure there is stock has trend = 1 by finding one stock manually, putting it in my personal list, and use the screener with clause “SCREENER[trend = 1]“, but no result is available. See attached for the stock chart with SuperTrendVolatility trend captured. Any idea?
07/02/2022 at 10:13 AM #1966041/ not needed
2/ I think the problem could come from the vx variable which is cumulating values from the beginning of history, and since ProScreener doesnt share the same bars history as the one displayed on the charts (way less bars..), then the cumulation is different and the calculation of the indicator is different, therefore different results..
This is the simplier explanation I have right now without much investigation.
07/02/2022 at 11:06 AM #196611Hi Nicolas,
thanks so much for your speedy reply! Any suggestion to resolve the issue #2 so that the screener can work? Or under current ProRealCode capability it is infeasible?
Mike
07/04/2022 at 10:46 AM #196718 -
AuthorPosts
Find exclusive trading pro-tools on