Announcement
Collapse
Looking for a User App or Add-On built by the NinjaTrader community?
Visit NinjaTrader EcoSystem and our free User App Share!
Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less
Partner 728x90
Collapse
NinjaTrader
Pending orders from SubmitOrderUnmanaged() are not always shown in SuperDOM
Collapse
X
-
Hello localappleseed,
I have tested to reproduce following the steps that "Should work" and I have not been able to see issues where the order is not seen when it otherwise should be, because the order is not submitted. I have an AdoptAccountAware example strategy that is working in these cases, however.
Demo - https://drive.google.com/file/d/1Na3...w?usp=drivesdk
I have attached my example strategy here so you may compare on your end. Everything is working as I would expect with my example. If there is something that I am missing with the steps I took, could you clarify?
I look forward to assisting.
-
Thanks localappleseed,
I'm heading out the door for the day, but I will reply back tomorrow after testing.
Have a good rest of your day!
Leave a comment:
-
Do you mind running my code which is extremely short? I attached whole code and test steps which show both successful and failed results.
In both failed and successful cases, I selected "Adopt Account Position" in their Starting Behavior of the Strategy.Attached FilesLast edited by localappleseed; 09-24-2020, 02:43 PM.
Leave a comment:
-
Hello localappleseed,
I have not been able to reproduce these symptoms.
Do you have "Display Selected ATM strategy only" in the SuperDOM Properties and do you have an ATM strategy selected in the ATM strategy Selector when you witness this behavior?
If this is not the case, can you modify my strategy or attach an export of a barebones script and some steps I can take to quickly reproduce these symptoms? I could not reproduce with my script following your steps and I do not have your test script to reproduce. I would need an export of a reduced script and steps to investigate further.
I look forward to assisting.
Leave a comment:
-
Thank you very much Jim for your detailed answer with your proven testing. Your testing shows both buy/sell at the same time, which I can do as well. But my problem still exists.
It looks like this is related to the procedures I am using.
To make the same code even simpler, I manually bought 100 shares of IBM, so position/Strategy shows I have 100 shares. I run SubmitOrderUnmanaged to sell only (no longer using code to buy).
Procedure 1 (working)
manually bought 100 shares fromSuperDOM
verified Positions that I have 100 shares
Click "Strategies/NTMenu" -> right click to get "New Strategy" -> select "My Test" -> OK -> click "Enabled"
SuperDOM shows my order
Procedure 2 (not working)
manually bought 100 shares from SuperDOM
verified Positions that I have 100 shares
Click "New" from NT8 Menu -> chart -> select IBM and use default 24x7 for Trading hours -. Click OK
from Chart(IBM) I can see previous bought IBM 100 shares -> right click and select "Strategies" ->
select "My Test" -> select "Enabled" -> Click OK
SuperDOM doesn't show my order.
For both procedures, onOrderUpdate() show no difference, both show OrderState is changing from Submitted->Accepted -> Working.
So loading my Strategy through chart is not working, why?
Last edited by localappleseed; 09-24-2020, 08:56 AM.
Leave a comment:
-
Hello localappleseed,
Thanks for your post.
I am not seeing this behavior testing on my end. Please see the demonstration video below and attached script.
Please let me know if you see the same symptoms testing the attached strategy on your end in the same way.
You may also want to consider checking if the Sell Limit order is listed in the Orders tab of the Control Center, and if it is not (and your prints confirm the order submission method was reached) to retest with TraceOrders enabled for a hint on why the order would be ignored.
TraceOrders - https://ninjatrader.com/support/help...aceorders2.htm
We look forward to assisting.Attached Files
Leave a comment:
-
Pending orders from SubmitOrderUnmanaged() are not always shown in SuperDOM
Hi, Support,
I built a small program to test SubmitOrderUnmanaged(). If my account is flat, call SubmitOrderUnmanaged(...,OrderAction.Buy,..) to buy 100 shares of IBM stocks, if my account has positions as 100 share of IBM stocks, it calls SubmitOrderUnmanaged(...,OrderAction.Sell,..) to sell them.
When I send a limited buy order, the order can be shown in SupreDOM as my bid price is lower than market price for sometime.
But when I send a limit sell order, it doesn't shown in SuperDOM. Can you tell the reason?
My sell order price is 0.1 higher than market price, so it should be pending for some time before it is executed.
protected override void OnBarUpdate()
{
Print ("need_flat =" + need_flat);
if (need_flat)
{
Print ("Current Price = " + GetCurrentAsk());
myExit = SubmitOrderUnmanaged(0, OrderAction.Sell, OrderType.Limit, 100, GetCurrentAsk() + 0.1, 0, "", "Buying 100");
Print (" myExit ======= " + myExit); // this print shows outputs.
need_flat = false;
first_time = false;
}
Print ("first_time =" + first_time);
if (first_time)
{
myEntry = SubmitOrderUnmanaged(0, OrderAction.Buy, OrderType.Limit, 100, GetCurrentBid() - 0.1, 0, "", "Buying 100");
first_time = false;
Print (" GetCurrentBid() = " + GetCurrentBid() + "myOrder = " + myEntry);
need_flat = false;
}
}
Current Price = 123.06
myExit ======= orderId='NT-00000-338' account='Sim101' name='Buying 100' orderState=Working instrument='IBM' orderAction=Sell orderType='Limit' limitPrice=123.16 stopPrice=0 quantity=100 tif=Gtc oco='' filled=0 averageFillPrice=0 onBehalfOf='' id=-1 time='2020-09-23 15:56:10' gtd='2099-12-01' statementDate='2020-09-23'
I also added onOrderUpdate(), it shows the sell order looks normal: orderState is changing from Submitted -> Accepted -> Working
Last edited by localappleseed; 09-23-2020, 02:30 PM.Tags: None
Latest Posts
Collapse
Topics | Statistics | Last Post | ||
---|---|---|---|---|
Started by ninza33, Today, 07:16 AM
|
1 response
5 views
0 likes
|
Last Post
by ninza33
Today, 07:47 AM
|
||
Started by ellington, Today, 07:40 AM
|
0 responses
2 views
0 likes
|
Last Post
by ellington
Today, 07:40 AM
|
||
Started by Atticus20, Today, 07:27 AM
|
0 responses
7 views
0 likes
|
Last Post
by Atticus20
Today, 07:27 AM
|
||
Started by linkcou, Today, 07:01 AM
|
0 responses
7 views
0 likes
|
Last Post
by linkcou
Today, 07:01 AM
|
||
Started by brunoviveiros, 02-17-2020, 05:31 AM
|
4 responses
66 views
0 likes
|
Last Post Today, 06:25 AM |
Leave a comment: