• 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

If OnBarUpdate is NEVER called...

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

    If OnBarUpdate is NEVER called...

    Say I'm in a strategy, and it's thinly traded. I enter a position.

    Nothing trades.

    How do I get out with market order say in like 5 minutes since OnBarUpdate would never called?

    No bars are generated if there is no trade, right? (I've seen this before, please correct me if I am wrong).

    I've been thinking about this for a while...

    #2
    Originally posted by sledge View Post
    Say I'm in a strategy, and it's thinly traded. I enter a position.

    Nothing trades.

    How do I get out with market order say in like 5 minutes since OnBarUpdate would never called?

    No bars are generated if there is no trade, right? (I've seen this before, please correct me if I am wrong).

    I've been thinking about this for a while...
    That is why the gurus tell us not to trade thinly traded stocks!

    You just get out and take your lumps. On a thin stock you MUST buy at the ask and you will be forced to sell at the bid, thus giving up the bid/ask spread for the privilege of holding the stock for those 5 minutes. Of course, on a thin stock, the bid/ask spread is a chasm. The market makers are already licking their chops as soon as they see you log on. Oops.

    Comment


      #3
      Good point. I remember a year or so ago, when the Nasdaq Composite index went dead for the last hour of trading.

      It would be nice to have a ninjascript call to handle events not tied to market data.

      Besides OnBarUpdate() method call, there's also...

      OnFundamentalData()
      OnMarketData()
      OnMarketDepth()
      OnStartUp()
      OnTermination()

      I doubt one of those calls would help in your situation.

      Comment


        #4
        Oh, I found something in Ninjascript Library...

        TriggerCustomEvent()

        http://ninjatrader.com/support/helpG...ustomevent.htm

        Comment


          #5
          Originally posted by borland View Post
          Good point. I remember a year or so ago, when the Nasdaq Composite index went dead for the last hour of trading.

          It would be nice to have a ninjascript call to handle events not tied to market data.

          Besides OnBarUpdate() method call, there's also...

          OnFundamentalData()
          OnMarketData()
          OnMarketDepth()
          OnStartUp()
          OnTermination()

          I doubt one of those calls would help in your situation.


          I would also like to see :

          OnConnectionLost()

          This would lead to advanced Handling to Connections... which would allow me to programmatically try to reconnect to connection #1 (zenfire), #2 TDA, determine what connection is bad (both Zenfire or TDA).. is it total internet loss? (then shutdown strategy, etc).. if not, send email to myself.. etc.

          Maybe even programmatic callbacks, like if 5 minutes is up, then call my call back, so it would be an actual 5 minutes... and not related to OnBarUpdate...

          Comment


            #6
            Originally posted by borland View Post
            Oh, I found something in Ninjascript Library...

            TriggerCustomEvent()

            http://ninjatrader.com/support/helpG...ustomevent.htm
            Mmmmmmmmmm... thanks!

            Comment


              #7
              Originally posted by sledge View Post
              I would also like to see :

              OnConnectionLost()

              This would lead to advanced Handling to Connections... which would allow me to programmatically try to reconnect to connection #1 (zenfire), #2 TDA, determine what connection is bad (both Zenfire or TDA).. is it total internet loss? (then shutdown strategy, etc).. if not, send email to myself.. etc.

              Maybe even programmatic callbacks, like if 5 minutes is up, then call my call back, so it would be an actual 5 minutes... and not related to OnBarUpdate...
              It is there! Just that it is called OnConnectionStatus(). To determine if the connection is lost, you want ConnectionStatus.ConnectionLost. Tee hee.

              Comment


                #8
                You can slap me around with a wet fish.


                Originally posted by koganam View Post
                It is there! Just that it is called OnConnectionStatus(). To determine if the connection is lost, you want ConnectionStatus.ConnectionLost. Tee hee.

                Comment

                Latest Posts

                Collapse

                Topics Statistics Last Post
                Started by Emma1, Today, 02:42 PM
                1 response
                15 views
                0 likes
                Last Post NinjaTrader_DrewO  
                Started by fx.practic, Today, 03:10 PM
                1 response
                5 views
                0 likes
                Last Post NinjaTrader_Jesse  
                Started by jertrade, Today, 02:50 PM
                2 responses
                10 views
                0 likes
                Last Post jertrade  
                Started by RedDuke, Today, 01:59 PM
                1 response
                18 views
                0 likes
                Last Post NinjaTrader_Kate  
                Started by MarianApalaghiei, Today, 01:18 PM
                1 response
                15 views
                0 likes
                Last Post NinjaTrader_PatrickG  
                Working...
                X