if (...) { _____; _____; }
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
Email for order pending/fill/target/stop
Collapse
X
-
Originally posted by NinjaTrader_Josh View PostThis is a basic C# concept. The sample is correct because it is only doing one line of code for the if-statement. If you want to do multiple lines of code you need to use brackets.
Code:if (...) { _____; _____; }
Over and over again, Josh thx.
Comment
-
Originally posted by NinjaTrader_Bertrand View PostYou would need to work with IOrder objects for this, here's a sample demonstrating this - http://www.ninjatrader-support2.com/...ead.php?t=7499
I don't see anything in there that looks for Target1 or Stop1...
Comment
-
-
Originally posted by NinjaTrader_Josh View PostCorrect. That will be the method.
Just trying to print to the output window but it doesn't work:
// Print out some information about the target to the output window
string[,] orders = GetAtmStrategyStopTargetOrderStatus("TARGET1", "idValue");
// Check length to ensure that returned array holds order information
if (orders.Length > 0)
{
for (int i = 0; i < orders.GetLength(0) - 1; i++)
{
Print("Average fill price is " + orders[i, 0].ToString());
Print("Filled amount is " + orders[i, 1].ToString());
Print("Current state is " + orders[i, 2].ToString());
}
}
Comment
-
-
-
Changed it similar structure to the GetAtmStrategyEntryOrderStatus in the SampleAtmStrat:
// Check for a pending entry order
if (atmStrategyId.Length > 0)
{
string[,] orders = GetAtmStrategyStopTargetOrderStatus("Target1", atmStrategyId);
// Check length to ensure that returned array holds order information
if (orders.Length > 0)
{
for (int i = 0; i < orders.GetLength(0) - 1; i++)
{
Print("Average fill price is " + orders[i, 0].ToString());
Print("Filled amount is " + orders[i, 1].ToString());
Print("Current state is " + orders[i, 2].ToString());
SendMail("[email protected]", "[email protected]", "status", orders[i, 2].ToString());
}
}
}
In the log highlighted in yellow it says:
GetAtmStrategyStopTargetOrderStatus() method error: OrderName 'Target1' does not exist
I assumed since my ATM Strategy that is called has 2 targets it would automatically have Target1/Target2/Stop1/Stop2.
Comment
-
Latest Posts
Collapse
Topics | Statistics | Last Post | ||
---|---|---|---|---|
Started by geotrades1, Today, 10:02 AM
|
1 response
4 views
0 likes
|
Last Post Today, 10:19 AM | ||
Started by ender_wiggum, Today, 09:50 AM
|
1 response
5 views
0 likes
|
Last Post Today, 10:10 AM | ||
Started by rajendrasubedi2023, Today, 09:50 AM
|
1 response
12 views
0 likes
|
Last Post Today, 10:05 AM | ||
Started by bmartz, Today, 09:30 AM
|
1 response
9 views
0 likes
|
Last Post Today, 09:48 AM | ||
Started by geddyisodin, Today, 05:20 AM
|
3 responses
26 views
0 likes
|
Last Post Today, 09:36 AM |
Comment