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

Data comes and goes with multi-datastreams

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

    Data comes and goes with multi-datastreams

    Hi,

    I have an indicator that uses multiple datastreams. So I'm using...

    Add(PeriodType.Day, 1);

    It works fine.

    I then call that indicator from another indicator. But then I seem to get fairly random values.

    Maybe the first time I load it I get my values correctly. Picture 1.

    But then if I do 'Reload NinjaScript' I may get nothing. Picture 2.

    I assume it's something to do with data synching. Is there a way to make sure the data is loaded, so I don't get these blank values?

    Thanks
    Attached Files

    #2
    Hello,

    Thank you for the note.

    Is the Log tab of the Control Center reporting any errors? You might be using this indicator too early in the lifecycle. Try to configure it in the OnStartUp Override. This method is called right before OnBarUpdate starts to get called.

    Code:
    private SMA mySMA;
    
    protected override void OnStartUp()
    {
           mySMA = SMA(14);
    
    }
    I look forward to hearing of your results.
    Chris L.NinjaTrader Customer Service

    Comment


      #3
      Thanks.

      1. There are no errors in the log files.

      2. To add to this, I noticed that it works fine when I'm offline, and also now the market is closed. It is only when the market is open and I'm connected that this issue occurs.

      3. I'm unable to use your code because the indicator I'm calling is in a DLL that is initialized in the Startup method of that indicator. I'm thinking of putting a dummy call in that allows me to call the DLL in the Startup method, but without it actually referencing the DLL. But I can't test this until the market is open on Monday. I'll report back then.

      Comment


        #4
        Hello,

        Thank you for the reply.

        There is not enough information here to provide an answer. Could you please provide a simplified example so I can test this on my end? It sounds like the indicator is failing on real-time data. You can test this out on the Markey Replay connection to simulate real-time data.

        Please see this link for instructions on exporting a script to attach to your reply:


        I look forward to your reply.
        Chris L.NinjaTrader Customer Service

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by Radano, 06-10-2021, 01:40 AM
        19 responses
        604 views
        0 likes
        Last Post Radano
        by Radano
         
        Started by KenneGaray, Today, 03:48 AM
        0 responses
        3 views
        0 likes
        Last Post KenneGaray  
        Started by thanajo, 05-04-2021, 02:11 AM
        4 responses
        470 views
        0 likes
        Last Post tradingnasdaqprueba  
        Started by aa731, Today, 02:54 AM
        0 responses
        5 views
        0 likes
        Last Post aa731
        by aa731
         
        Started by Christopher_R, Today, 12:29 AM
        0 responses
        10 views
        0 likes
        Last Post Christopher_R  
        Working...
        X