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

Very slow display of indicators

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

    Very slow display of indicators

    Hello support team
    I developed a program that does the backtest directly on the chart and the user can manually adjust the setups in the parameter screen. As are 17 setups it was very complicated to find the best setup, so I decided to make a tracking program of the best setups in the case by genetic algorithm.
    The system tracks the best setups only once a day (beginning the day)
    The problem is that it was very slow when the genetic algorithm calls the program that does the backtests.
    For example, when I open the program (warm up time) that does the backtest in the entire series it takes about 30 seconds up to plot all on the chart (candlestick, 5min, 300 days of historical data).
    Could you give me any tips to make this process faster ???

    #2
    Hello Frasson,

    Thanks for your post.

    Are you using the strategy analyzer here or is this outside of that?
    Paul H.NinjaTrader Customer Service

    Comment


      #3
      Thank you for the fast return
      I dont use the "strategy analyzer" a make my own backtest program in ninjascript. The output is a backtest curve like a simple indicator, I use inside my code state machine to do that.
      I think the problem is the amount of indicators that I make, about 60


      Add(new Plot(Color.Transparent,"Average")); //00
      Add(new Plot(Color.Transparent,"CloseRange")); //01
      Add(new Plot(Color.Transparent,"MaxMinDiaVolat")); //empty //02
      Add(new Plot(Color.Transparent,PlotStyle.Bar,"VolatCandle" )); //03
      Add(new Plot(Color.Transparent,"AverageFast")); //04
      Add(new Plot(Color.Transparent,"SharkUp")); //05
      Add(new Plot(Color.Transparent,"SharkDn")); //06
      Add(new Plot(Color.Transparent,PlotStyle.Bar,"ProfitTrade" )); //07
      Add(new Plot(Color.Transparent,"ProfitTradeMax")); //08
      Add(new Plot(Color.Transparent,"ProfitTradeMin")); //09
      Add(new Plot(Color.Transparent,PlotStyle.Bar,"ProfitTradeT otal")); //10
      Add(new Plot(Color.Transparent,PlotStyle.Block,"SinalCV")) ; //11
      Add(new Plot(Color.Transparent,"DeltaMedia")); //12
      Add(new Plot(Color.Transparent,PlotStyle.Hash,"CotObjetivo ")); //13
      Add(new Plot(Color.Transparent,PlotStyle.Hash,"CotStop")); //14
      Add(new Plot(Color.Transparent,"MaximaDia")); //15
      Add(new Plot(Color.Transparent,"MinimaDia")); //16
      Add(new Plot(Color.Transparent,"DiffOpenClose")); //17
      Add(new Plot(Color.Transparent,"StatusCV")); //18
      Add(new Plot(Color.Transparent,"BandaIntraday")); //19
      Add(new Plot(Color.Transparent,"RetracaoUp")); //20
      Add(new Plot(Color.Transparent,"RetracaoDn")); //21
      Add(new Plot(Color.Transparent,"Suporte")); //22
      Add(new Plot(Color.Transparent,"Resistencia")); //23
      Add(new Plot(Color.Transparent,"ProfitTradeReal")); //24
      Add(new Plot(Color.Transparent,"ProfitTradeIntradayReal")) ; //25
      Add(new Plot(Color.Transparent,"ProfitTradeTotalReal")); //26
      Add(new Plot(Color.Transparent,PlotStyle.Bar,"BarIntradayI D")); //27
      Add(new Plot(Color.Transparent,PlotStyle.Bar,"ColorMap01") ); //28
      Add(new Plot(Color.Transparent,PlotStyle.Bar,"ColorMap02") ); //29
      Add(new Plot(Color.Transparent,PlotStyle.Bar,"ColorMap03") ); //30
      Add(new Plot(Color.Transparent,PlotStyle.Bar,"ColorMap04") ); //31
      Add(new Plot(Color.Transparent,PlotStyle.Bar,"ColorMap05") ); //32
      Add(new Plot(Color.Transparent,PlotStyle.Bar,"UpsAndDnsCou nt")); //33
      Add(new Plot(Color.Transparent,"TopoFundo")); //34
      Add(new Plot(Color.Transparent,"TFStatus")); //35
      Add(new Plot(Color.Transparent,"TopoFundoM")); //36
      Add(new Plot(Color.Transparent,"TFStatusM")); //37
      Add(new Plot(Color.Transparent,"Lateralidade")); //38
      Add(new Plot(Color.Transparent,PlotStyle.Bar,"LucroTF")); //39
      Add(new Plot(Color.Transparent,"LucroIntradayTF")); //40
      Add(new Plot(Color.Transparent,PlotStyle.Bar,"ColorMap00") ); //41
      Add(new Plot(Color.Transparent,"MediaRompTopo")); //42
      Add(new Plot(Color.Transparent,PlotStyle.Bar,"RompTopo")); //43
      Add(new Plot(Color.Transparent,"MediaRompFundo")); //44
      Add(new Plot(Color.Transparent,PlotStyle.Bar,"RompFundo")) ; //45
      Add(new Plot(Color.Transparent,"MediaRompUp")); //46
      Add(new Plot(Color.Transparent,PlotStyle.Bar,"RompUp")); //47
      Add(new Plot(Color.Transparent,"MediaRompDn")); //48
      Add(new Plot(Color.Transparent,PlotStyle.Bar,"RompDn")); //49
      Add(new Plot(Color.Transparent,"RiseRate")); //50
      Add(new Plot(Color.Transparent,"FallRate")); //51
      Add(new Plot(Color.Transparent,"ProfitTradeIntraday")); //52
      Add(new Plot(Color.Transparent,"VolumeIntraday")); //53
      Add(new Plot(Color.Transparent,"TopoFundoV")); //54
      Add(new Plot(Color.Transparent,"TFstatusV")); //55
      Add(new Plot(Color.Transparent,"MovimentoTFV")); //56
      Add(new Plot(Color.Transparent,PlotStyle.Bar,"FiltrosID")) ; //57
      Add(new Plot(Color.Transparent,PlotStyle.Bar,"EntradasID") ); //58
      Add(new Plot(Color.Transparent,PlotStyle.Bar,"ColorMap06") ); //59
      Add(new Plot(Color.Transparent,"IndexIn")); //60
      Add(new Plot(Color.Transparent,PlotStyle.Dot,"StopFixo")); //61
      Add(new Plot(Color.Transparent,"PeriodoVariavel")); //62
      Add(new Plot(Color.Transparent,PlotStyle.Bar,"ColorMap07") ); //63
      Add(new Plot(Color.Transparent,"IndexLastTopo")); //64
      Add(new Plot(Color.Transparent,"IndexLastFundo")); //65
      Add(new Plot(Color.Transparent,"JaSaiu")); //66

      Comment


        #4
        Hello Frasson,

        Thanks for your reply.

        Based on the info provided you are using 5 minute bars on 300 days of data which says that you are loading 86,400 data bars. With 67 plots you are creating about 5,788,800 data points. Depending on the variable sizes used the memory and disk requirements would like be 4 - 6 times that amount just to store the end values of the calculations. So just the handling of that volume of info would take some time, let alone the calculations that each plot is processing.

        If you can reduce the amount of data, you would likely see some improved loading performance.

        Here is a link to our typical performance tips: http://ninjatrader.com/support/helpG...ance_tips2.htm
        Paul H.NinjaTrader Customer Service

        Comment


          #5
          Hi great Paul

          I translated all indicators to arraylist "with size" of just 1 day
          every beginning day the sistem clear all indicators (ArrayLists) as they are only used for the logic of the rules.
          I left only the main as original array (completed with all the data)
          I have not finished but I hope that this will increase the system performance

          Comment


            #6
            hello Paul

            The artifices that I used have greatly improved the performance.
            I've been studying how to increase the "performance in C #" and found that the List <> are much faster than the ArrayList.
            However I am not able to create a List <> in my program in NinjaScript.

            I'm trying, but
            private List<int> IntLista = new List<int>();
            But not working

            The arrayList I declare this way and works:
            private ArrayList IntLista = new ArrayList();

            What I doing wrong?

            System.Collections is added
            Thank you
            Last edited by Frasson; 11-12-2015, 06:51 AM.

            Comment


              #7
              Hello Frasson,

              Thanks for your reply.

              Good to hear of your progress!

              You are using a typed collection which would require the use of System.Collection.Generic;
              Paul H.NinjaTrader Customer Service

              Comment


                #8
                Ohhhhhh
                Great
                worked!!!!

                Thank you

                Comment


                  #9
                  hi Paul
                  Please help me.
                  how could this happen?? (picture attached)

                  left code delayed 1 sec
                  right code delayed 10 sec
                  Attached Files
                  Last edited by Frasson; 11-13-2015, 07:56 AM.

                  Comment


                    #10
                    Hello Frasson,

                    Thanks for your reply.

                    Can you clarify what you need assistance with?
                    Paul H.NinjaTrader Customer Service

                    Comment


                      #11
                      thanks for the quick return
                      very simple ...
                      the right code is the same as the left, the only difference is that up to line 371 to 387 are commented in the code in the left code, so that part is not processing.
                      The left code processing time is much slower than the right code.
                      How can this happen ???
                      The variables are already being recorded of the line 352 to 369 in the two codes
                      How the left can be much faster than the right ???? (with the new records commented variables in right code)?

                      Comment


                        #12
                        Hello Frasson,

                        Thanks for your reply.

                        Regrettably I have no idea why your code would execute in time differently. If you have been compiling and loading repeatedly you may want to restart Ninjatrader to clear out any memory that may not be contiguous within Ninjatrader and retest.
                        Paul H.NinjaTrader Customer Service

                        Comment


                          #13
                          reseted and nothing
                          still the same problem
                          In C# its no makes sense

                          ????

                          One question
                          If I already have filled a function inside the Ninja values.
                          The system internally stores these inputs and associates to a output ???
                          Last edited by Frasson; 11-13-2015, 09:57 AM.

                          Comment

                          Latest Posts

                          Collapse

                          Topics Statistics Last Post
                          Started by Conceptzx, 10-11-2022, 06:38 AM
                          2 responses
                          53 views
                          0 likes
                          Last Post PhillT
                          by PhillT
                           
                          Started by Kaledus, Today, 01:29 PM
                          0 responses
                          3 views
                          0 likes
                          Last Post Kaledus
                          by Kaledus
                           
                          Started by PaulMohn, Today, 12:36 PM
                          2 responses
                          16 views
                          0 likes
                          Last Post PaulMohn  
                          Started by yertle, Yesterday, 08:38 AM
                          8 responses
                          37 views
                          0 likes
                          Last Post ryjoga
                          by ryjoga
                           
                          Started by rdtdale, Today, 01:02 PM
                          1 response
                          6 views
                          0 likes
                          Last Post NinjaTrader_LuisH  
                          Working...
                          X