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 Christopher_R, Today, 12:29 AM
      0 responses
      10 views
      0 likes
      Last Post Christopher_R  
      Started by sidlercom80, 10-28-2023, 08:49 AM
      166 responses
      2,235 views
      0 likes
      Last Post sidlercom80  
      Started by thread, Yesterday, 11:58 PM
      0 responses
      3 views
      0 likes
      Last Post thread
      by thread
       
      Started by jclose, Yesterday, 09:37 PM
      0 responses
      8 views
      0 likes
      Last Post jclose
      by jclose
       
      Started by WeyldFalcon, 08-07-2020, 06:13 AM
      10 responses
      1,415 views
      0 likes
      Last Post Traderontheroad  
      Working...
      X