![]() |
|
|||||||
| Strategy Development Support for the development of custom automated trading strategies using NinjaScript. |
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Member
|
When I initially get an order fill in a strategy, the stop and targets generated by the code below do not have OCO values. If I reload the strategy with an active position, the stop and target orders are assigned OCO values. The desired behavior I want is to not have OCO values on the orders. Any idea what is going on?
PHP Code:
|
|
|
|
|
|
#2 |
|
NinjaTrader Customer Service
Join Date: Sep 2009
Location: Denver, CO
Posts: 8,117
Thanks: 249
Thanked 418 times in 415 posts
|
Hello gregschr,
Can you clarify where you are checking OCO values for these orders? These order methods don't allow you to specify OCO values, although you may see this behavior as part of internal order handling rules. http://www.ninjatrader-support.com/H...verview36.html
Ryan M
NinjaTrader Customer Service |
|
|
|
|
|
#3 |
|
Member
|
I am seeing the OCO values on the Orders tab of the Control Panel and also in IB Trader Workstation.
I'm not trying to set or use the OCO values. Everything functions fine unless I reload the strategy with an active position. After I reload the script, T2, T3 and T4 get cancelled after T1 is hit. I don't want this behavior Thanks. |
|
|
|
|
|
#4 |
|
NinjaTrader Customer Service
Join Date: Sep 2009
Location: Denver, CO
Posts: 8,117
Thanks: 249
Thanked 418 times in 415 posts
|
gregschr,
Make sure you have Stop and Target handling here set to PerEntryExecution.
Ryan M
NinjaTrader Customer Service |
|
|
|
|
|
#5 |
|
Member
|
Ryan, I checked and handling is set to PerEntryExecution. But I am not sure it is applicable since I am not using SetStopLoss(), SetTrailStop() or SetProfitTarget(). What does this setting do with orders such as ExitLongStop and ExitLongLimit?
|
|
|
|
|
|
#6 |
|
NinjaTrader Customer Service
Join Date: Sep 2009
Location: Denver, CO
Posts: 8,117
Thanks: 249
Thanked 418 times in 415 posts
|
This property will apply to Set statements or the Exit methods. Can you let us know which version you're using?
Ryan M
NinjaTrader Customer Service |
|
|
|
|
|
#7 |
|
Member
|
I using Version 7 Beta 18
|
|
|
|
|
|
#8 |
|
NinjaTrader Customer Service
Join Date: Sep 2009
Location: Denver, CO
Posts: 8,117
Thanks: 249
Thanked 418 times in 415 posts
|
Can you attach the complete strategy file you're using or send to support@ninjatrader.com
To confirm the steps needed to see this: 1) strategy enters position 2) Reload strategy Issue is that targets at other levels are canceled when the first is hit?
Ryan M
NinjaTrader Customer Service |
|
|
|
|
|
#9 |
|
Member
|
In the process of trying to understand what was going on, I modified my test code. I now can't reproduce the problem I was having, but get another, even more bizarre problem. When a target fills, OnExecution and OnOrderUpdate do not appear to get called.
I've attached the strategy file that is doing this. I'll keep playing with this to see if I can also reproduce the orginal problem I was having. |
|
|
|
|
|
#10 |
|
Member
|
I've been able to duplicate the original problem.
In Control Center Options/Strategies tab/NinjaScript tab, select the "Immediately submit live working historical orders" radio button and uncheck "Cancel exit orders when a strategy is disabled". I also re-enabled the historical process in the prior strategy I posted. The revised strategy with historical processing enabled is attached to this post. You don't need to wait for an exit fill. Once you have an entry fill and the targets and stop orders are placed, reload the strategy and the target and stop orders are then all linked by the same OCO group. Also if one of the orders fills and then you try to reload the strategy again. All the orders are cancelled by the broker because the OCO value matches the value of a group that was already filled. I'm using IB. |
|
|
|
|
|
#11 |
|
Member
|
Back to the OnExecution Problem. I have attached 2 stategies.
SimpleEntryTest65 works correctly in both 6.5 and 7.0. Calls to OnExecution happen as expected. SimpleEntryTest only runs on 7.0 because of GridCategory used in properties. Calls to OnExecution do not happen in this version. I believe the only diff is the use of GridCategory. |
|
|
|
|
|
#12 |
|
NinjaTrader Customer Service
Join Date: Sep 2009
Location: Denver, CO
Posts: 8,117
Thanks: 249
Thanked 418 times in 415 posts
|
Thanks - I'll take a look at these items and get back to you later today.
Ryan M
NinjaTrader Customer Service |
|
|
|
|
|
#13 |
|
Member
|
This is really bizarre.... I saved the file that was not calling OnExecution with a different name (all the code is the same) and the new one works correctly.
|
|
|
|
|
|
#14 |
|
NinjaTrader Customer Service
Join Date: Sep 2009
Location: Denver, CO
Posts: 8,117
Thanks: 249
Thanked 418 times in 415 posts
|
Thanks for the update. I'm using the original name SimpleEntryTest and am seeing calls to OnExecution() here.
Ryan M
NinjaTrader Customer Service |
|
|
|
|
|
#15 |
|
Member
|
Before saving the file under a new name, I installed Beta 19 over 18 and had the same problem. I also tried deleting the NinjaTrader.Custom.dll and NinjaTrader.Custom.xml files, and recompling.
I don't know if it makes any difference, but are you running the SimpleEntryTest with IB? It almost seems like part of the strategy is cached somewhere and the cached portion is being called. This may be one of those unresolved problems that goes away and hopefully never comes up again. |
|
|
|
![]() |
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Entries being chased (unexpected) | lookOutBelow | Automated Trading | 3 | 07-21-2010 09:49 AM |
| Unexpected Order Submission | drkempus | Automated Trading | 3 | 07-18-2010 11:44 AM |
| DataSeries.ContainsValue unexpected behavior | GaryAlbers | Version 7 Beta General Questions & Bug Reports | 6 | 06-22-2010 03:11 AM |
| Behaviour unexpected | joanNT | Version 7 Beta General Questions & Bug Reports | 1 | 03-16-2010 10:07 AM |
| Workspace restore, unexpected behavior | Wessel | Historical NinjaTrader 6.5 Beta Threads | 2 | 03-12-2008 11:10 AM |