remaining time left in a bar
Forums › ProRealTime English forum › ProBuilder support › remaining time left in a bar
- This topic has 7 replies, 2 voices, and was last updated 3 years ago by JC_Bywan.
Tagged: left, remaining, remaining time left, time
-
-
07/27/2021 at 12:43 PM #174224
Calling on PRC experts 🙂
If I am on a 15min chart, is there a way to capture the remaining time left of the current bar in a variable which I can store and use (for example multiply the remaining time left by a number)
07/28/2021 at 12:15 AM #174273Tnx Noobywan. I got your email. it works. what would be the same code for 1Hr and 5Hr charts?
07/28/2021 at 3:03 PM #174298How do I capture the IntraDayBarIndex of the 10am bar that will be correct on all intraday timeframes?
07/28/2021 at 4:41 PM #174300Hi, what I first posted, calling it “fast and lazy coding only for ut15” was too fast and too lazy, there was an issue with it. Although I removed it almost straight away when seeing it, I couldn’t prevent the email notification, sorry about that… Here’s a less lazy version correcting the issue, and it should be ok with your other 1h and 5h request too:
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455defparam DRAWONLASTBARONLY=true//diff=opentime-opentime[1]if diff=diff[1] thenut=diffelsif diff[1]=diff[2] thenut=diff[1]elsif diff[2]=diff[3] thenut=diff[2]endif//hut=(ut-ut mod 10000)/10000temput=(ut-hut*10000)mnut=(temput-temput mod 100)/100sut=temput-mnut*100//if time-opentime>0 and time-opentime<=ut thenduree=time-opentimeelsif time-opentime<=0 thenduree=time+240000-opentimeendif//hduree=(duree-duree mod 10000)/10000tempduree=(duree-hduree*10000)mnduree=(tempduree-tempduree mod 100)/100sduree=tempduree-mnduree*100//if islastbarupdate thensleft=sut-sdureeif sleft<0 thenmnret=1sleft=60+sut-sdureeelsemnret=0endifmnleft=mnut-mnduree-mnretif mnleft<0 thenhret=1mnleft=60+mnut-mnduree-mnretelsehret=0endifhleft=hut-hduree-hretelsehleft=0mnleft=0sleft=0endifleft=hleft*10000+mnleft*100+sleftDRAWTEXT("#hleft#h #mnleft#mn #sleft#s", barindex, left)DRAWTEXT("#left#", barindex, left*0.9)return left as "time left in candle"You can either use the variable “left” as an integer storing the requested value, or the subcomponents hleft, mnleft, sleft if you need in more details the hour minute and second component of the time left.
07/28/2021 at 4:55 PM #174302For your 10am intradaybarindex request, this would reset it at 0 each day, and providing you have a bar starting at 10am in the chosen timeframe it will store its intradaybarindex in the “mybar” variable:
1234567if opentime=100000 thenmybar=IntradayBarIndexelsif IntradayBarIndex<IntradayBarIndex[1] thenmybar=0endifreturn mybar07/29/2021 at 12:41 AM #174318Tnx Noobywan, I am also learning French in the process 🙂
Also, where is the time elapsed variable captured in the code above? How would you captured it (if not already captured in your code above)?
07/29/2021 at 4:39 AM #174320I am guessing time_elapsed would simply be
elapsed=(hduree*10000+mnduree*100+sduree)
07/29/2021 at 7:02 AM #174325 -
AuthorPosts
Find exclusive trading pro-tools on