• If this is your first visit, you will have to register before you can post. To view messages, please scroll below and select the forum that you would like to visits. Questions? Be sure to check out the Forum FAQ.

Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

OnBarUpdate

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

    OnBarUpdate

    The following code only executes once when I initialize the strategy. Afterwards, I get nothing. I would like to see the code Print "OBU" on each tick. What would be the reason this isn't working?

    Code:
    protectedoverridevoid Initialize()
    {
    CalculateOnBarClose = false;
    // TraceOrders = true;
    }
    ///<summary>
    /// Called on each bar update event (incoming tick)
    ///</summary>
    protectedoverridevoid OnBarUpdate()
    { 
    Print("OBU");
    if (Historical)
    return;
    }
    
    

    #2
    Any error messages in the Log tab?

    Provided that you have enough bars on your chart when you are running the strategy (make sure Min bars requires is set to 20 --> You could try setting to 1 to check) it will print. to the Output window.
    RayNinjaTrader Customer Service

    Comment


      #3
      I am getting the following error...

      "Error on calling 'OnBarUpdate' method for strategy 'MyStrategy': Object reference not set to an instance of an object."

      Comment


        #4
        Thanks, that would explain why you don't see anything. Somewhere in your strategy you have a logic error that causes this exception which terminates the strategy.

        Here is a a tip we wrote up to help guide you to resolution.

        http://www.ninjatrader-support.com/v...ead.php?t=4226
        RayNinjaTrader Customer Service

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by brian meade, Today, 01:39 PM
        1 response
        4 views
        0 likes
        Last Post NinjaTrader_PaulH  
        Started by Johnny Santiago, Today, 12:20 PM
        1 response
        5 views
        0 likes
        Last Post NinjaTrader_ChrisL  
        Started by NinjaTrader_Brandon, Today, 10:24 AM
        0 responses
        47 views
        0 likes
        Last Post NinjaTrader_Brandon  
        Started by ptertich, Today, 07:56 AM
        2 responses
        15 views
        0 likes
        Last Post Johnny Santiago  
        Started by aslane, Today, 08:24 AM
        1 response
        14 views
        0 likes
        Last Post NinjaTrader_ChrisL  
        Working...
        X