pine script to probuilder
Forums › ProRealTime English forum › ProBuilder support › pine script to probuilder
- This topic has 20 replies, 4 voices, and was last updated 1 year ago by LucasBest.
-
-
12/13/2023 at 1:26 PM #225222
Maybe i’ll need help for the dashboard part, if you are used to code dashboard ?
Oh, I will help for sure. It is only that I don’t know what you mean with “dashboard” in this realm ? can you elaborate a little ?
It is the part of the code that allow to plot text or graphics informations that may help.
https://www.tradingview.com/script/bkb6vZDz-Sessions-LuxAlgo/Dashboards can be more or less elaborated. See the second picture…
12/13/2023 at 1:31 PM #225225Dax 1 hour time frame. Deeper consolidation has begun ?
After just finally breaking the all time high a couple of days ago ? I’d say not. 🙂
It can be a backtest of the previous all time high…
12/13/2023 at 2:28 PM #225230It is the part of the code that allow to plot text or graphics informations that may help.
https://www.tradingview.com/script/bkb6vZDz-Sessions-LuxAlgo/Ah, that. OK. I think I can make something of that.
12/13/2023 at 7:22 PM #225237v2 is already out! 🙂
I changed medianprice option (which does not bring something interesting for trading purpose) by Opening range option. The opening range duration is set to 1 hour (010000), but can be changed/set in the configuration table as a time (HHMMSS).
This opening range can be used to trade th breakout/down.https://fr.tradingview.com/script/kpBLjNlk-Opening-Range-Breakout-with-2-Profit-Targets/
https://fr.tradingview.com/script/j5fydEzi-Drip-s-11am-rule-breakout-breakdown-OG/Sessions v2123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441DefParam DrawOnLastBarOnly = trueOnce EUIndex = 0Once NYIndex = 0Once JPIndex = 0////////////////////// EUROPE Session //////////////////////If ShowEuropeSession thenIf OpenTime >= 090000 AND OpenTime < 173000 THENIF OpenTime = 090000 THENEUBegin = BarindexEUHigh = highEULow = lowEUORHigh = HighEUORLow = LowEUActive = 1ENDIFEUEnd = BarindexEUHigh = max(EUHigh,high)EULow = min(EULow,low)Offset = Average[1+EUEnd-EUBegin](TR(close))If ShowOpeningRange thenIf OpenTime > 090000 and OpenTime < 090000+ORDuration thenEUORHigh = max(EUORHigh,high)EUORLow = min(EUORLow,Low)EndifIf close > EUORHigh thenDrawsegment(EUBegin,EUORHigh,EUEnd,EUORHigh) style(dottedline,3) coloured("green",200)elseDrawsegment(EUBegin,EUORHigh,EUEnd,EUORHigh) style(dottedline,3) coloured("royalblue",200)EndifIf close < EUORLow thenDrawsegment(EUBegin,EUORLow,EUEnd,EUORLow) style(dottedline,3) coloured("red",200)elseDrawsegment(EUBegin,EUORLow,EUEnd,EUORLow) style(dottedline,3) coloured("royalblue",200)EndifEndifIf ShowMeanPrice thenEUAverage = Average[EUEnd-EUBegin+1](Close)Drawsegment(EUBegin,EUAverage,EUEnd,EUAverage) style(line,3) coloured("royalblue",200)EndifIf ShowVWAP thenIf barindex = EUBegin thenPreviousEUVWAP = typicalpriceEndifIf barindex >= EUBegin+1 thenFor k = EUBegin+1 to barindex doIf volume>0 thenEUVWAP = SUMMATION[k-EUBegin](volume[Barindex-k]*typicalprice[Barindex-k])/SUMMATION[k-EUBegin](volume[Barindex-k])Drawsegment(k-1,PreviousEUVWAP,k,EUVWAP) style(line,3) coloured("royalblue",200)PreviousEUVWAP = EUVWAPEndifNextEndifEndifIf ShowTrendLine thenIf Barindex > EUBegin thenb=linearregression[EUEnd-EUBegin](close)a=linearregressionslope[EUEnd-EUBegin](close)y=b-a*(EUEnd-EUBegin-1)Drawsegment(EUBegin,y,EUEnd,b)Style(dottedline2,4) style(line,3) coloured("royalblue",200)EndifEndifDrawrectangle(EUBegin,EUHigh,EUEnd,EULow) coloured("royalblue",10) bordercolor("royalblue",200) style(dottedline,2)Drawtext("Euronext",(EUBegin+EUEnd)/2,EUHigh+Offset/2) coloured("royalblue",200)ENDIFIf Opentime = 173000 then$EUBegin[EUIndex] = EUBegin$EUEnd[EUIndex] = EUEnd$EUHigh[EUIndex] = EUHigh$EULow[EUIndex] = EULow$Offset[EUIndex] = Offset$EUORHigh[EUIndex] = EUORHigh$EUORLow[EUIndex] = EUORLowEUActive = 0EUIndex = EUIndex + 1EndifEndif//////////////////////// New York Session ////////////////////////If ShowNewYorkSession thenIf OpenTime >= 153000 AND OpenTime < 220000 THENIF OpenTime = 153000 THENNYBegin = BarindexNYHigh = highNYLow = lowNYORHigh = HighNYORLow = LowNYActive = 1ENDIFNYEnd = BarindexNYHigh = max(NYHigh,high)NYLow = min(NYLow,low)Offset = Average[1+NYEnd-NYBegin](TR(close))If ShowOpeningRange thenIf OpenTime > 153000 and OpenTime < 153000+ORDuration thenNYORHigh = max(NYORHigh,high)NYORLow = min(NYORLow,Low)EndifIf close > NYORHigh thenDrawsegment(NYBegin,NYORHigh,NYEnd,NYORHigh) style(dottedline,3) coloured("green",200)elseDrawsegment(NYBegin,NYORHigh,NYEnd,NYORHigh) style(dottedline,3) coloured("tomato",200)EndifIf close < NYORLow thenDrawsegment(NYBegin,NYORLow,NYEnd,NYORLow) style(dottedline,3) coloured("red",200)elseDrawsegment(NYBegin,NYORLow,NYEnd,NYORLow) style(dottedline,3) coloured("tomato",200)EndifEndifIf ShowMeanPrice thenNYAverage = Average[NYEnd-NYBegin+1](Close)Drawsegment(NYBegin,NYAverage,NYEnd,NYAverage) style(line,3) coloured("tomato",200)EndifIf ShowVWAP thenIf barindex = NYBegin thenPreviousNYVWAP = typicalpriceEndifIf barindex >= NYBegin+1 thenFor k = NYBegin+1 to barindex doIf volume>0 thenNYVWAP = SUMMATION[k-NYBegin](volume[Barindex-k]*typicalprice[Barindex-k])/SUMMATION[k-NYBegin](volume[Barindex-k])Drawsegment(k-1,PreviousNYVWAP,k,NYVWAP) style(line,3) coloured("tomato",200)PreviousNYVWAP = NYVWAPEndifNextEndifEndifIf ShowTrendLine thenIf Barindex > NYBegin thenb=linearregression[NYEnd-NYBegin](close)a=linearregressionslope[NYEnd-NYBegin](close)y=b-a*(NYEnd-NYBegin-1)Drawsegment(NYBegin,y,NYEnd,b)Style(dottedline2,4) style(line,3) coloured("tomato",200)EndifEndifDrawrectangle(NYBegin,NYHigh,NYEnd,NYLow) coloured("tomato",10) bordercolor("tomato",200) style(dottedline,2)Drawtext("New York",(NYBegin+NYEnd)/2,NYHigh+Offset/2.5) coloured("tomato",200)ENDIFIf Opentime = 220000 then$NYBegin[NYIndex] = NYBegin$NYEnd[NYIndex] = NYEnd$NYHigh[NYIndex] = NYHigh$NYLow[NYIndex] = NYLow$Offset[NYIndex] = Offset$NYORHigh[NYIndex] = NYORHigh$NYORLow[NYIndex] = NYORLowNYActive = 0NYIndex = NYIndex + 1EndifEndif////////////////////// Tokyo Session //////////////////////If ShowTokyoSession thenIf OpenTime >= 010000 AND OpenTime < 070000 THENIF OpenTime = 010000 THENJPBegin = BarindexJPHigh = highJPLow = lowJPORHigh = HighJPORLow = LowJPActive = 1ENDIFJPEnd = BarindexJPHigh = max(JPHigh,high)JPLow = min(JPLow,low)Offset = Average[1+JPEnd-JPBegin](TR(close))If ShowOpeningRange thenIf OpenTime > 010000 and OpenTime < 010000+ORDuration thenJPORHigh = max(JPORHigh,high)JPORLow = min(JPORLow,Low)EndifIf close > JPORHigh thenDrawsegment(JPBegin,JPORHigh,JPEnd,JPORHigh) style(dottedline,3) coloured("green",200)elseDrawsegment(JPBegin,JPORHigh,JPEnd,JPORHigh) style(dottedline,3) coloured("mediumvioletred",200)EndifIf close < JPORLow thenDrawsegment(JPBegin,JPORLow,JPEnd,JPORLow) style(dottedline,3) coloured("red",200)elseDrawsegment(JPBegin,JPORLow,JPEnd,JPORLow) style(dottedline,3) coloured("mediumvioletred",200)EndifEndifIf ShowMeanPrice thenJPAverage = Average[JPEnd-JPBegin+1](Close)Drawsegment(JPBegin,JPAverage,JPEnd,JPAverage) style(line,3) coloured("mediumvioletred",200)EndifIf ShowVWAP thenIf barindex = JPBegin thenPreviousJPVWAP = typicalpriceEndifIf barindex >= JPBegin+1 thenFor k = JPBegin+1 to barindex doIf volume>0 thenJPVWAP = SUMMATION[k-JPBegin](volume[Barindex-k]*typicalprice[Barindex-k])/SUMMATION[k-JPBegin](volume[Barindex-k])Drawsegment(k-1,PreviousJPVWAP,k,JPVWAP) style(line,3) coloured("mediumvioletred",200)PreviousJPVWAP = JPVWAPEndifNextEndifEndifIf ShowTrendLine thenIf Barindex > JPBegin thenb=linearregression[JPEnd-JPBegin](close)a=linearregressionslope[JPEnd-JPBegin](close)y=b-a*(JPEnd-JPBegin-1)Drawsegment(JPBegin,y,JPEnd,b)Style(dottedline2,4) style(line,3) coloured("mediumvioletred",200)EndifEndifDrawrectangle(JPBegin,JPHigh,JPEnd,JPLow) coloured("mediumvioletred",10) bordercolor("mediumvioletred",200) style(dottedline,2)Drawtext("Tokyo",(JPBegin+JPEnd)/2,JPHigh+Offset/2) coloured("mediumvioletred",200)ENDIFIf Opentime = 070000 then$JPBegin[JPIndex] = JPBegin$JPEnd[JPIndex] = JPEnd$JPHigh[JPIndex] = JPHigh$JPLow[JPIndex] = JPLow$Offset[JPIndex] = Offset$JPORHigh[JPIndex] = JPORHigh$JPORLow[JPIndex] = JPORLowJPActive = 0JPIndex = JPIndex + 1EndifEndif///////////////////////////////// Previous Sessions drawing /////////////////////////////////If Sessions2Show > 0 then// EUROPE Session //If ShowEuropeSession and EUIndex > 0 thenEUSessions2Draw = Max(0,Sessions2Show-EUActive)EUFirstSession = Max(0,EUIndex-Min(EUSessions2Draw,EUIndex))For i = EUIndex-1 downto EUFirstSession doIf ShowOpeningRange thendelay = Barindex-$EUEnd[i]If close[delay] > $EUORHigh[i] thenDrawsegment($EUBegin[i],$EUORHigh[i],$EUEnd[i],$EUORHigh[i]) style(dottedline,3) coloured("green",200)elseDrawsegment($EUBegin[i],$EUORHigh[i],$EUEnd[i],$EUORHigh[i]) style(dottedline,3) coloured("royalblue",200)EndifIf close[delay] < $EUORLow[i] thenDrawsegment($EUBegin[i],$EUORLow[i],$EUEnd[i],$EUORLow[i]) style(dottedline,3) coloured("red",200)elseDrawsegment($EUBegin[i],$EUORLow[i],$EUEnd[i],$EUORLow[i]) style(dottedline,3) coloured("royalblue",200)EndifEndifIf ShowMeanPrice thenEUAverage = Average[EUEnd-EUBegin+1](Close)Drawsegment(EUBegin,EUAverage,EUEnd,EUAverage) style(line,3) coloured("royalblue",200)EndifIf ShowMeanPrice thendelay = Barindex-$EUEnd[i]EUAverage = Average[$EUEnd[i]-$EUBegin[i]+1](Close[delay])Drawsegment($EUBegin[i],EUAverage,$EUEnd[i],EUAverage) style(line,3) coloured("royalblue",200)EndifIf ShowVWAP thendelay = Barindex-$EUBegin[i]PreviousEUVWAP = typicalprice[delay]For k = $EUBegin[i]+1 to $EUEnd[i] dodelay = barindex-klength = k-$EUBegin[i]If volume[delay]>0 thenEUVWAP = SUMMATION[length](volume[delay]*typicalprice[delay])/SUMMATION[length](volume[delay])Drawsegment(k-1,PreviousEUVWAP,k,EUVWAP) style(line,3) coloured("royalblue",200)PreviousEUVWAP = EUVWAPEndifNextEndifIf ShowTrendLine thendelay = Barindex-$EUEnd[i]b=linearregression[$EUEnd[i]-$EUBegin[i]+1](close[delay])a=linearregressionslope[$EUEnd[i]-$EUBegin[i]+1](close[delay])y=b-a*($EUEnd[i]-$EUBegin[i])Drawsegment($EUBegin[i],y,$EUEnd[i],b) Style(dottedline2,4) style(line,3) coloured("royalblue",200)EndifDrawrectangle($EUBegin[i],$EUHigh[i],$EUEnd[i],$EULow[i]) coloured("royalblue",10) bordercolor("royalblue",200) style(line,2)Drawtext("Euronext",($EUBegin[i]+$EUEnd[i])/2,$EUHigh[i]+$Offset[i]/2) coloured("royalblue",200)NextEndif// New York Session //If ShowNewYorkSession and NYIndex > 0 thenNYSessions2Draw = Max(0,Sessions2Show-NYActive)NYFirstSession = Max(0,NYIndex-Min(NYSessions2Draw,NYIndex))For i = NYIndex-1 downto NYFirstSession doIf ShowOpeningRange thendelay = Barindex-$NYEnd[i]If close[delay] > $NYORHigh[i] thenDrawsegment($NYBegin[i],$NYORHigh[i],$NYEnd[i],$NYORHigh[i]) style(dottedline,3) coloured("green",200)elseDrawsegment($NYBegin[i],$NYORHigh[i],$NYEnd[i],$NYORHigh[i]) style(dottedline,3) coloured("royalblue",200)EndifIf close[delay] < $NYORLow[i] thenDrawsegment($NYBegin[i],$NYORLow[i],$NYEnd[i],$NYORLow[i]) style(dottedline,3) coloured("red",200)elseDrawsegment($NYBegin[i],$NYORLow[i],$NYEnd[i],$NYORLow[i]) style(dottedline,3) coloured("royalblue",200)EndifEndifIf ShowMeanPrice thendelay = Barindex-$NYEnd[i]NYAverage = Average[$NYEnd[i]-$NYBegin[i]+1](Close[delay])Drawsegment($NYBegin[i],NYAverage,$NYEnd[i],NYAverage) style(line,3) coloured("tomato",200)EndifIf ShowVWAP thendelay = Barindex-$NYBegin[i]PreviousNYVWAP = typicalprice[delay]For k = $NYBegin[i]+1 to $NYEnd[i] dodelay = barindex-klength = k-$NYBegin[i]If volume[delay]>0 thenNYVWAP = SUMMATION[length](volume[delay]*typicalprice[delay])/SUMMATION[length](volume[delay])Drawsegment(k-1,PreviousNYVWAP,k,NYVWAP) style(line,3) coloured("tomato",200)PreviousNYVWAP = NYVWAPEndifNextEndifIf ShowTrendLine thendelay = Barindex-$NYEnd[i]b=linearregression[$NYEnd[i]-$NYBegin[i]+1](close[delay])a=linearregressionslope[$NYEnd[i]-$NYBegin[i]+1](close[delay])y=b-a*($NYEnd[i]-$NYBegin[i])Drawsegment($NYBegin[i],y,$NYEnd[i],b) Style(dottedline2,4) style(line,3) coloured("tomato",200)EndifDrawrectangle($NYBegin[i],$NYHigh[i],$NYEnd[i],$NYLow[i]) coloured("tomato",10) bordercolor("tomato",200) style(line,2)Drawtext("New York",($NYBegin[i]+$NYEnd[i])/2,$NYHigh[i]+$Offset[i]/2) coloured("tomato",200)NextEndif// TOKYO Session //If ShowTokyoSession and JPIndex > 0 thenJPSessions2Draw = Max(0,Sessions2Show-JPActive)JPFirstSession = Max(0,JPIndex-Min(JPSessions2Draw,JPIndex))For i = JPIndex-1 downto JPFirstSession doIf ShowOpeningRange thendelay = Barindex-$JPEnd[i]If close[delay] > $JPORHigh[i] thenDrawsegment($JPBegin[i],$JPORHigh[i],$JPEnd[i],$JPORHigh[i]) style(dottedline,3) coloured("green",200)elseDrawsegment($JPBegin[i],$JPORHigh[i],$JPEnd[i],$JPORHigh[i]) style(dottedline,3) coloured("mediumvioletred",200)EndifIf close[delay] < $JPORLow[i] thenDrawsegment($JPBegin[i],$JPORLow[i],$JPEnd[i],$JPORLow[i]) style(dottedline,3) coloured("red",200)elseDrawsegment($JPBegin[i],$JPORLow[i],$JPEnd[i],$JPORLow[i]) style(dottedline,3) coloured("mediumvioletred",200)EndifEndifIf ShowMeanPrice thendelay = Barindex-$JPEnd[i]JPAverage = Average[$JPEnd[i]-$JPBegin[i]+1](Close[delay])Drawsegment($JPBegin[i],JPAverage,$JPEnd[i],JPAverage) style(line,3) coloured("mediumvioletred",200)EndifIf ShowVWAP thendelay = Barindex-$JPBegin[i]PreviousJPVWAP = typicalprice[delay]For k = $JPBegin[i]+1 to $JPEnd[i] dodelay = barindex-klength = k-$JPBegin[i]If volume[delay]>0 thenJPVWAP = SUMMATION[length](volume[delay]*typicalprice[delay])/SUMMATION[length](volume[delay])Drawsegment(k-1,PreviousJPVWAP,k,JPVWAP) style(line,3) coloured("mediumvioletred",200)PreviousJPVWAP = JPVWAPEndifNextEndifIf ShowTrendLine thendelay = Barindex-$JPEnd[i]b=linearregression[$JPEnd[i]-$JPBegin[i]+1](close[delay])a=linearregressionslope[$JPEnd[i]-$JPBegin[i]+1](close[delay])y=b-a*($JPEnd[i]-$JPBegin[i])Drawsegment($JPBegin[i],y,$JPEnd[i],b) Style(dottedline2,4) style(line,3) coloured("mediumvioletred",200)EndifDrawrectangle($JPBegin[i],$JPHigh[i],$JPEnd[i],$JPLow[i]) coloured("mediumvioletred",10) bordercolor("mediumvioletred",200) style(line,2)Drawtext("Tokyo",($JPBegin[i]+$JPEnd[i])/2,$JPHigh[i]+$Offset[i]/2) coloured("mediumvioletred",200)NextEndifEndifReturn1 user thanked author for this post.
12/14/2023 at 6:35 PM #225253hello Lucas I would just like to thank you for you time and effort your work has helped me out massively, you sir are a genius 👌
12/14/2023 at 9:17 PM #225262 -
AuthorPosts
Find exclusive trading pro-tools on