Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

strategy runtime context

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

    strategy runtime context

    Hello all,

    I have a strategy that uses the following objects for its logic.

    Position.MarketPosition
    Performance.AllTrades
    Position.GetProfitLoss
    Performance.RealtimeTrades.TradesPerformance.Curre ncy.CumProfit

    I am running two instances of the strategy in parallel - each with different parameters.
    My question is about the context of the Position and Peformance objects. Are they for the strategy I am running?

    For example, will Position.MarketPosition return the current position of the current instance of the strategy or the overall account position?

    Onn

    #2
    Hello onnb1,

    Thanks for your note.

    Both the Position and Performance classes will reference the strategy only and not the full account.

    Below is a link to Position in the help guide.
    http://www.ninjatrader.com/support/h...7/position.htm

    Also, here is a link to Performance in the help guide.
    http://www.ninjatrader.com/support/h...erformance.htm


    Accessing the entire account position is unsupported, but would be done like:
    Code:
    	// set account position handle to myPosition
    	Cbi.Position myPosition = Account.Positions.FindByInstrument(Instrument);
    			
    	// will only print if there is a position
    	if (myPosition == null)
    		return;
    				
    	// print position and quantity to output window
    	Print
    	(
    		myPosition.MarketPosition.ToString()
    		+ " | " + myPosition.Quantity.ToString()
    	);

    Please let me know if this does not resolve your inquiry.
    Chelsea B.NinjaTrader Customer Service

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by charlesugo_1, 05-26-2026, 05:03 PM
    0 responses
    59 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