Trend Signal conversion from TradingView
Forums › ProRealTime English forum › ProBuilder support › Trend Signal conversion from TradingView
- This topic has 3 replies, 2 voices, and was last updated 5 years ago by Nicolas.
-
-
09/02/2019 at 10:23 PM #106287
https://www.tradingview.com/script/WVFF2bZZ-4X-Global-Trend-Signal/
An interesting indicator, based upon cross of simulated obliques trendlines to provide entry signals.
Hope Nicolas could use his magic once again…
description from its author:
When all of the sources confirm a trend (based on my criteria), the indicator draws a ‘buy’ or ‘sell’ label on the chart. This is a very simple indicator to use and it’s darn accurate. I may automate it at some point.
This indicator does NOT repaint, but it will flash on/off during the current bar until it closes. Do NOT enter a trade until the current bar closes with a signal. You enter at the open of the succeeding candle (i.e. the candle immediately after the signal candle).
There is only one variable to adjust; ‘Risk’. When you increase the Risk variable, you are increasing your trading risk because the indicator will not respond as fast. However, I have found that higher settings filter out the noise better.
For me, the sweet spot seems to be on the 30 minute chart with a Risk value of ’24’. If you find additional ‘sweet spots’ for this indicator
original code123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104//@version=2study("Trend Signal", overlay=true)RISK= input(title="RISK", type=integer, defval=14)value10=3+RISK*2value11=value10x1=67+RISKx2=33-RISKrange(length) =>sum = 0for i = 1 to length-1sum := sum + abs(high[i]-low[i])sum / lengthMRO1(length, range) =>true_count = 0counter = 0for i = 1 to length-1x = if abs(open[i]-close[i+1]) >= range*2.0true_count := true_count + 1counter = ibreakmro = if true_count >= 1counterelse-1mroMRO2(length, range) =>true_count = 0counter = 0for i = 1 to length-1x = if abs(close[i+3]-close[i]) >= range*4.6true_count := true_count + 1counter = ibreakmro = if true_count >= 1counterelse-1mrowpr(length) =>upper = highest(length)lower = lowest(length)out = 100 * (close - upper) / (upper - lower)outrng = range(10)mro1=MRO1(10,rng)mro2=MRO2(7,rng)rez = if mro1>-13elsevalue10value11:=rezrez1 = if mro2>-14elsevalue10value11:=rez1value2 = 100-abs(wpr(value10))Table_value2=value2notset=falseii1 = 1for i1 = 1 to 300if ((Table_value2[i1] < x2 or Table_value2[i1] > x1) and notset==false)notset:=trueii1 := i1z=Table_value2[ii1]up = if value2 < x2if Table_value2[ii1] > x1ii1else0else0plotshape(up, style=shape.labeldown, location=location.abovebar, size=size.normal, color=aqua, text="Sell")dn = if value2 > x1if Table_value2[ii1] < x2ii1else0else0plotshape(dn, style=shape.labelup, location=location.belowbar, size=size.normal, color=aqua, text="Buy")//plotshape(Table_value2, style=shape.arrowdown, location=location.bottom, color=white)//plotshape(ii1, style=shape.arrowdown, location=location.bottom, color=white)//plotshape(x1, style=shape.arrowdown, location=location.bottom, color=white)//plotshape(x2, style=shape.arrowdown, location=location.bottom, color=white)//plotshape(value11, style=shape.arrowdown, location=location.bottom, color=white)//plotshape(z, style=shape.arrowdown, location=location.bottom, color=white)09/03/2019 at 10:01 AM #10633209/03/2019 at 11:09 AM #10635009/03/2019 at 11:51 AM #106356What a mess this code is! most of the code isn’t useful.. and the other part is full of bugs :/ (that I fixed).. Anyway here is the translation:
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107RISK= 14//value10=3+RISK*2//value11=value10x1=67+RISKx2=33-RISK//range functionrnglength = 10rngsum=summation[rnglength](abs(high-low))irange=rngsum / rnglength//MRO1 functiontruecount = 0counter = 0length=10for i = 1 to length-1 doif abs(open[i]-close[i+1]) >= irange*2.0 thentruecount = truecount + 1counter = ibreakendifnextif truecount >= 1 thenmro1=counterelsemro1=-1endif//MRO2 functiontruecount = 0counter = 0length=7for i = 1 to length-1 doif abs(close[i+3]-close[i]) >= irange*4.6 thentruecount = truecount + 1counter = ibreakendifnextif truecount >= 1 thenmro2=counterelsemro2=-1endifwpr = Williams[10](close)if mro1>-1 then//rez=3else//rez=value10endif//value11=rezif mro2>-1 then//rez1=4else//rez1=value10endif//value11=rez1value2 = 100-abs(wpr)Tablevalue2=value2notset=0//falseii1 = 1for i1 = 1 to 300 doif ((Tablevalue2[i1] < x2 or Tablevalue2[i1] > x1) and notset=0) thennotset=1//trueii1 = i1breakendifnext//z=Tablevalue2[ii1]if value2 < x2 thenif Tablevalue2[ii1] > x1 thenup = ii1elseup =0endifelseup=0endifatr=AverageTrueRange[14](close)if up thendrawarrowdown(barindex[ii1],high[ii1]+atr) coloured(255,0,0)//drawtext("#ii1#",barindex[ii1],high[ii1],dialog,standard,20)endifif value2 > x1 thenif Tablevalue2[ii1] < x2 thendn=ii1elsedn=0endifelsedn=0endifif dn thendrawarrowup(barindex[ii1],low[ii1]-atr) coloured(0,255,0)endifreturn1 user thanked author for this post.
-
AuthorPosts
Find exclusive trading pro-tools on