i need an help. i have write this sample code to understand how many time Prorealtime platform call my indicator and how platform manage screen and drawing.
sample design
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
defparamdrawonlastbaronly=true
MyTime=Time
MySecond=MyTimemod100
ifislastbarupdatethen
fori=1to50
ifMySecondmod2=0then
drawtext("A#i#",barindex-i,1.1743)
else
drawtext("B#i#",barindex-i,1.1741)
endif
next
endif
return
code is very simple. it draw only on the last bar call, and if the last bar closing second is even or odd it draw text A or B.
when i run the indicator, i see on the screen apper line A, then text disappear then appear text line B and so on.
i deduce that platform call my indicator for every new price, and within these call platform does nested call for each bar.
but i deduce also that platform clear screen for every new call associated with new price, otherwise I would have seen both lines of text remain on the screen, both A and B.
Instead, if line A appears, the B disappears and vice versa, so it means that the screen is cleared before every new call.
Do you know a way for the screen not to be blanked, at least for a certain indicator, so that what was previously drawn can be left on the screen?
If i have an indicator that calcuate a value for yesterday and plot it on the screen, that value will be ok forever and i wont’ to recalculate for every price in the future, wasting cpu.
Or i will have the chance to decide if clear past value or leave on the screen.
i want to find a way to preserve cpu usage. Imagine you have an indicator that draw a line that from each middle point of a single candle from a starting date in the past to today.
(ok is a stupid thing, i use it to force a condition which doesnt change…). I can design the line for the first time, and for every new candle i could draw only the new line from last point to new point to the current new point. so i can avoid cpu time to redesign line i the past, which has already been designed on the screen.
you agree that cpu time used to redesign every time the line in the past is cpu time wasted. This is a perform issue when i use multiple indicator on the same chart or i have multiple chart on same plan, which every single indicator waste cpu time do redesign what is unchanged and will never change.
I think that will be a nice feature to reduce waste cpu usage and ram usage issue that i noticed has increased in last few weeks (probably due to platform change).
i think something like a directive like “defparam dont clearscreen”…
To help us continually offer you the best experience on ProRealCode, we use cookies. By clicking on "Continue" you are agreeing to our use of them. You can also check our "privacy policy" page for more information.Continue