program is not executing y so how to fix this .. pls help
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
OnOrderUpdate(IOrder order) doubt .??!!
Collapse
X
-
Deall, what snippet or call do you exactly use? Why don't you do the reset in OnExecution then as the fill is seen and as would be recommended in our reference samples on this topic?
The OnOrderUpdate() and OnExecution() methods are reserved for experienced programmers. Instead of using Set() methods to submit stop-loss and profit target orders, you can submit and update them manually through the use of IOrder and IExecution objects in the OnOrderUpdate() and OnExecution() methods. The OnOrderUpdate()BertrandNinjaTrader Customer Service
-
OMG ....... in my program everything fine only thing is i couldnt find the way correct way and how to reset the entryorder to null again ......... i tried the way in ur samples can pls tell em how to do exactly in the IExecution to reset entry order to null
if i do like in the way in samples or in examples in help .. program not at all executing im breaking my head for a week with this issue
Comment
-
Deall, the correct and recommended way is exactly contained in the example. Since I would not know how you now implemented it, I would just simplify the script until it works as you would expect and only then begin adding more complex parts in. When dealing with this debugging process in strategies two items can be very helpful understanding the exact event sequence seen -
1. TraceOrders - http://www.ninjatrader.com/support/f...ead.php?t=3627
2. Print statements - http://www.ninjatrader.com/support/f...ead.php?t=3418
This way you can exactly tell in which state you variables / IOrders are at any given point and see hopefully isolate the offending part.BertrandNinjaTrader Customer Service
Comment
-
see this is my iexecution part in this where n how to reset entryorder to null rather than putting some links can u spot on the issue directly
protected override void OnExecution(IExecution execution)
{
if (entryOrder != null && execution.Order != null && exitOrder == null )
{
Print("Bought price = " + execution.Price);
}
if (exitOrder != null && execution.Order != null)
{
Print("Closed@PositionAvgprice = " + execution.Price);
}
}
Comment
-
Deall, these links are posted and given purposeful abundantly in the forums as we believe it helps educating our user-base further and providing more value than 'fixing scripts'. For the reset you will spot this line in the SampleOnOrderUpdate example that is what you're after -
if (entryOrder != null && entryOrder == execution.Order)
if (execution.Order.OrderState == OrderState.Filled || execution.Order.OrderState == OrderState.PartFilled || (execution.Order.OrderState == OrderState.Cancelled && execution.Order.Filled > 0))
if (execution.Order.OrderState != OrderState.PartFilled)
entryOrder = null;BertrandNinjaTrader Customer Service
Comment
Latest Posts
Collapse
Topics | Statistics | Last Post | ||
---|---|---|---|---|
Started by bortz, 11-06-2023, 08:04 AM
|
47 responses
1,603 views
0 likes
|
Last Post
by aligator
Today, 07:22 PM
|
||
Started by jaybedreamin, Today, 05:56 PM
|
0 responses
8 views
0 likes
|
Last Post
by jaybedreamin
Today, 05:56 PM
|
||
Started by DJ888, 04-16-2024, 06:09 PM
|
6 responses
18 views
0 likes
|
Last Post
by DJ888
Today, 05:12 PM
|
||
Started by Jon17, Today, 04:33 PM
|
0 responses
4 views
0 likes
|
Last Post
by Jon17
Today, 04:33 PM
|
||
Started by Javierw.ok, Today, 04:12 PM
|
0 responses
12 views
0 likes
|
Last Post
by Javierw.ok
Today, 04:12 PM
|
Comment