Better X Trend Indicator NT 7/8 conversion to Prorealtime
Forums › ProRealTime English forum › ProBuilder support › Better X Trend Indicator NT 7/8 conversion to Prorealtime
- This topic has 18 replies, 4 voices, and was last updated 3 years ago by robertogozzi.
-
-
09/16/2021 at 7:57 PM #177746
There it is !
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129//@version=3study(title="Better X-Trend / Volume",shorttitle="BXT/BV", overlay=true)//Better Volume Indicator no tickvolume//Better Volume Indicator//http://emini-watch.com/the-better-x-trend-indicator/4408///http://emini-watch.com/free-stuff/volume-indicator/enablebarcolors=input(false,title="Enable bar colors")enablebaricons=input(true,title="Enable bar icons")enabletrainline=input(false,title="Enable bar Trainline")lowvol=input(true,title="show low volume")climaxup=input(false,title="show climax up")climaxdown=input(false,title="show climax down")churn=input(true,title="show churn")climaxchurn=input(false,title="show climax churn")use2bars=input(true,title="use 2 bars")lookback=input(20, type=integer, minval=1, maxval=100,title="look back bars")range = high-low+0.000000001 // this way avoiding zero in the denominatorsrange2= (highest(high,2)-lowest(low,2))+0.000000001value1=navalue1:= close > open and range != 0 ? (range/(2*range+open-close))*volume : value1value1:= close < open and range != 0 ? ((range+close-open)/(2*range+close-open))*volume: value1value1:= close == open ? 0.5*volume:value1 //value1 is up volumevalue2 = volume-value1 //value2 is down volume//using only one barvalue3 = abs(value1+value2)value4 = value1*rangevalue5 = (value1-value2)*rangevalue6 = value2*rangevalue7 = (value2-value1)*rangevalue8 = value1/rangevalue9 = (value1-value2)/rangevalue10 = value2/rangevalue11 = (value2-value1)/rangevalue12 = value3/range// Using two barsvalue13 = use2bars?( value3+value3[1]):navalue14 = use2bars?(value1+value1[1])*range2:navalue15 = use2bars?(value1+value1[1]-value2-value2[1])*range2:navalue16 = use2bars?(value2+value2[1])*range2:navalue17 = use2bars?(value2+value2[1]-value1-value1[1])*range2:navalue18 = use2bars ? (value1+value1[1])/range2:navalue19 = use2bars ? (value1+value1[1]-value2-value2[1])/range2:navalue20 = use2bars ? (value2+value2[1])/range2:navalue21 = use2bars ? (value2+value2[1]-value1-value1[1])/range2:navalue22 = use2bars ? value13/range2:na// one bar conditionscondition1 = value3 == lowest(value3,lookback)condition2 = value4 == highest(value4,lookback) and close > opencondition3 = value5 == highest(value5,lookback) and close > opencondition4 = value6 == highest(value6,lookback) and close < opencondition5 = value7 == highest(value7,lookback) and close < opencondition6 = value8 == lowest(value8,lookback) and close < opencondition7 = value9 == lowest(value9,lookback) and close < opencondition8 = value10 == lowest(value10,lookback) and close > opencondition9 = value11 == lowest(value11,lookback) and close > opencondition10 = value12 == highest(value12,lookback)// two bar conditionscondition11 = use2bars and value13 == lowest(value13,lookback)condition12 = use2bars and value14 == highest(value14,lookback) and close > open and close[1] > open[1]condition13 = use2bars and value15 == highest(value15,lookback) and close > open and close[1] > open[1]condition14 = use2bars and value16 == highest(value16,lookback) and close < open and close[1] < open[1]condition15 = use2bars and value17 == highest(value17,lookback) and close < open and close[1] < open[1]condition16 = use2bars and value18 == lowest(value18,lookback) and close < open and close[1] < open[1]condition17 = use2bars and value19 == lowest(value19,lookback) and close < open and close[1] < open[1]condition18 = use2bars and value20 == lowest(value20,lookback) and close > open and close[1] > open[1]condition19 = use2bars and value21 == lowest(value21,lookback) and close > open and close[1] > open[1]condition20 = use2bars and value22 == highest(value22,lookback)//Classifying the bars using one bar conditions, or using both one bar and two bar conditions simultaneosly if "use2bars" button selected.lowvolume = (condition1 or condition11)climaxupvolume = (condition2 or condition3 or condition8 or condition9 or condition12 or condition13 or condition18 or condition19)climaxdownvolume = (condition4 or condition5 or condition6 or condition7 or condition14 or condition15 or condition16 or condition17)churnvolume = (condition10 or condition20)climaxchurnvolume = (condition10 or condition20) and (condition2 or condition3 or condition4 or condition5 or condition6 or condition7 or condition8 or condition9 or condition12 or condition13 or condition14 or condition15 or condition16 or condition17 or condition18 or condition19)val=climaxchurn and climaxchurnvolume? 1 : lowvol and lowvolume? 2:climaxup and climaxupvolume?3:climaxdown and climaxdownvolume?4:churn and churnvolume?5:6bcolor=climaxchurn and climaxchurnvolume? purple : lowvol and lowvolume? orange:climaxup and climaxupvolume?red:climaxdown and climaxdownvolume?black:churn and churnvolume?blue:greenplotshape(enablebaricons==true and val==1 ? 1:na,location=location.abovebar, title="Climax Churn", style=shape.diamond, color=purple)plotshape(enablebaricons==true and val==2 ? 1:na,location=location.belowbar, title="Low Volume", style=shape.circle, color=orange)plotshape(enablebaricons==true and val==3 ? 1:na,location=location.belowbar, title="Climax Up volume", style=shape.triangleup, color=red)plotshape(enablebaricons==true and val==4 ? 1:na,location=location.abovebar, title="Climax Down volume", style=shape.triangledown, color=black)plotshape(enablebaricons==true and val==5 ? 1:na,location=location.abovebar, title="Churn", style=shape.square, color=blue)barcolor(enablebarcolors ? bcolor : na)trend=1supplyline=highsupportline=lowtrend:=barstate.isfirst?1:close>nz(supplyline[1])?1:close<nz(supportline[1])?-1:nz(trend[1])supplyline:= trend==1?climaxdownvolume?highest(2):high>supplyline[1]?high:supplyline[1]:climaxdownvolume?highest(2):supplyline[1]supportline:= trend==-1?climaxupvolume?lowest(2):low<supportline[1]?low:supportline[1]:climaxupvolume?lowest(2):supportline[1]trailing=trend==1?supportline:supplylineplot(enabletrainline?trailing:na,title="trailline",color=trend==1?red:black,linewidth=1,transp=60)09/17/2021 at 2:20 PM #177810Now the real problem begins. I don’t know how to post. First time.
I had some troubles in colouring the trail, so I made a colorzone instead.Better-X-Trend123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271// Better Volume Indicator// Original idea by emini-watch.com// Source : http://emini-watch.com/free-stuff/volume-indicator/ AND http://emini-watch.com/category/volume-indicator///// Rewrite for ProRealTime / ChartNet / CMC by Dutchy, march 2009// Code is provided as public domain, no warranty.// You can find Dutchy on following fora// http://www.aktienboard.com/forum/f29/prorealtime-cmc-script-programmierung-t94783/// http://www.pro-at.com/forums-bourse/sujet-Forums-Partenaires-Forum-ProRealTime-92.html// Peace//// Better Volume Indicator - Summary// ClimaxUp (Red) : Top, Start Up Trend, Down Trend Continue// ClimaxDown (White): Bottom, Up Trend Continue, Start Down Trend// LowVolume (Yellow): Bottom, Top, Up Trend Continue// Churn (Green): Bottom, Top, Down Trend Continue// ClimaxChurn (Magenta): Top, Down Trend Continue// Parameter: History = Boolean// Parameter: Use2Bars = Boolean// Parameter: Lookback = 20ONCE Condition1 = 0ONCE Condition2 = 0ONCE Condition3 = 0ONCE Condition4 = 0ONCE Condition5 = 0ONCE Condition6 = 0ONCE Condition7 = 0ONCE Condition8 = 0ONCE Condition9 = 0ONCE Condition10 = 0ONCE Condition11 = 0ONCE Condition12 = 0ONCE Condition13 = 0ONCE Condition14 = 0ONCE Condition15 = 0ONCE Condition16 = 0ONCE Condition17 = 0ONCE Condition18 = 0ONCE Condition19 = 0ONCE Condition20 = 0ONCE trend=1ONCE supplyline=highONCE supportline=lowVolValue = VolumeLowVolValue = VolValueClimaxUpValue = VolValueClimaxDownValue = VolValueChurnValue = VolValueClimaxChurnValue = VolValueStopVolValue = VolValueTrampolineValue = VolValueAVVolume = Average[Lookback*2](VolValue)IF History = 0 THENBI = 400ELSIF History = 1 THENBI = LookbackENDIFIF BARINDEX > BI AND Volume <> 0 THEN// *********************************************************************************************IF Close > Open THENValue1 = Volume * (Range / (2 * Range + Open - Close))ELSIF Close < Open THENValue1= Volume * ((Range + Close - Open) / (2 * Range + Close - Open))ENDIFIF Close = Open THENValue1 = 0.5 * VolumeENDIFValue2 = Volume - Value1Value3 = Value1 + Value2Value4 = Value1 * RangeValue5 = (Value1 - Value2) * RangeValue6 = Value2 * RangeValue7 = (Value2 - Value1) * RangeIF Range <> 0 THENValue8 = Value1 / RangeValue9 = (Value1 - Value2) / RangeValue10 = Value2 / RangeValue11 = (Value2 - Value1) / RangeValue12 = Value3 / RangeENDIFValue13 = Value3 +Value3[1]Value14 = (Value1+Value1[1]) * (Highest[2](High) - Lowest[2](Low))Value15 = (Value1+Value1[1] - Value2 - Value2[1]) * (Highest[2](High) - Lowest[2](Low))Value16 = (Value2 + Value2[1]) * (Highest[2](High) - Lowest[2](Low))Value17 = (Value2 + Value2[1] - Value1 - Value1[1]) * (Highest[2](High) - Lowest[2](Low))IF Highest[2](High) <> Lowest[2](Low) THENValue18 = (Value1 + Value1[1]) / (Highest[2](High) - Lowest[2](Low))ENDIFValue19 = (Value1 + Value1[1] - Value2 - Value2[1]) / (Highest[2](High) - Lowest[2](Low))Value20 = (Value2 + Value2[1]) / (Highest[2](High) - Lowest[2](Low))Value21 = (Value2 + Value2[1] - Value1 - Value1[1]) / (Highest[2](High) - Lowest[2](Low))Value22 = Value13 / (Highest[2](High) - Lowest[2](Low))IF Use2Bars = 0 THENCondition1 = Value3 = Lowest[Lookback](Value3)Condition2 = Value4 = Highest[Lookback](Value4) AND Close > OpenCondition3 = Value5 = Highest[Lookback](Value5) AND Close > OpenCondition4 = Value6 = Highest[Lookback](Value6) AND Close < OpenCondition5 = Value7 = Highest[Lookback](Value7) AND Close < OpenCondition6 = Value8 = Lowest[Lookback](Value8) AND Close < OpenCondition7 = Value9 = Lowest[Lookback](Value9) AND Close < OpenCondition8 = Value10 = Lowest[Lookback](Value10) AND Close > OpenCondition9 = Value11 = Lowest[Lookback](Value11) AND Close > OpenCondition10 = Value12 = Highest[Lookback](Value12)ELSIF Use2Bars = 1 THENCondition11 = Value13 = Lowest[Lookback](Value13)Condition12 = Value14 = Highest[Lookback](Value14) AND Close > Open AND Close[1] > Open[1]Condition13 = Value15 = Highest[Lookback](Value15) AND Close > Open AND Close[1] > Open[1]Condition14 = Value16 = Highest[Lookback](Value16) AND Close < Open AND Close[1] < Open[1]Condition15 = Value17 = Highest[Lookback](Value17) AND Close < Open AND Close[1] < Open[1]Condition16 = Value18 = Lowest[Lookback](Value18) AND Close < Open AND Close[1] < Open[1]Condition17 = Value19 = Lowest[Lookback](Value19) AND Close < Open AND Close[1] < Open[1]Condition18 = Value20 = Lowest[Lookback](Value20) AND Close > Open AND Close[1] > Open[1]Condition19 = Value21 = Lowest[Lookback](Value21) AND Close > Open AND Close[1] > Open[1]Condition20 = Value22 = Highest[Lookback](Value22)ENDIF// *********************************************************************************************IF (Condition1 or Condition11) THEN // YellowLowVol = LowVolValueELSELowVol = 0ENDIFIF (Condition2 or Condition3 or Condition8 or Condition9 or Condition12 or Condition13 or Condition18 or Condition19) THEN // RedClimaxUp = ClimaxUpValueIF LowVol <> 0 THENClimaxUp = ClimaxUpValue / 2ENDIFELSEClimaxUp = 0ENDIFIF (Condition4 or Condition5 or Condition6 or Condition7 or Condition14 or Condition15 or Condition16 or Condition17) THEN // WhiteClimaxDown = ClimaxDownValueIF LowVol <> 0 OR ClimaxUp <> 0 THENClimaxDown = ClimaxDownValueENDIFELSEClimaxDown = 0ENDIFIF (Condition10 or Condition20) THEN // GreenChurn = ChurnValueIF LowVol <> 0 OR ClimaxUp <> 0 OR ClimaxDown <> 0 THENChurn = ChurnValue / 2ENDIFELSEChurn = 0ENDIF//IF (Condition10 or Condition20) AND (Condition2 or Condition3 or Condition4 or Condition5 or Condition6 or Condition7 or Condition8 or Condition9 or Condition12 or Condition13 or Condition14 or Condition15 or Condition16 or Condition17 or Condition18 or Condition19) THENIF Churn <> 0 AND (ClimaxUp <> 0 OR ClimaxDown <> 0) THEN // MagentaClimaxChurn = ClimaxChurnValueELSEClimaxChurn = 0ENDIF//StopVolumeLocalClosingPosition = 1 - (High - Close) / (High - Low)IF Volume > Volume[1] AND Range < Range[1] AND ((High > High[1] AND LocalClosingPosition < 0.4) OR (Low < Low[1] AND LocalClosingPosition > 0.6)) THENStopVol = StopVolValue * 1 / 3 // HigherVolume & LowerRange @ HigherHigh or LowerLow - DBlueELSEStopVol = 0ENDIF//TrampolineFOR i = 1 TO 2 // Close togetherIF ((ClimaxChurn[i] > 0 OR ClimaxUp[i] > 0) AND (ClimaxChurn > 0 OR ClimaxUp > 0)) AND ((Close[i] > Open[i] AND Close < Open) OR (Close[i] < Open[i] AND Close > Open)) THENTrampoline = TrampolineValue * 1 / 4BREAKELSETrampoline = 0ENDIFNEXTtrend=1supplyline=highsupportline=low//trend:=barstate.isfirst?1:close>nz(supplyline[1])?1:close<nz(supportline[1])?-1:nz(trend[1])if close>supplyline[1] thentrend=1elseif close< supportline[1] thentrend=-1elsetrend=trend[1]endifendifif trend=1 thenif ClimaxDown<>0 thensupplyline= highest[2](high)elseif high>supplyline[1] thensupplyline=highelsesupplyline=supplyline[1]endifendifelseif ClimaxDown<>0 thensupplyline= highest[2](high)elsesupplyline=supplyline[1]endifendif//supplyline:= trend==1?climaxdownvolume?highest(2): high>supplyline[1]? high: supplyline[1]: climaxdownvolume? highest(2):supplyline[1]if trend=-1 thenif ClimaxUp<>0 thensupportline= lowest[2](low)elseif low<supportline[1] thensupportline=lowelsesupportline=supportline[1]endifendifelseif ClimaxUp<>0 thensupportline= lowest[2](low)elsesupportline=supportline[1]endifendif//supportline:= trend==-1?// climaxupvolume?// lowest(2)// :// low<supportline[1]?// low// :// supportline[1]// :// climaxupvolume?// lowest(2)// :// supportline[1]if trend=1 thentrail=supportlineelsetrail=supplylineendif//trailinging=trend==1?supportline:supplyline//plot(enabletrainline?trailing:na,title="trailline",color=trend==1?red:black,linewidth=1,transp=60)ENDIF//RETURN Volume COLOURED (0, 200, 200) AS "Volume (LBlue)", LowVol COLOURED (255, 255, 0) AS "LowVol (Yellow Histo): Bottom & Top & UpTrend Cont",ClimaxUp COLOURED (255, 0, 0) AS "Climax Up (Red Histo): Start UpTrend & Top & DownTrend Cont", ClimaxDown COLOURED (255, 255, 255) AS "ClimaxDown (White Histo): Bottom & UpTrend Cont & Start Down Trend" , Churn COLOURED (0, 155, 50) AS "Churn = HighVol@LowRange (Green Histo): Bottom & Top & Down Trend Cont",ClimaxChurn COLOURED (255, 0, 255) AS "ClimaxChurn (Magenta Histo): Top & DownTrend Cont: Brearish", Trampoline COLOURED (0, 0, 255) AS "Trampoline (DBlue Histo): Reversal", StopVol COLOURED (0, 0, 0) AS "StopVol (Black Histo): Profit Taking", AVVolume COLOURED (255, 0, 0) AS "AVVolume (Red Line)"return trail as "trail", close as "close"09/18/2021 at 6:34 AM #177832//@version=3
study(title=”Better X-Trend / Volume”,shorttitle=”BXT/BV”, overlay=true)
//Better Volume Indicator no tickvolume
//EasyLanguage Code Version 19 August 2012 Copyright http://www.Emini-Watch.com All rights reserved
//Better Volume Indicator
//http://emini-watch.com/the-better-x-trend-indicator/4408/
//http://emini-watch.com/free-stuff/volume-indicator/enablebarcolors=input(false,title=”Enable bar colors”)
enablebaricons=input(true,title=”Enable bar icons”)
enabletrainline=input(false,title=”Enable bar Trainline”)
lowvol=input(true,title=”show low volume”)
climaxup=input(false,title=”show climax up”)
climaxdown=input(false,title=”show climax down”)
churn=input(true,title=”show churn”)
climaxchurn=input(false,title=”show climax churn”)
use2bars=input(true,title=”use 2 bars”)
lookback=input(20, type=integer, minval=1, maxval=100,title=”look back bars”)
range = high-low+0.000000001 // this way avoiding zero in the denominators
range2= (highest(high,2)-lowest(low,2))+0.000000001
value1=na
value1:= close > open and range != 0 ? (range/(2*range+open-close))*volume : value1
value1:= close < open and range != 0 ? ((range+close-open)/(2*range+close-open))*volume: value1
value1:= close == open ? 0.5*volume:value1 //value1 is up volume
value2 = volume-value1 //value2 is down volume//using only one bar
value3 = abs(value1+value2)
value4 = value1*range
value5 = (value1-value2)*range
value6 = value2*range
value7 = (value2-value1)*rangevalue8 = value1/range
value9 = (value1-value2)/range
value10 = value2/range
value11 = (value2-value1)/range
value12 = value3/range// Using two bars
value13 = use2bars?( value3+value3[1]):na
value14 = use2bars?(value1+value1[1])*range2:na
value15 = use2bars?(value1+value1[1]-value2-value2[1])*range2:na
value16 = use2bars?(value2+value2[1])*range2:na
value17 = use2bars?(value2+value2[1]-value1-value1[1])*range2:navalue18 = use2bars ? (value1+value1[1])/range2:na
value19 = use2bars ? (value1+value1[1]-value2-value2[1])/range2:na
value20 = use2bars ? (value2+value2[1])/range2:na
value21 = use2bars ? (value2+value2[1]-value1-value1[1])/range2:na
value22 = use2bars ? value13/range2:na// one bar conditions
condition1 = value3 == lowest(value3,lookback)
condition2 = value4 == highest(value4,lookback) and close > open
condition3 = value5 == highest(value5,lookback) and close > open
condition4 = value6 == highest(value6,lookback) and close < open
condition5 = value7 == highest(value7,lookback) and close < open
condition6 = value8 == lowest(value8,lookback) and close < open
condition7 = value9 == lowest(value9,lookback) and close < open
condition8 = value10 == lowest(value10,lookback) and close > open
condition9 = value11 == lowest(value11,lookback) and close > open
condition10 = value12 == highest(value12,lookback)// two bar conditions
condition11 = use2bars and value13 == lowest(value13,lookback)
condition12 = use2bars and value14 == highest(value14,lookback) and close > open and close[1] > open[1]
condition13 = use2bars and value15 == highest(value15,lookback) and close > open and close[1] > open[1]
condition14 = use2bars and value16 == highest(value16,lookback) and close < open and close[1] < open[1]
condition15 = use2bars and value17 == highest(value17,lookback) and close < open and close[1] < open[1]
condition16 = use2bars and value18 == lowest(value18,lookback) and close < open and close[1] < open[1]
condition17 = use2bars and value19 == lowest(value19,lookback) and close < open and close[1] < open[1]
condition18 = use2bars and value20 == lowest(value20,lookback) and close > open and close[1] > open[1]
condition19 = use2bars and value21 == lowest(value21,lookback) and close > open and close[1] > open[1]
condition20 = use2bars and value22 == highest(value22,lookback)//Classifying the bars using one bar conditions, or using both one bar and two bar conditions simultaneosly if “use2bars” button selected.
lowvolume = (condition1 or condition11)
climaxupvolume = (condition2 or condition3 or condition8 or condition9 or condition12 or condition13 or condition18 or condition19)
climaxdownvolume = (condition4 or condition5 or condition6 or condition7 or condition14 or condition15 or condition16 or condition17)
churnvolume = (condition10 or condition20)
climaxchurnvolume = (condition10 or condition20) and (condition2 or condition3 or condition4 or condition5 or condition6 or condition7 or condition8 or condition9 or condition12 or condition13 or condition14 or condition15 or condition16 or condition17 or condition18 or condition19)val=climaxchurn and climaxchurnvolume? 1 : lowvol and lowvolume? 2:climaxup and climaxupvolume?3:climaxdown and climaxdownvolume?4:churn and churnvolume?5:6
bcolor=climaxchurn and climaxchurnvolume? purple : lowvol and lowvolume? orange:climaxup and climaxupvolume?red:climaxdown and climaxdownvolume?black:churn and churnvolume?blue:greenplotshape(enablebaricons==true and val==1 ? 1:na,location=location.abovebar, title=”Climax Churn”, style=shape.diamond, color=purple)
plotshape(enablebaricons==true and val==2 ? 1:na,location=location.belowbar, title=”Low Volume”, style=shape.circle, color=orange)
plotshape(enablebaricons==true and val==3 ? 1:na,location=location.belowbar, title=”Climax Up volume”, style=shape.triangleup, color=red)
plotshape(enablebaricons==true and val==4 ? 1:na,location=location.abovebar, title=”Climax Down volume”, style=shape.triangledown, color=black)
plotshape(enablebaricons==true and val==5 ? 1:na,location=location.abovebar, title=”Churn”, style=shape.square, color=blue)barcolor(enablebarcolors ? bcolor : na)
trend=1
supplyline=high
supportline=low
trend:=barstate.isfirst?1:close>nz(supplyline[1])?1:close<nz(supportline[1])?-1:nz(trend[1])supplyline:= trend==1?
climaxdownvolume?
highest(2)
:
high>supplyline[1]?
high
:
supplyline[1]
:
climaxdownvolume?
highest(2)
:
supplyline[1]supportline:= trend==-1?
climaxupvolume?
lowest(2)
:
low<supportline[1]?
low
:
supportline[1]
:
climaxupvolume?
lowest(2)
:
supportline[1]trailing=trend==1?supportline:supplyline
plot(enabletrainline?trailing:na,title=”trailline”,color=trend==1?red:black,linewidth=1,transp=60)09/18/2021 at 7:36 AM #177833 -
AuthorPosts
Find exclusive trading pro-tools on