![]() |
|
|||||||
| Strategy Development Support for the development of custom automated trading strategies using NinjaScript. |
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Junior Member
Join Date: Jul 2012
Posts: 2
Thanks: 0
Thanked 0 times in 0 posts
|
Hi guys,
I am constructing a strategy based on my trading PnL. Do you have any idea on how to code it in NinjaTrader? I would like to know the number of my last recent five trades' win/loss. And to make that number as another indicator to trade in the future. I've tried to use performance class. But it is cumulatively calculated, which means if I did not trade in last few bars, it still gives me a positive/negative profit. Do you have any idea on how to calculating the real profit each trade gives me? Thanks! |
|
|
|
|
|
#2 |
|
NinjaTrader Customer Service
Join Date: Aug 2011
Location: Denver, CO, USA
Posts: 2,895
Thanks: 241
Thanked 375 times in 365 posts
|
figoliuxi,
Welcome to the forum! You could keep track of this yourself in some sort of data structure or the built in data series. In other words, when you detect an order has closed calculate PnL and store it somewhere.
Adam P.
NinjaTrader Customer Service |
|
|
|
|
|
#3 |
|
Junior Member
Join Date: Jul 2012
Posts: 2
Thanks: 0
Thanked 0 times in 0 posts
|
Thanks AdamP.
Yeah, I agree with your opinion. But can you show me some sample codes/or method in NinjaTrader on calculate each trade's PnL and store it in a data series. The performance method seems give me cumulative PnL. Is there a way to reset the PnL to 0 each time I store a value? Thanks |
|
|
|
|
|
#4 |
|
NinjaTrader Customer Service
Join Date: Dec 2011
Location: India
Posts: 3,286
Thanks: 580
Thanked 546 times in 541 posts
|
Hello figoliuxi,
You can use the trade collection to get the PnL of the trades. Please refer here to know more http://www.ninjatrader.com/support/h...collection.htm http://www.ninjatrader.com/support/h...?gettrades.htm
Joydeep M.
NinjaTrader Customer Service |
|
|
|
![]() |
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Strategy PNL | SMuhr | Strategy Development | 8 | 02-20-2012 02:08 PM |
| trades outside time range and outside PNL range | SammyC | Strategy Analyzer | 1 | 02-02-2011 06:29 AM |
| Help: Bar height depends on bar width? | motownlucas | Charting | 8 | 01-11-2011 08:23 AM |
| Multi-instrument strategy PnL | jp_kettunen | Miscellaneous Support | 5 | 03-18-2010 09:46 AM |
| Backtesting w/ PnL Strategy Halt | insomniac | Strategy Development | 3 | 03-31-2008 12:04 PM |