Announcement

Collapse

Looking for a User App or Add-On built by the NinjaTrader community?

Visit NinjaTrader EcoSystem and our free User App Share!

Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less

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.
    JimNinjaTrader Customer Service

    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 rocketman7, Today, 02:12 AM
      7 responses
      28 views
      0 likes
      Last Post NinjaTrader_ChelseaB  
      Started by guillembm, Yesterday, 11:25 AM
      3 responses
      16 views
      0 likes
      Last Post NinjaTrader_Jesse  
      Started by junkone, 04-21-2024, 07:17 AM
      10 responses
      148 views
      0 likes
      Last Post NinjaTrader_BrandonH  
      Started by tsantospinto, 04-12-2024, 07:04 PM
      6 responses
      101 views
      0 likes
      Last Post tsantospinto  
      Started by trilliantrader, 04-18-2024, 08:16 AM
      7 responses
      28 views
      0 likes
      Last Post NinjaTrader_BrandonH  
      Working...
      X