Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Accessing MarketPosition from Indicator Script

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

    Accessing MarketPosition from Indicator Script

    I am trying to create a little Indicator Script that will substitute NT's "Plot execution | TextandMarker" chart option with a Line drawn on the chart showing Trade Entry and Trade Exit. I do not auto trade so using a Strategy File may not be the answer.

    I tried using the Help File example for "MarketPosition" and get the following Error:
    Indicator\TradeTracker.cs An object reference is required for the non-static field, method, or property 'NinjaTrader.Cbi.Position.MarketPosition.get' CS0120 - click for info 53 10

    I tried using the Help File Example for "IPosition " and get the following Error:
    Indicator\htcTradeTracker.cs 'NinjaTrader.Indicator.htcTradeTracker.OnPositionU pdate(NinjaTrader.Cbi.IPosition)': no suitable method found to override CS0115 - click for info 36 25


    Are "MarketPosition" and "IPosition" only allowed in Strategy Files? If so, how can I get around this. Or what am I missing to access Trade Data from within an Indicator File? Have I missed a Using Declaration?

    Thanks.

    #2
    TAJTrades, correct, this would work in strategy context only and only relative to the individual strategy you're working with as strategies do not cross communicate.

    Accessing your discretionary added positions via NinjaScript is unfortunately not supported.

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by Hwop38, 05-04-2026, 07:02 PM
    0 responses
    169 views
    0 likes
    Last Post Hwop38
    by Hwop38
     
    Started by CaptainJack, 04-24-2026, 11:07 PM
    0 responses
    324 views
    0 likes
    Last Post CaptainJack  
    Started by Mindset, 04-21-2026, 06:46 AM
    0 responses
    250 views
    0 likes
    Last Post Mindset
    by Mindset
     
    Started by M4ndoo, 04-20-2026, 05:21 PM
    0 responses
    351 views
    0 likes
    Last Post M4ndoo
    by M4ndoo
     
    Started by M4ndoo, 04-19-2026, 05:54 PM
    0 responses
    180 views
    0 likes
    Last Post M4ndoo
    by M4ndoo
     
    Working...
    X