Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

UniRenko memory leak

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    UniRenko memory leak

    I'm trying to diagnose why some hybrid Renko bars (e.g. UniRenko, etc.) cause a serious memory leak when you try to use Market Replay.

    I'm suspicious that has to do with the way MR deals with market data differently from live data, and some statement may be caught into a loop with the AddBar(...) statement within it.

    When I try to add Print(" ....") statements within the code of the bar, I get a compilation error "The name Print does not exist in the current context". I thought was a namespace reference issue, but that seems not to be the problem. I also have problems with the Log( ...) statement.

    I guess I have 2 questions:
    1- Any clues as why MR would cause the memory leak while it works fine with live data?
    2- How could I diagnose the problem using Print statements?

    I tried to comment out parts of the code, but if I could use Print statements with some info around the code would be much easier to diagnose the issue with these bars.

    Thanks!

    #2
    Ok...

    I think I found the cause of the leak and how to solve it. I looked at the original Renko bars code, and I used the following piece of code in the beginning of the procedure for the synthetic Renkos:

    // ******************* ADDED FROM RENKO
    offset = bars.Period.Value * bars.Instrument.MasterInstrument.TickSize;
    if (bars.Count < tmpCount && bars.Count > 0) // reset cache when bars are trimmed
    {
    renkoHigh = bars.GetClose(bars.Count -
    1) + offset;
    renkoLow = bars.GetClose(bars.Count -
    1) - offset;
    }
    // *********************
    and before the end:
    tmpCount = bars.Count; // ADDED FROM RENKO

    I'm still testing it, but it seems ok, and now I can use Market Replay with these bars without memory leaks. I'm still trying to understand better why this piece of code is needed. If someone can shine some light about how this is resetting the 'cache' I would love to hear the explanation.

    I also still would love to be able to print to output to have a better understanding of what is going on with the different variables of the code.

    Thanks!

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by Geovanny Suaza, 02-11-2026, 06:32 PM
    0 responses
    581 views
    0 likes
    Last Post Geovanny Suaza  
    Started by Geovanny Suaza, 02-11-2026, 05:51 PM
    0 responses
    336 views
    1 like
    Last Post Geovanny Suaza  
    Started by Mindset, 02-09-2026, 11:44 AM
    0 responses
    103 views
    0 likes
    Last Post Mindset
    by Mindset
     
    Started by Geovanny Suaza, 02-02-2026, 12:30 PM
    0 responses
    554 views
    1 like
    Last Post Geovanny Suaza  
    Started by RFrosty, 01-28-2026, 06:49 PM
    0 responses
    552 views
    1 like
    Last Post RFrosty
    by RFrosty
     
    Working...
    X