![]() |
|
|||||||
| Strategy Development Support for the development of custom automated trading strategies using NinjaScript. |
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Senior Member
|
In my strategy, I have this code:
Code:
protected override void OnExecution(IExecution execution)
{
if (EntryOrder != null && EntryOrder == execution.Order)
{
if (execution.Order.OrderState == OrderState.Filled)
{
[...]
I think I got this code that checks the EntryOrder with the execution.Order from one of your samples. So how do I know that a stoploss execution is part of the original EntryOrder that was filled? Apparently I can't compare the order tokens... is there another way? Thanks! Bryan
Price-Dynamics.com
A NinjaTrader Official Partner Visit http://www.price-dynamics.com to learn more about the Rhythm Relay trading system. Yes, you can discretionary or auto-trade with 75%+ accuracy! Use our Contact Us page to request free access to our daily Trader's Lounge where you can see the system in action in a live account! |
|
|
|
|
|
#2 |
|
NinjaTrader Customer Service
Join Date: Jun 2009
Location: Denver, CO
Posts: 3,149
Thanks: 10
Thanked 90 times in 82 posts
|
Bryan, how are you setting the profit targets and stop losses? There is a reference sample that shows how to do this with all IOrders.
Austin
NinjaTrader Customer Service |
|
|
|
|
|
#3 | |
|
Senior Member
|
Quote:
Code:
protected override void OnExecution(IExecution execution)
{
/* We advise monitoring OnExecution to trigger submission of stop/target orders instead of OnOrderUpdate() since OnExecution() is called after OnOrderUpdate()
which ensures your strategy has received the execution which is used for internal signal tracking. */
if (entryOrder != null && entryOrder.Token == execution.Order.Token)
{
if (execution.Order.OrderState == OrderState.Filled || execution.Order.OrderState == OrderState.PartFilled || (execution.Order.OrderState == OrderState.Cancelled && execution.Order.Filled > 0))
{
if (entryOrder != null && entryOrder.Token == execution.Order.Token) will be false if the stoploss is hit before the profit target. Is there a parameter or something in these methods where I can get it to share the same token as the entry order has? Bryan
Price-Dynamics.com
A NinjaTrader Official Partner Visit http://www.price-dynamics.com to learn more about the Rhythm Relay trading system. Yes, you can discretionary or auto-trade with 75%+ accuracy! Use our Contact Us page to request free access to our daily Trader's Lounge where you can see the system in action in a live account! |
|
|
|
|
|
|
#4 |
|
Senior Member
|
Ural01, if you have some trouble with NT strategies, maybe you can get help here from me or others. I know it can be complicated and do things you don't expect, but there is usually a reason for the issues you're having. And the reason is seldom "NT is piece of junk." ;-) I'm sure there are many people who have used NT and been very successful with good money management, as you say.
Price-Dynamics.com
A NinjaTrader Official Partner Visit http://www.price-dynamics.com to learn more about the Rhythm Relay trading system. Yes, you can discretionary or auto-trade with 75%+ accuracy! Use our Contact Us page to request free access to our daily Trader's Lounge where you can see the system in action in a live account! |
|
|
|
|
|
#5 | |
|
Junior Member
Join Date: Mar 2010
Posts: 1
Thanks: 0
Thanked 0 times in 0 posts
|
I,m not looking for help fom you
i let nfa and cftc help you to count better ballance in chart and dom window and compare to the broket window ballance i do 80 lots every day so $20 dollars difference on every lot betwen broker price in you cost 80 x $20 = $1800 every day ? Not too match ? A do you split prifit with mbt 50x50 or just for you nt ? And how about orders that open just like boom ? I never place any orders , atm of , no pending orders how ? I,m trading every day 5 days week 18 hours a day from 80 to 150 lots a day , i,m member of nfa and cbot and never see thinks like you do with ballance and extra possitions open Quote:
|
|
|
|
|
|
|
#6 | |
|
Senior Member
|
Quote:
Good money management is key, and if you are saving $20 per lot, then that's good money management. It sounds like you're doing well with the system you have already, so I would say to keep using what works for you. Good luck! Bryan
Price-Dynamics.com
A NinjaTrader Official Partner Visit http://www.price-dynamics.com to learn more about the Rhythm Relay trading system. Yes, you can discretionary or auto-trade with 75%+ accuracy! Use our Contact Us page to request free access to our daily Trader's Lounge where you can see the system in action in a live account! |
|
|
|
|
|
|
#7 | |
|
NinjaTrader Customer Service
Join Date: Jun 2009
Location: Denver, CO
Posts: 3,149
Thanks: 10
Thanked 90 times in 82 posts
|
Quote:
Austin
NinjaTrader Customer Service |
|
|
|
|
|
|
#8 |
|
Senior Member
|
Thanks Austin, but what if I have two positions open in the same strategy? How do I know which entry a stoploss execution.order is for? If there was some variable or property I could use to tie a stoploss order to its associated entry order, that would be great. Is it maybe the fromEntrySignal parameter in the SetStopLoss method?
If that would tie the stoploss order to the entry order, then when the execution comes in for the stoploss, how do I check to see if the fromEntrySignal matches the proper entry order? Bryan
Price-Dynamics.com
A NinjaTrader Official Partner Visit http://www.price-dynamics.com to learn more about the Rhythm Relay trading system. Yes, you can discretionary or auto-trade with 75%+ accuracy! Use our Contact Us page to request free access to our daily Trader's Lounge where you can see the system in action in a live account! |
|
|
|
|
|
#9 |
|
NinjaTrader Customer Service
Join Date: Sep 2008
Location: Germany
Posts: 22,555
Thanks: 261
Thanked 1,014 times in 995 posts
|
Bryan, you should be able to check the Execution.Name property to see from which entry signal the execution comes in and then you can make changes to your stops / targets accordingly.
Bertrand
NinjaTrader Customer Service |
|
|
|
|
|
#10 | |
|
Senior Member
|
Quote:
Code:
if (execution.Name == "Profit target" || execution.Name == "Stop loss" || execution.Name == "Trail stop" || execution.Name == "Close" || execution.Name.Contains("cover") || execution.Name == "Sell")
Maybe I'm missing the obvious here -- it seems simple. Maybe I'm making it too complicated?
Price-Dynamics.com
A NinjaTrader Official Partner Visit http://www.price-dynamics.com to learn more about the Rhythm Relay trading system. Yes, you can discretionary or auto-trade with 75%+ accuracy! Use our Contact Us page to request free access to our daily Trader's Lounge where you can see the system in action in a live account! |
|
|
|
|
|
|
#11 |
|
NinjaTrader Customer Service
Join Date: Sep 2008
Location: Germany
Posts: 22,555
Thanks: 261
Thanked 1,014 times in 995 posts
|
Thanks for clarifying, I misunderstood you - you will need to work with the Exit() methods then offering native IOrder returns, those would include the FromEntrySignal property for an IOrder.
Bertrand
NinjaTrader Customer Service |
|
|
|
|
|
#12 | |
|
Senior Member
|
Quote:
Thanks! Bryan
Price-Dynamics.com
A NinjaTrader Official Partner Visit http://www.price-dynamics.com to learn more about the Rhythm Relay trading system. Yes, you can discretionary or auto-trade with 75%+ accuracy! Use our Contact Us page to request free access to our daily Trader's Lounge where you can see the system in action in a live account! |
|
|
|
|
|
|
#13 | |
|
Senior Member
Join Date: Feb 2009
Posts: 285
Thanks: 2
Thanked 54 times in 41 posts
|
in case of multiple orders just create a list (of orders). you can directly compare the orders from the list. from the help files
Quote:
Code:
List<IOrder> list = new List<IOrder>(); Code:
if (list.Contains(execution.Order))
{
//do something
}
this is really a very powerful feature. as Bertrand said its always a good idea to give the name property a unique value, like "Buy" + count.ToString(); //count is an integer |
|
|
|
|
![]() |
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Option to submit ATM stop loss order at the same time as entry order | Softturbo | Version 7 Beta General Questions & Bug Reports | 1 | 06-15-2010 04:02 AM |
| Get ID Order Number | MAX | Automated Trading | 1 | 02-09-2010 05:23 PM |
| execution.Order.Filled Vs. execution.Order.Quantity | binwang2 | General Programming | 1 | 08-04-2009 05:52 AM |
| Cancelling Order/Entry Order filled cancels all other entry orders | ScottB | ATM Strategies (Discretionary Trading) | 2 | 06-03-2009 12:19 PM |
| Why my order.StopPrice alway a Zero number? | asalada | General Programming | 1 | 03-23-2008 01:25 PM |