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

Windows Form, load .pdf

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

    #46
    Originally posted by NinjaTrader_PatrickH View Post
    Hello akushyn,

    Thank you for your response.

    The bulletin[index].Date, what does the .ToString() look like when printed to the Output window (Tools > Output window) using the Print() method?

    Would the following not work in your testing?
    Code:
    if(bullentin[0].Date >= Time[0].Date)
    {
    // draw levels
    }
    Hello, Patrick
    Thank you for the answer

    The print of bulletin[i].Date its a DateTime object.
    Now I found the solution, correct is to implement:

    Code:
    if (!bulletin.Date.Date.Equals(Time[0].Date))
    					continue;
    For now it works fine. Have performance issue.
    When I load 10 or more days of history indicator is not responding for a long time, cause, I think, is every bar update. (reading the information from files, filtering levels, drawing levels).

    Could you please look at the script and write some performance improvements to optimize the calculation time?
    If you have time , tell me, I attach script file and samples.
    I would very appreciate your effort.

    In my case, its enough to read all information from files only once and enough only process one bar every day to filter and draw objects.

    Comment


      #47
      Hello akushyn,

      Thank you for your response.

      Over the historical data if there is any data that you do not need to process you could filter this out with CurrentBar or DateTime check. You can even limit the code to the real-time data by checking Historical with if(Historical)return;.

      Limiting the amount of printing, drawing objects and any logging will help to improve the performance as well.

      You can take a look at our Performance Tips at the following link: http://www.ninjatrader.com/support/h...ance_tips2.htm

      Comment


        #48
        Originally posted by NinjaTrader_PatrickH View Post
        Hello akushyn,

        Thank you for your response.

        Over the historical data if there is any data that you do not need to process you could filter this out with CurrentBar or DateTime check. You can even limit the code to the real-time data by checking Historical with if(Historical)return;.

        Limiting the amount of printing, drawing objects and any logging will help to improve the performance as well.

        You can take a look at our Performance Tips at the following link: http://www.ninjatrader.com/support/h...ance_tips2.htm
        Thank you for the response.

        Useful information, thank you. My issue unfortunatelly not in theese topics.
        The issue is how to read information from bulletin files only once when indicator starts AND when I change the 'Path' property???

        At this moment, indicator read info from files every bar update, what is very heavy.
        Last edited by akushyn; 10-09-2014, 10:46 AM.

        Comment


          #49
          Hello akushyn,

          Thank you for your response.

          Please take a look at the following link for information on OnStartUp(): http://www.ninjatrader.com/support/h.../onstartup.htm

          Comment


            #50
            Originally posted by NinjaTrader_PatrickH View Post
            Hello akushyn,

            Thank you for your response.

            Please take a look at the following link for information on OnStartUp(): http://www.ninjatrader.com/support/h.../onstartup.htm
            Thank you Patrick.
            I found solution by myself. I created boolean bulletinsLoaded variable to check if bulletins loaded.
            The part of code in OnBarUpdate :

            Code:
            if (!bulletinsLoaded)
            				{
            					for (int index = 0; index < pathList.Count; index++) 
            					{
            						bulletin = ReadBulletin(pathList[index]);
            						
            						// if wrong --> throw exception
            						if (bulletin == null)
            						{
            							DrawTextFixed(INVALID_BULLETIN, "Error reading bulletin file.", TextPosition.BottomRight, Color.Red, new Font(FontFamily.GenericSerif, 12), Color.Empty, Color.Empty, 100);
            						
            							throw new Exception("Error reading bulletin file.");
            							return;
            						}
            						else
            							RemoveDrawObject(INVALID_BULLETIN);
            							
            						// if bulletin is OK --> add to list
            						bulletins.Add(bulletin);
            					}
            					bulletinsLoaded = true;
            				}
            The variable bulletinsLoaded declared like this:

            Code:
            private bool bulletinsLoaded = false;
            And I change the variable only in above if statement to true.
            I did what I was looking for, just want to understand the life cycle of variable in ninjascript. Where else the bulletinsLoaded variable can be set to false ?

            Comment


              #51
              Glad to hear akushyn, anywhere then in the class if you're not declaring it as local variable only, that would have only method scope for example.
              BertrandNinjaTrader Customer Service

              Comment

              Latest Posts

              Collapse

              Topics Statistics Last Post
              Started by usazencort, Today, 01:16 AM
              0 responses
              1 view
              0 likes
              Last Post usazencort  
              Started by kaywai, 09-01-2023, 08:44 PM
              5 responses
              603 views
              0 likes
              Last Post NinjaTrader_Jason  
              Started by xiinteractive, 04-09-2024, 08:08 AM
              6 responses
              22 views
              0 likes
              Last Post xiinteractive  
              Started by Pattontje, Yesterday, 02:10 PM
              2 responses
              21 views
              0 likes
              Last Post Pattontje  
              Started by flybuzz, 04-21-2024, 04:07 PM
              17 responses
              230 views
              0 likes
              Last Post TradingLoss  
              Working...
              X