Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

GetCurrentAsk() in Initialize() ?

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

    GetCurrentAsk() in Initialize() ?

    Hello Ninja team,

    is there a possiblity to get the current Ask price of an Instrument from with the Initialize() function?

    I am interest in this because I want to set proposed Properties for the strategy based on the current ask price.
    I know I can get all this once the strategy is started and calls to OnBarUpdate() and OnMarketData() are processed.

    But I would like to have this information at an earlier stage, already in Initialize().

    Technically I would assume this is possible. Because I need just the current value of the Ask price and I do not need bar Series etc.

    And since a strategy can only be added when a MarketData connection is on the information must be available.

    Any hints there, maybe somewhere hidden in the Connection?


    Best regards
    Andreas

    #2
    my gosh,

    NinjaTrader is so powerful! Already resolved:

    Strategy S= this as Strategy;


    MarketDataDictionary d=S.Account.Connection.MarketDataStreams;
    MarketDataEventArgs mdea =d[S.Instrument].Last;

    double currentprice=mdea.price;



    Comment


      #3
      Note: API features outside of documented NinjaScript
      a) might change without notice and thus break your code
      b) could cause issues on NT if not executed properly

      Thus, we are unable to provide any support on issues which might be caused from using undocumented features.

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by charlesugo_1, 05-26-2026, 05:03 PM
      0 responses
      57 views
      0 likes
      Last Post charlesugo_1  
      Started by DannyP96, 05-18-2026, 02:38 PM
      1 response
      143 views
      0 likes
      Last Post NinjaTrader_ChelseaB  
      Started by CarlTrading, 05-11-2026, 05:56 AM
      0 responses
      161 views
      0 likes
      Last Post CarlTrading  
      Started by CarlTrading, 05-10-2026, 08:12 PM
      0 responses
      97 views
      0 likes
      Last Post CarlTrading  
      Started by Hwop38, 05-04-2026, 07:02 PM
      0 responses
      276 views
      0 likes
      Last Post Hwop38
      by Hwop38
       
      Working...
      X