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

What does OnBarUpdate() return when...

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

    #16
    "It may pay you better to read through the manual, so you get the hang of how to set things up. There are tutorials in there"

    I "fooly" agree! I've just drawn that conclusion myself... I have been going through the "language reference" and the NTD YourTube channel quite a bit.

    Question regarding:
    "As far as creating a dataset, yes, you will have to put that data into some kind of collection"

    I'm trying to write a class (also an interface def) to see how I can "step out" of NScript. Do you have an example of creating some sort of "Data Container" that I could look at?

    To all... Sorry for all of this "hubub" I've created...

    Rob
    Last edited by RobVig; 04-23-2016, 05:41 PM.

    Comment


      #17
      "... (Un?)fortunately, you are wrong. "

      Awesome! You mean to say I am wrong if I am thinking NScript is like Lego's ???
      I'm still trying to get my bearings with NinjaScript. That said... I'm like a Kid in a Candy store with the possibilities!

      Comment


        #18
        Originally posted by RobVig View Post
        "... (Un?)fortunately, you are wrong. "

        Awesome! You mean to say I am wrong if I am thinking NScript is like Lego's ???
        I'm still trying to get my bearings with NinjaScript. That said... I'm like a Kid in a Candy store with the possibilities!
        Yes! That is what I mean. NT is less like Lego's; more like a set of moulds. You can use the moulds to build your edifice, or you can roll your own.

        Comment


          #19
          "You can use the moulds to build your edifice, or you can roll your own."

          Well said my friend :>

          I'd love to see some "radical" code... Any Git repositories / links I can look at?

          Comment


            #20
            Originally posted by RobVig View Post
            "You can use the moulds to build your edifice, or you can roll your own."

            Well said my friend :>

            I'd love to see some "radical" code... Any Git repositories / links I can look at?
            Most of us the professional developers tend to keep our radical code as trade secrets, though I have personally given out a lot of them in various threads.

            There are sub-fora for some examples and tips. Look at the fora list from the forum home page.

            Comment


              #21
              @koganam I understand. How about some DataSet Pseudocode for a brother? ;>

              // Baby steps...

              namespace NinjaTrader.Strategy
              {
              [Description("Create custom object and functions")]
              public class CustomObjectTest01 : Strategy
              {
              Vehicle vehicle = new Vehicle();
              protected override void Initialize()
              {
              CalculateOnBarClose = false;
              }
              protected override void OnBarUpdate()
              {
              vehicle.Speed = 210.3;
              var x = vehicle.IncreaseSpeedBy10mph();
              Console.WriteLine("{0}", x);
              }
              }

              public class Vehicle {
              public double Speed { get; set; }

              public Vehicle() {}

              public Vehicle(double speed) {
              this.Speed = speed;
              }

              public double IncreaseSpeedBy10mph() {
              return this.Speed + 10.0;
              }
              }
              }

              Comment


                #22
                Originally posted by RobVig View Post
                @koganam I understand. How about some DataSet Pseudocode for a brother? ;>

                // Baby steps...

                namespace NinjaTrader.Strategy
                {
                [Description("Create custom object and functions")]
                public class CustomObjectTest01 : Strategy
                {
                Vehicle vehicle = new Vehicle();
                protected override void Initialize()
                {
                CalculateOnBarClose = false;
                }
                protected override void OnBarUpdate()
                {
                vehicle.Speed = 210.3;
                var x = vehicle.IncreaseSpeedBy10mph();
                Console.WriteLine("{0}", x);
                }
                }

                public class Vehicle {
                public double Speed { get; set; }

                public Vehicle() {}

                public Vehicle(double speed) {
                this.Speed = speed;
                }

                public double IncreaseSpeedBy10mph() {
                return this.Speed + 10.0;
                }
                }
                }
                A bit too abstract. Talk in terms of prices and trading. We do not use WriteLine() because we are not writing to the system console. Instead we would use Print(), which writes to our (debug) Output Window.

                Comment


                  #23
                  Originally posted by RobVig View Post
                  @koganam I understand. How about some DataSet Pseudocode for a brother? ;>

                  // Baby steps...

                  namespace NinjaTrader.Strategy
                  {
                  [Description("Create custom object and functions")]
                  public class CustomObjectTest01 : Strategy
                  {
                  Vehicle vehicle = new Vehicle();
                  protected override void Initialize()
                  {
                  CalculateOnBarClose = false;
                  }
                  protected override void OnBarUpdate()
                  {
                  vehicle.Speed = 210.3;
                  var x = vehicle.IncreaseSpeedBy10mph();
                  Console.WriteLine("{0}", x);
                  }
                  }

                  public class Vehicle {
                  public double Speed { get; set; }

                  public Vehicle() {}

                  public Vehicle(double speed) {
                  this.Speed = speed;
                  }

                  public double IncreaseSpeedBy10mph() {
                  return this.Speed + 10.0;
                  }
                  }
                  }
                  As I said, you are best off reading the manual. I will direct you initially to this section, but you really should read the whole of it. It is the fastest way to get up to speed.

                  ref: http://ninjatrader.com/support/helpG..._resources.htm
                  Last edited by koganam; 04-23-2016, 06:24 PM.

                  Comment


                    #24
                    Originally posted by RobVig View Post
                    "... (Un?)fortunately, you are wrong. "

                    Awesome! You mean to say I am wrong if I am thinking NScript is like Lego's ???
                    I'm still trying to get my bearings with NinjaScript. That said... I'm like a Kid in a Candy store with the possibilities!
                    OnBarUpdate and OnMarketData (Advanced for bid/ask/last and other stuff)) are part of the the main event loops.



                    There are some other callbacks to other things, OnPositionUpdate, etc.

                    Comment


                      #25
                      @koganam - I've been working my way though the manual but I just had this question about datasets in the back of my mind...

                      Comment


                        #26
                        @sledge - Yes! OnMarketData() looks like it might do the trick.

                        Comment


                          #27
                          Originally posted by RobVig View Post
                          @sledge - Yes! OnMarketData() looks like it might do the trick.

                          https://ninjatrader.com/support/help...marketdata.htm
                          There are many ways to go:
                          • OnMarketData()
                          • OnBarUpdate() with CalculateOnBarClose = false
                          • A BarSeries with 1-tick granularity.

                          come immediately to mind.

                          Comment


                            #28
                            Thanks koganam!!! I really appreciate your input.
                            Last edited by RobVig; 05-06-2016, 09:41 AM.

                            Comment

                            Latest Posts

                            Collapse

                            Topics Statistics Last Post
                            Started by sidlercom80, 10-28-2023, 08:49 AM
                            170 responses
                            2,270 views
                            0 likes
                            Last Post sidlercom80  
                            Started by Irukandji, Yesterday, 02:53 AM
                            2 responses
                            17 views
                            0 likes
                            Last Post Irukandji  
                            Started by adeelshahzad, Today, 03:54 AM
                            0 responses
                            3 views
                            0 likes
                            Last Post adeelshahzad  
                            Started by CortexZenUSA, Today, 12:53 AM
                            0 responses
                            3 views
                            0 likes
                            Last Post CortexZenUSA  
                            Started by CortexZenUSA, Today, 12:46 AM
                            0 responses
                            1 view
                            0 likes
                            Last Post CortexZenUSA  
                            Working...
                            X