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 Geovanny Suaza, 02-11-2026, 06:32 PM
      0 responses
      558 views
      0 likes
      Last Post Geovanny Suaza  
      Started by Geovanny Suaza, 02-11-2026, 05:51 PM
      0 responses
      324 views
      1 like
      Last Post Geovanny Suaza  
      Started by Mindset, 02-09-2026, 11:44 AM
      0 responses
      101 views
      0 likes
      Last Post Mindset
      by Mindset
       
      Started by Geovanny Suaza, 02-02-2026, 12:30 PM
      0 responses
      545 views
      1 like
      Last Post Geovanny Suaza  
      Started by RFrosty, 01-28-2026, 06:49 PM
      0 responses
      547 views
      1 like
      Last Post RFrosty
      by RFrosty
       
      Working...
      X