NinjaTrader Support Forum  

Go Back   NinjaTrader Support Forum > NinjaScript Development Support > General Programming

General Programming General NinjaScript programming questions.

Reply
 
Thread Tools Display Modes
Old 01-06-2008, 08:48 AM   #1
whitmark
Certified NinjaScript Consultant
 
Join Date: Nov 2005
Location: Virginia, USA
Posts: 441
Thanks: 0
Thanked 12 times in 7 posts
Send a message via Skype™ to whitmark
Default Performance Object and Atm Strategies

I routinely get requests for assistance by discretionary traders who have been turned on to the utility and full functionality of Atm strategies including intrabar position management but are looking to automate their entries by using NinjaScript. They realize the limitations of backtesting for their type of strategy and choose to forward test their strategies using Market Replay or in realtime using a sim account so there is no need for historical processing. They also want the flexibility to modify the Atm settings independantly from the strategy parameter settings.

Using the Performance object is useful to monitor overall trade performance of a strategy, in particular for halting trading in the event a maximum profit or loss is triggered. This works well for orders submitted directly from Ninja Script but it does not track performance of Atm strategy positions that are created by a NinjaScript strategy. Sure, there are the following methods to track individual Atm performance:
  • GetAtmStrategyUnrealizedProfitLoss(string AtmStrategyId)
  • GetAtmStrategyRealizedProfitLoss(string AtmStrategyId)
but no overall method or metric to query to get the total sum of all Atm positions. For strategies that use multiple Atm strategies to scale into a position, this can be arduous task of keeping track of multiple AtmStrategyIds and their market position if you simply want to know the overall PnL at any given time for the NinjaScript strategy. As an alternative, it would be useful to be able to directly query the PnL of an account regardless if the orders where submitted as Atm or non-Atm orders. For example, it would be most useful if the ATI function RealizedPnL(string Account) that is available to external platforms and works for Atm and non-Atm orders could be made available as a GetRealizedPnl() for execution from within NinjaScript.

Given the continued strong interest in bringing Atm functinality within NinjaScript despite the availablility of more advanced approaches, it would be most useful to have the overall PnL tracking capability for Atm orders be at parity with those methods already available for ATI orders and Ninja Script non-Atm orders.

Comments (including alternative workarounds) by Ninja Support or other users are most welcome. Thanks for listening.

Whitmark
whitmark is offline  
Reply With Quote
Old 01-06-2008, 12:12 PM   #2
NinjaTrader_Josh
NinjaTrader Product Manager
 
NinjaTrader_Josh's Avatar
 
Join Date: May 2007
Location: Denver, CO
Posts: 17,458
Thanks: 1
Thanked 106 times in 70 posts
Default

As always, thanks for the suggestion whitmark. I will think about potential workarounds after I get packed and move back to school. Winter break is over .
NinjaTrader_Josh is offline  
Reply With Quote
Old 01-07-2008, 08:32 AM   #3
whitmark
Certified NinjaScript Consultant
 
Join Date: Nov 2005
Location: Virginia, USA
Posts: 441
Thanks: 0
Thanked 12 times in 7 posts
Send a message via Skype™ to whitmark
Default ATI Methods for use with NinjaScript placed ATMs

Thanks Josh,

I'll be the first to admit that I have been spoiled by the use of the following ATI commands that make it easy to query Account Market Position, Realized PnL, and other values that are not yet available when using Atms within a NinjaScript Strategy.

MarketPosition(string account)
RealizedPnL(string account)
BuyingPower(string account)
CashValue(string account)

If you are coming from another platform where you took advantage of the ATI to offload intrabar position management by using an Atm strategy, and you now want to bring that processing entirely into NinjaScript, its important to realize that these account access methods are not supported. Of course, NinjaScript strategies that place non-Atm orders have similiar information available on an overall strategy vs account basis (e.g., Position & Performance Objects) but NinjaScript strategies placing orders with Atm strategies do not. Once again, this is only an issue when more than one Atm is used to enter a position for scaling into a position.

Currently, I am using several arrays to keep track of the AtmStrategyId, MarketPosition, RealizedPnL, and UnRealizedPnl for each individual Atm placed and summing up totals as needed . . . which IMHO is much ado to simply track the account (or strategy) market position and PnL values that are available to the DOM and Control Center.

Good luck transitioning back to school and thanks for your superb ongoing support of this forum and willingness to resolve the challenges I put forth.

Regards,

Whitmark
whitmark is offline  
Reply With Quote
Old 01-07-2008, 11:30 PM   #4
NinjaTrader_Josh
NinjaTrader Product Manager
 
NinjaTrader_Josh's Avatar
 
Join Date: May 2007
Location: Denver, CO
Posts: 17,458
Thanks: 1
Thanked 106 times in 70 posts
Default

Unfortunately I can't think of any better out-of-the-box solution for the issue. The manual tallying via array is the only way that comes to my mind as well. This will be on our list for future considerations/enhancements.
NinjaTrader_Josh is offline  
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Minor Bug: Cannot access a disposed object Pete S Miscellaneous Support 12 12-18-2008 05:00 AM
Getting draw object information SuzyG Strategy Development 3 05-22-2008 01:37 PM
Object not set to an instance of an object ATI user Historical NinjaTrader 6.5 Beta Threads 1 12-14-2007 03:35 AM
Testing for Drawing Object Mike Winfrey General Programming 5 11-21-2007 12:37 AM
Error: Object reference not set to an instance of an object. Januson Market Analyzer 1 05-18-2007 12:12 AM


All times are GMT -6. The time now is 12:07 AM.