Hi, a while ago that I did not write any articles about programming and the release of ProRealTime version 11 is an important opportunity to remember all the many improvements that come with it for programming!
Improve calculation and loading times
Before talking about the new instructions related to prorealtime indicators, I wanted to share with you a particular and very important addition that will allow us to limit indicator loading times.
This is the new instruction “IsLastBarUpdate“. This keyword returns a boolean equal to ‘true’ as soon as the last candle in the chart has changed.
What is the use ? It’s pretty simple, in case you only do calculations from the last candle on your chart (case of loops in the past in particular), it is totally useless to make them on all the candles of the history! In version 10.3 we were obliged to do so and considerably increase the loading and calculation times of the ‘indicator in prorealtime.
Example in this video: on the left the indicator calculates the levels of supports and resistances on thousands of bars using a loop with the addition of the condition to do it only from the last candle of the history, on the right side, we use the old way, as you can see, it’s amazing! Now the calculations are instantaneous!
So you just have to embed your codes in a condition related to “IsLastBarUpdate”, like this:
if IsLastBarUpdate then
Definition of the instruction:
This function returns 1 on candlesticks updated in real-time (or the last candlestick on a closed instrument, otherwise it returns 0.
We have a backtest, this function returrns 1 starting at the date the backtest was started. It is equal to 0 on the historical data preloaded by the backtest (PreLoadBars).
New graphical instruction: DRAW RAY
We can now draw segments that extend, on the right or on the left with DRAWRAY.
Definition of the instruction:
Draws a ray on the chart.
Example: DRAWRAY (x1, y1, x2, y2) COLOURED (R, V, B, a)
//extand to the right: white line
DRAWRAY(barindex, close, barindex, low)
//extand to the left: red line
DRAWRAY(barindex, close, barindex, close) coloured(255,0,0)
Styles of ProRealTime graphical instructions
All prorealtime graphical instructions now have the ability to be styled, as you could already do for variables in a RETURN statement, ie now you can draw on your graph a triangle colored in blue with thick edges and red dotted!
drawtriangle(barindex,low,barindex,high,barindex,medianprice) coloured(0,100,200) bordercolor(255,0,0) style(dottedline,4)
All available graphical instructions can be found in our online documentation: ProRealTime graphical instructions
New mathematical instructions
New rounding functions down (floor) and up (ceil).
Largest value that is equal to or lower to the argument Example use: Floor (a)
Smallest value that is greater than or equal to the argument Example of use: CEIL (a)
floor(109.45697) returns “109” , while ceil(109.45697) returns “110”.
All available mathematical instructions for ProBuilder language can be found here, in our online prorealtime documentation: Mathematical keywords for programming