Dont Clear Screen between indicator call (persistence drawing)

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #147346 quote
    robocop
    Participant
    Average

    Good Evening.

    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.

    defparam drawonlastbaronly = true
    
    MyTime =  Time
    MySecond = MyTime mod 100
    
    if islastbarupdate then
     
      for i = 1 to 50
        if MySecond mod 2 = 0 then
          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.

    this i a video i record that explain.

    http://www.mediafire.com/file/4n4zqz2ld1xfiqe/2020-10-13_23-38-06.mkv/file

    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.

    #147354 quote
    robertogozzi
    Moderator
    Master

    No, it’s not possible.

    You can add a copy of the above indicator (with a different name) to your chartand set the opposite conditions to plot A & B series.

    So that when it’s odd one will plot A and the other one B. You will always see both.

    #147382 quote
    robocop
    Participant
    Average

    thanks,

    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”…

    #147386 quote
    robertogozzi
    Moderator
    Master

    You may suggest that to PRT, they have a suggestion box at https://www.prorealtime.com/en/contact.

    Or you may post it here https://www.prorealcode.com/topic/centralization-of-queries-and-suggestions-on-prorealtime/.

    You can do both.

Viewing 4 posts - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.

Dont Clear Screen between indicator call (persistence drawing)


Platform Support: Charts, Data & Broker Setup

New Reply
Author
author-avatar
robocop @robocop Participant
Summary

This topic contains 3 replies,
has 2 voices, and was last updated by robertogozzi
5 years, 3 months ago.

Topic Details
Forum: Platform Support: Charts, Data & Broker Setup
Language: English
Started: 10/13/2020
Status: Active
Attachments: No files
Logo Logo
Loading...