NinjaTrader Support Forum  
X

Attention!

This website will be down for maintenance from Friday May 24th at 6PM MDT until Saturday May 25th at 11AM MDT. We apologize for the inconvenience. If you need assistance during this time, please email sales@ninjatrader.com


Go Back   NinjaTrader Support Forum > Application Technical Support > Automated Trading

Automated Trading Support for automated trading systems using NinjaScript. Support for our ATI (Automated Trading Interface) used to link an external application such as TradeStation and eSignal to NinjaTrader.

Reply
 
Thread Tools Display Modes
Old 05-31-2012, 12:26 PM   #1
billr
Senior Member
 
Join Date: Apr 2010
Location: San Antonio, Texas
Posts: 315
Thanks: 31
Thanked 2 times in 2 posts
Default How to set total profit/loss targets for strategy?

I would like to set a total profit target and loss target for an automated strategy. Does the "Wizard>Strategy Action> profit target total position or stop loss total position" calculate based on the total trades since strategy is enabled? If so, does it reset once the strategy is disabled/enabled?
billr is offline  
Reply With Quote
Old 05-31-2012, 12:49 PM   #2
NinjaTrader_Brett
NinjaTrader Customer Service
 
NinjaTrader_Brett's Avatar
 
Join Date: Dec 2009
Location: Denver, CO, USA
Posts: 6,498
Thanks: 109
Thanked 291 times in 280 posts
Default

Hello,

Thanks for the forum post.

It works off the QTY used in your EnterLong() or EnterShort() entry commands and also what ends up getting filled(Will protect a half filled position once it fills). When you are turning on a strategy it uses the strategy historical position from a fresh start to isolate where it stops should be and if they are already there it will overwrite the stops that are currently there if you just do a basic disable->enable action as there is some strategy persistence from disable state to enable state.

The biggest thing is making sure your strategy and accounta re in sync when you enable the strategy.

Strategy Position vs. Account Position:
http://www.ninjatrader-support2.com/...ead.php?t=4033
NinjaTrader_Brett is offline  
Reply With Quote
Old 05-31-2012, 03:58 PM   #3
billr
Senior Member
 
Join Date: Apr 2010
Location: San Antonio, Texas
Posts: 315
Thanks: 31
Thanked 2 times in 2 posts
Default

Thanks Brett, but I think I misunderstood what 'total position' was referring to. What I really want to do is put a strategy trading session stop loss and profit target in effect. * And before I go further, I want to clarify what I mean by "trading session". I don't mean daily limits. I might want to have a strategy run in the morning, turn it off during lunch and then start it again in the afternoon. That would be two "strategy trading sessions'. So I don't want the profit target/stop loss tied to the daily P&L for the account. I want to keep a sub-P&L that tracks the actual trades from when the strategy is enabled to current live trading of a strategy each time.

Attached is an example of what I was thinking of using the Wizard.
DailyPLtrigger.PNG

Here I am attempting to check the cumulative profits of all trades since the strategy was started and check to see if the PT has been met or exceeded. In this case, if true, I would change the Variable0 which would stop the strategy from trading.

Same scenario for the stoploss. It would check for a total loss and if Cumulative p&l was <= some amount, it would change the Variable0 which would stop the strategy from trading.

If my logic makes sense, I also wanted check to see if I did it correctly. I have the cumulative trades set to currency and compare it against the integer 500. Will this trigger as true if cumulative profits are $500+ the way it is written? If so, can I simply insert -300 for purposes of checking a $300 stop trading loss limit?

Finally, as you see I have inserted a condition that I would like this calculation to occur each time the strategy position went flat. I did this because I don't want this to act as a stop per se and interfere with the strategy trade management. However, I see a problem if the cumulative limit is met in either direction, but the trade is reversed by a trade signal in the opposite direction instead of closed due to trade management.

Thanks.
Last edited by billr; 05-31-2012 at 04:02 PM.
billr is offline  
Reply With Quote
Old 06-01-2012, 08:02 AM   #4
NinjaTrader_Brett
NinjaTrader Customer Service
 
NinjaTrader_Brett's Avatar
 
Join Date: Dec 2009
Location: Denver, CO, USA
Posts: 6,498
Thanks: 109
Thanked 291 times in 280 posts
Default

Hello,

Yes you should not run into any issue doing what you describe. You may also want to consider not disabling the strategy and leaving it enabled but just putting a time filter in.

http://www.ninjatrader.com/support/f...ead.php?t=3226

-Brett
NinjaTrader_Brett 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
I need two different stop loss/profit targets on the same strategy olingerc Automated Trading 7 05-06-2011 06:02 AM
profit and total loss of the day onurbbruno General Programming 3 04-05-2011 10:09 AM
How to set 2 or more profit targets? tjendra Automated Trading 47 03-01-2010 10:18 AM
Stop loss / Profit targets raycam Automated Trading 2 02-27-2009 11:08 AM
How to set up profit and loss targets Owlman Strategy Development 4 12-14-2008 05:25 AM


All times are GMT -6. The time now is 01:14 AM.