Hi mmichael
The indicator found here: https://www.prorealcode.com/prorealtime-indicators/initial-balance-indicator-v2-0/ bought to my attention by Toto le Heros should do what you want.
Hi AVT, if you are following this thread, just want to thank you for the sterling coding job you did. The indicator has worked perfectly so far this week so I assume it must be bug free – unless affected by public holidays etc. I would like to ask you another favour if you don’t mind and have some spare moments. It involves checking some code from one of my earlier posts and a modification to some code- which I have not been able to do myself. If you are game, please let me know here, and I will bring you up to speed with the issue(s). Thank you.
AVTParticipant
Senior
@denmar Following, but not checking my mail account, so I might be a day late sometimes.
I did also follow the line plotting and noticed some lines not constantly updated with ongoing minutes. There’s a peace of code in it checking what timeframe we are in which is neither my work nor do I understand it (shame on me) and when debugging this code, it sometimes showed wrong results (like on a m3 chart it sometimes said we have m6 or even m24, which is why I don’t trust that code – or the code is correct and sometimes just the calculation engine too busy or god know what), so it’s still in “working sheet” state – there’s by the way still a DRAWTEXT line in it which should be deleted.
AVTParticipant
Senior
I made a detailed example for you, so you can examine how it is done. Those 2 “breakout range lines” will accompany you through the whole market session and it will do that for every day (very handy if one wants to compare them with previous days). Code:
// === paint breakout box lines during the market time
// === PRT 10.3 AVT
// --- variables exern
//StartTime=080000 // when do we start to find our box range
//StopTime=090000 // when do we stop to find our box range
// --- usually we only need those lines printed as long as the market is open
// painting range breakout lines makes only sense from that moment on
// when the range is complete, means at 9:00 we know the 8-9 range
//PrintTimeStart=090001 // when do we want to start printing our lines
//PrintTimeStop=163000 // when do we want to stop printing our lines
//ShowLines=1 // quick switch on=1 off=0 of lines (practical if too much in the chart)
// --- variables intern
CalcTime=(time>=StartTime AND time<=StopTime) // from 8:00 till 9:00
PrintTime=(time>=PrintTimeStart AND time<=PrintTimeStop) // from 9:01 till 16:30
// --- calc
IF IntradayBarIndex = 0 THEN // if the bar for the current day is the first one
RangeHighestPrice = 0 // set highest to 0, -> the first price we calc will be more
RangeLowestPrice = close * 1000 // set lowest very high -> the first price we calc will be less
ENDIF
IF CalcTime THEN // if we are between 8-9
RangeHighestPrice = max(RangeHighestPrice,high) // take maximum of what we know already and high of bar
RangeLowestPrice = min(RangeLowestPrice,low) // take minimum of what we know already and low of bar
RangeHigh = RangeHighestPrice // fix the highest we found in an extra variable
RangeLow = RangeLowestPrice // same for lowest
// this is repeated for each new bar as long as we are in the calc time 8-9
// if time is over we have our final values
ENDIF
// --- calc end
// --- print
// we begin printing a minute after we know the complete range
IF PrintTime THEN // we are within the printing time 9:01-16:30
IF ShowLines THEN // we are allow to show the lines
DRAWSEGMENT(barindex-1,RangeHigh,barindex,RangeHigh) coloured(255,0,255) // upper Line magenta for now
DRAWSEGMENT(barindex-1,RangeLow,barindex,RangeLow) coloured(255,0,255) // lower Line
ENDIF
ENDIF
// --- print end
RETURN
// === End of prog
I also attach the itf so you can see how/where we set external variables.
Hope this helps you.
Hello,
I would like to jump in your interesting topic.
I share with you a small enhancement. If (like me) you need these lines only for indexes (CAC, DAX, DJI, …) as these are not relevant for other assets, forex etc…, I would suggest to change line 38 as follows –> It works for me.
IF PrintTime and close > 5000 THEN
I have a small question, is it possible to add a condition (or choice checkbox) to plot the lines only for the current day?
For information, to plot the lines only for today, I tried the following code but it works for DAX but not DJI. Any idea ?
IF printTime and ShowLines and date = today THEN
AVTParticipant
Senior
@mmichael
In this code snip you suggested
IF PrintTime and close > 5000 THEN
you say: print only if we are in the allowed time and the closing price is above 5000.
But printing should not have anything to do with a price level. Just have a look here http://www.finanzen.net/indizes/Westeuropa – there are a lot of European indices which are well below 5000 and you would exclude all those from ever being printed.
If you have this printing tool in a forex chart for example, there’s the check box ShowLines – and if you switch that off no line will be shown and that’s it.
As for the 2nd matter of drawing just at the current day, this snip
IF printTime and ShowLines and date = today THEN
does not work here at all, because all those Date,Today,Yesterday,OpenDate return a “wrong format” (due to https://www.prorealcode.com/documentation/category/dateandtime/ those should: Report …. in YYYYMMDD format, but actually they simply return 20,2M which is unusable). My solution would be to compare the day part of a date (DD). But at the moment a day change at my PRT takes place around 17:45 and 18:15 – really don’t know what the cause for that is, so for now I can’t test anything, sorry for that. I have to find out what the heck is the orign of such time differences.