Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Amount of Bars, which is added by Add()

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

    #46
    Hello agafon2,
    We provide support for documented NinjaScript codes only and this is more of a C# query which is unfortunately beyond what we could support.

    I will however leave the thread open for our forum members who can share their valuable inputs.
    JoydeepNinjaTrader Customer Service

    Comment


      #47
      Originally posted by agafon2 View Post
      Hello, Joydeep

      Please, help me

      To write some data to binary file i use:

      Code:
                     using (FileStream stream = new FileStream(History_way+"EURUSD"+i_period+".hst", FileMode.Append)){                    
                       using (BinaryWriter writer = new BinaryWriter(stream)){
       
                         writer.Write(Open[0]);   
       
                         writer.Close();                            
                       }
                     }
      But if i use a code above, other programes can't open this file in a Read mode

      How to make a code, where i can open binary file in NinjaScript and in other programes in one time?
      ref: http://www.ninjatrader.com/support/f...11454#poststop

      Comment


        #48
        How to draw line inside one bar?

        Look at this picture, please:

        http://saveimg.ru/show-image.php?id=816ff8773d67952803f35605946453f9

        Comment


          #49
          Hello agafon2,
          If you define the start and end parameter as time then are you able to do it. Please refer to this overload to do it.
          DrawLine(string tag, bool autoScale, DateTime startTime, double startY, DateTime endTime, double endY, Color color, DashStyle dashStyle, int width)
          JoydeepNinjaTrader Customer Service

          Comment


            #50
            Hello, Joydeep

            How to draw a double side histogram?

            Please, look at this picture:
            SaveImg позволит вам загрузить фото или картинку бесплатно и без регистрации

            Comment


              #51
              Hello agafon2,
              If you try using 2 plot values (each with different color and set the plot style to Bar) then are you able to do it.
              JoydeepNinjaTrader Customer Service

              Comment


                #52
                Originally posted by NinjaTrader_Joydeep View Post
                Hello agafon2,
                If you try using 2 plot values (each with different color and set the plot style to Bar) then are you able to do it.
                Can you please give a code example of indicator

                Comment


                  #53
                  Hello agafon2,
                  If you try the below code then are you able to make it work.

                  Code:
                  //in Initialize
                  Add(new Plot(Color.FromArgb(100, Color.Green), PlotStyle.Bar, "Plot0"));
                  Add(new Plot(Color.FromKnownColor(KnownColor.Blue), PlotStyle.Bar, "Plot1"));
                  
                  //in OnBarUpdate
                  Plot0.Set(1);
                  Plot1.Set(-1);
                  JoydeepNinjaTrader Customer Service

                  Comment


                    #54
                    What is an order of calling streams, when we use multi-series indicators:

                    Here is a code:

                    Code:
                            protected override void Initialize()
                            {
                                Overlay                = true;
                                Add(Instrument.FullName, PeriodType.Tick, 1, MarketDataType.Last);    //1        
                                Add(Instrument.FullName, PeriodType.Tick, 1, MarketDataType.Bid);    //2    
                                Add(Instrument.FullName, PeriodType.Tick, 1, MarketDataType.Ask);    //3            
                                
                            }
                    
                            /// <summary>
                            /// Called on each bar update event (incoming tick)
                            /// </summary>
                            protected override void OnBarUpdate()
                            {
                                
                              if (BarsInProgress == 0) {
                                Print("Current TF");
                              }
                            
                              if (BarsInProgress == 1) {
                                Print("Last");        
                              }
                            
                              if (BarsInProgress == 2) {
                                Print("Bid");        
                              }
                            
                              if (BarsInProgress == 3) {
                                Print("Ask");        
                              }        
                    
                            }
                    What is an order of calling streams? What stream will be the first, second, third e.t.c.? I mean, that OnBarUpdate() is calling for every stream: for current chart, for Ask, for Bid and for Last, i Add() this streams in Initilize() What is an order of calling? I mean, OnBarUpdate() is calling first for current chart bars or for Last bars or for Ask or for Bid?

                    Comment


                      #55
                      Hello agafon2,
                      NinjaTrader is an event based application and the OnBarUpdate event will be triggered when there is a new quote for the bar series.

                      Thus NinjaTrader parse does not controls it, it is more of market driven.
                      JoydeepNinjaTrader Customer Service

                      Comment


                        #56
                        Originally posted by NinjaTrader_Joydeep View Post
                        Hello agafon2,
                        NinjaTrader is an event based application and the OnBarUpdate event will be triggered when there is a new quote for the bar series.

                        Thus NinjaTrader parse does not controls it, it is more of market driven.
                        Joydeep, sorry, you didn't understand me:
                        When you start an indicator at first time, every history bar analyse and OnBarUpdate is calling for every history bar, while Historical == true;

                        And if i use extra streams,adding by Add(), what is an order of separating OnBarUpdate function calling for every stream?

                        Comment


                          #57
                          Hello agafon2,
                          The bars are referenced as per time. If the primary bar and the secondary bar have the same time stamp then the primary bar will be updated first, then the 1st secondary bar and so on.
                          JoydeepNinjaTrader Customer Service

                          Comment


                            #58
                            Hello, Joydeep

                            Look,
                            There is M1 chart based on Last price
                            Every bar of this chart contains some amount of ticks with Last price on it

                            Always there are two extra prices for every tick on the market: there are Ask and Bid prices

                            How to get Ask and Bid prices for every historical tick

                            I added three extra streams: Ask, Bid and Lask ticks, but i can't synhonize it

                            Comment


                              #59
                              Hello agafon2,
                              Unfortunately the bid/ask/last data are not synchronized and you have to explicitly synchronize it. You may refer to this indicator which is on similar lines


                              Also please do note, the highest granularity time in NinjaTrader is seconds. So you may not have a 100% sync in case you have multiple ticks on the same seconds.
                              JoydeepNinjaTrader Customer Service

                              Comment


                                #60
                                Hello, Joydeep

                                Please, check your email - i sent an email for you

                                Comment

                                Latest Posts

                                Collapse

                                Topics Statistics Last Post
                                Started by Geovanny Suaza, 02-11-2026, 06:32 PM
                                0 responses
                                636 views
                                0 likes
                                Last Post Geovanny Suaza  
                                Started by Geovanny Suaza, 02-11-2026, 05:51 PM
                                0 responses
                                366 views
                                1 like
                                Last Post Geovanny Suaza  
                                Started by Mindset, 02-09-2026, 11:44 AM
                                0 responses
                                107 views
                                0 likes
                                Last Post Mindset
                                by Mindset
                                 
                                Started by Geovanny Suaza, 02-02-2026, 12:30 PM
                                0 responses
                                568 views
                                1 like
                                Last Post Geovanny Suaza  
                                Started by RFrosty, 01-28-2026, 06:49 PM
                                0 responses
                                571 views
                                1 like
                                Last Post RFrosty
                                by RFrosty
                                 
                                Working...
                                X