Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Performance Indicator

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

    Performance Indicator

    Hello to everyone..

    I have developed an indicator (footprint) for my own use. In this indicator I have the posibility to draw the profile of the session. The code is something like this:

    public struct BidAskVolume
    {
    public double currentVolume;
    public double askVolume;
    public double bidVolume;

    public BidAskVolume(double cv, double av, double bv)
    {
    currentVolume = cv;
    askVolume = av;
    bidVolume = bv;
    }
    }

    public class Profile
    {
    public Dictionary<double, BidAskVolume> diccProfile = new Dictionary<double, BidAskVolume>();
    }

    private Series<Profile> ProfileBars;

    //Desde la primera bar de la sesión...
    for (int chartProfileIndex = PrimeraBarSesion; chartProfileIndex <= ChartBars.ToIndex; chartProfileIndex++)
    {
    Profile tmpprofile;

    if (ProfileBars.IsValidDataPointAt(chartProfileIndex) )
    {
    tmpprofile = ProfileBars.GetValueAt(chartProfileIndex);
    }
    else
    {
    continue;
    }

    if (tmpprofile == null) { continue; }

    Dispatcher.Invoke((Action)(() =>
    {
    //Montamos el profile.....
    foreach (KeyValuePair<double, BidAskVolume> fila in tmpprofile.diccProfile)
    {
    double tmpCurrent = 0.0;
    double tmpask = 0.0;
    double tmpbid = 0.0;

    //Si existe...actualizamos...
    if (profileVA.ContainsKey(fila.Key))
    {
    tmpask = profileVA[fila.Key].askVolume + fila.Value.askVolume;
    tmpbid = profileVA[fila.Key].bidVolume + fila.Value.bidVolume;
    tmpCurrent = profileVA[fila.Key].currentVolume + fila.Value.currentVolume;

    profileVA[fila.Key] = new BidAskVolume(tmpCurrent, tmpask, tmpbid);
    }

    else
    {
    profileVA.Add(fila.Key, new BidAskVolume(fila.Value.currentVolume, fila.Value.askVolume, fila.Value.bidVolume));
    }

    }
    }));

    I have a datatape Series<custom> that i save the ask and bid volumen for every Price of the tipus os data series. (10 Range). The performance is fine for a lot of instruments, but the problem is for the DAX, this instrument, when the session is comming up, it start to not work fine, because they have a lot of information. Because it's move a lot of points during the session.

    How can i improved the performance, when i want to draw the profile...
    Last edited by brokerbombero; 11-27-2017, 10:04 AM.

    #2
    Hello brokerbombero,

    Thanks for opening the thread.

    It sounds like this would be an expected limitation for tracking bid/ask volume for a busy instrument like DAX that would have a lot of price movement.

    You may be able to reduce the amount of data collected and improve speed by creating a lower resolution profile that is fed a wider range of values for bid/ask prices. (This of course would make the collected information less granular and "less accurate.") The main issue lies that more data to collect and calculate adds loading time.

    This inquiry leans towards a programming logic related question rather than a support based inquiry involving NinjaScript. I will leave this thread open ended if another community member would like to share their experience and advise.

    Comment


      #3
      Fixed

      The problem of the performance when build the profile of the sesión it's my fault...

      I haved tow nested loops, so when the profile it was grewing up, the performance was incresing.

      Thanks...

      Comment

      Latest Posts

      Collapse

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