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

Premarket GetCurrentBid() GetCurrentAsk()

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

    Premarket GetCurrentBid() GetCurrentAsk()

    [IMG]file:///C:/DOCUME%7E1/Benutzer/LOCALS%7E1/Temp/moz-screenshot.jpg[/IMG]I have a problem with the Bid/Ask prices in the premarket phase.

    I try to scan for gappers during the premarket phase. if you look at the attachment you can see, that in the marketAnalyzer is a valid Bid/AskPrice.

    If I want to get access of the bid/askPrice in an Indicator the GetCurrentBid() and GetCurrentAsk() are delivering another value like the MarketAnalyzer.

    Then I found out, that there exists a MarketData-member, where the prices are correct. But when the the indicator is used in the MarketAnalyzer the MarketData-member is null ... and the GetCurrentBid() and GetCurrentAsk() are delivering again the wrong values

    does anybody know how I could get access to the right Bid/Ask values in the MarketAnalyzer during the premarket phase?

    Many thanks for you help in advance.


    #2
    Please provide the line of code you are using for your print statement and in which method it was placed in. Thank you.
    Josh P.NinjaTrader Customer Service

    Comment


      #3
      Hi Josh

      Thank you for your quick reply ... here is the code line.

      This problem only occures in the premarket phase - if you try it during market hours the values are correct

      if ( MarketData != null )
      Print ( Instrument.MasterInstrument.Name + "; GetCurrentAsk(): " + GetCurrentAsk() + "; GetCurrentBid(): " + GetCurrentBid()
      + "; MarketData.Bid.Price: " + MarketData.Bid.Price + "; MarketData.Ask.Price: " + MarketData.Ask.Price
      + "; " + Time[0].Year + "." + Time[0].Month + "." + Time[0].Day );

      Comment


        #4
        oops .. this call happens in the OnBarUpdate()-event

        Comment


          #5
          Can you please try this inside OnMarketData and use the MarketDataEventArgs?
          Josh P.NinjaTrader Customer Service

          Comment


            #6
            OK - thank you for this hint - since the market is running now I will try it tomorow

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by Rapine Heihei, 04-23-2024, 07:51 PM
            2 responses
            30 views
            0 likes
            Last Post Max238
            by Max238
             
            Started by Shansen, 08-30-2019, 10:18 PM
            24 responses
            943 views
            0 likes
            Last Post spwizard  
            Started by Max238, Today, 01:28 AM
            0 responses
            9 views
            0 likes
            Last Post Max238
            by Max238
             
            Started by rocketman7, Today, 01:00 AM
            0 responses
            5 views
            0 likes
            Last Post rocketman7  
            Started by wzgy0920, 04-20-2024, 06:09 PM
            2 responses
            28 views
            0 likes
            Last Post wzgy0920  
            Working...
            X