![]() |
|
|||||||
| 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. |
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Senior Member
Join Date: Jul 2010
Posts: 415
Thanks: 1
Thanked 4 times in 4 posts
|
When scaling in at different price levels and then exiting all positions at one price, is it necessary or best to use unique entry names or is not necessary at all? Can this senario be achieved with no entry names at all?
Thanks |
|
|
|
|
|
#2 |
|
NinjaTrader Customer Service
Join Date: Sep 2008
Location: Germany
Posts: 22,569
Thanks: 262
Thanked 1,018 times in 999 posts
|
Ken, if you're not working in the unmanaged mode, you would need to use unique names.
Bertrand
NinjaTrader Customer Service |
|
|
|
|
|
#3 |
|
Senior Member
Join Date: Jul 2010
Posts: 415
Thanks: 1
Thanked 4 times in 4 posts
|
I'm using Advanced Managed Approach with Iorders. So if a Buy1 entry had a target of 4 ticks profit and then Buy2 enters 4 ticks lower, how would you put both target 4 ticks from the average price with unique entry names.
Thanks |
|
|
|
|
|
#4 |
|
NinjaTrader Customer Service
Join Date: Sep 2008
Location: Germany
Posts: 22,569
Thanks: 262
Thanked 1,018 times in 999 posts
|
Do you want to exit at 4 ticks for the combined entry price?
Bertrand
NinjaTrader Customer Service |
|
|
|
|
|
#5 |
|
Senior Member
Join Date: Jul 2010
Posts: 415
Thanks: 1
Thanked 4 times in 4 posts
|
Yes, the average (combined) of the 2 entry prices.
|
|
|
|
|
|
#6 |
|
NinjaTrader Customer Service
Join Date: Sep 2008
Location: Germany
Posts: 22,569
Thanks: 262
Thanked 1,018 times in 999 posts
|
There would be 2 ways to approach this -
a) Calculate the exit price needed from your individual executions received b) Update the target exit order after the second fill is in and your Position.AvgPrice would be updated to reflect the new average
Bertrand
NinjaTrader Customer Service |
|
|
|
|
|
#7 |
|
Senior Member
Join Date: Jul 2010
Posts: 415
Thanks: 1
Thanked 4 times in 4 posts
|
In approach b) how could you adjust the exit target of Buy1 2 ticks lower and make the Buy2 target the same as the Buy1 target with the execution of Buy2 entry being filled?
|
|
|
|
|
|
#8 |
|
NinjaTrader Customer Service
Join Date: Sep 2008
Location: Germany
Posts: 22,569
Thanks: 262
Thanked 1,018 times in 999 posts
|
You would check for the fill state of your second IOrder (so you know you're in the full position) and then you just recall the exit order method / set method with your newly calculated target values to provide the adjustment.
Bertrand
NinjaTrader Customer Service |
|
|
|
|
|
#9 |
|
Senior Member
Join Date: Jul 2010
Posts: 415
Thanks: 1
Thanked 4 times in 4 posts
|
Bertrand
Is there a way to cancel the Buy1 target and combine the 2 targets to the Buy2 exit with a quantity of 2, 4 ticks from the Position.AvgPrice? Or does it need to be handled individually: Buy1 target = Buy1 Entryprice + 2 and Buy2 target = Buy2 Entryprice + 6? Thanks
Last edited by kenb2004; 06-25-2012 at 09:46 AM.
|
|
|
|
|
|
#10 |
|
NinjaTrader Customer Service
Join Date: Sep 2008
Location: Germany
Posts: 22,569
Thanks: 262
Thanked 1,018 times in 999 posts
|
Ken, if you work with the Set methods this would not be possible, as you can't cancel them only move closer or further away. When you work with the Exit() methods you could cancel an individual exit order and submit a final exit order for example with a emtpy ("") tag so it would 'catch' all orders.
Bertrand
NinjaTrader Customer Service |
|
|
|
|
|
#11 |
|
Senior Member
Join Date: Jul 2010
Posts: 415
Thanks: 1
Thanked 4 times in 4 posts
|
Thanks, are there any sample strategies that you have that demonstrate this?
|
|
|
|
|
|
#12 |
|
NinjaTrader Customer Service
Join Date: Sep 2008
Location: Germany
Posts: 22,569
Thanks: 262
Thanked 1,018 times in 999 posts
|
Sorry Ken, not aware of any I could point you to that would use this technique, it would come down to custom coding this exit approach.
Bertrand
NinjaTrader Customer Service |
|
|
|
|
|
#13 |
|
Senior Member
Join Date: Jul 2010
Posts: 415
Thanks: 1
Thanked 4 times in 4 posts
|
So continuing with this senario, using IOrders and no Set Methods, would this way work?
protected override void OnOrderUpdate(IOrder order) { if (buy2entry != null && buy2entry == order){ if (order.OrderState == OrderState.Filled){ if (buy1target != null) CancelOrder(buy1target); buy2target = ExitLongLimit(0, true, 2, Position.AvgPrice + 4 * TickSize, "Buy_1&2_Profit", ""); } } } |
|
|
|
|
|
#14 |
|
NinjaTrader Customer Service
Join Date: Dec 2011
Location: India
Posts: 3,286
Thanks: 580
Thanked 546 times in 541 posts
|
Hello kenb2004,
Yes, it would work fine. Please let me know if I can assist you any further.
Joydeep M.
NinjaTrader Customer Service |
|
|
|
|
|
#15 |
|
Senior Member
Join Date: Jul 2010
Posts: 415
Thanks: 1
Thanked 4 times in 4 posts
|
From the code in post#13, how would you make the quantity a "catch-all" like the tag " " ?
Thanks Code:
buy2target = ExitLongLimit(0, true, 2, Position.AvgPrice + 4 * TickSize, "Buy_1&2_Profit", ""); |
|
|
|
![]() |
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Scaling in and Scaling out question regarding commissions | MicroTrends | Automated Trading | 4 | 07-04-2010 07:57 AM |
| Scaling In | rnr123 | Strategy Analyzer | 1 | 08-31-2009 07:23 AM |
| Scaling in, Scaling out by differing poritions of total account size | tooearly | Automated Trading | 6 | 08-10-2009 09:48 AM |
| Scaling In and Out | PeterBrazel | ATM Strategies (Discretionary Trading) | 1 | 06-11-2009 05:09 AM |
| Scaling | Richard Von | Suggestions And Feedback | 3 | 08-21-2007 01:44 PM |