// If the order state is terminal, reset the order id value if (status[2] == "Filled" || status[2] == "Cancelled" || status[2] == "Rejected") { orderId = string.Empty; SendMail("[email protected]", "[email protected]", "Order", status[2]); } } } // If the strategy has terminated reset the strategy id else if (atmStrategyId.Length > 0 && GetAtmStrategyMarketPosition(atmStrategyId) == Cbi.MarketPosition.Flat) [B][COLOR=Red] atmStrategyId = string.Empty;[/COLOR][/B]
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
-
Where have you commented out the variable? You should not be commenting the line in Variables region of your code, but rather the one here:
Code:Josh P.NinjaTrader Customer Service
-
I tried this, added an new print at the bottom:
if (atmStrategyId.Length > 0)
{
// Print some information about the strategy to the output window
Print("The current ATM Strategy market position is: " + GetAtmStrategyMarketPosition(atmStrategyId));
Print("The current ATM Strategy position quantity is: " + GetAtmStrategyPositionQuantity(atmStrategyId));
Print("The current ATM Strategy average price is: " + GetAtmStrategyPositionAveragePrice(atmStrategyId)) ;
Print("The current ATM Strategy Unrealized PnL is: " + GetAtmStrategyUnrealizedProfitLoss(atmStrategyId)) ;
Print("GetAtmStrategyStopTargetOrderStatus: " + GetAtmStrategyStopTargetOrderStatus("Target1", atmStrategyId));
The output window prints this:
GetAtmStrategyStopTargetOrderStatus: System.String[,]
Comment
-
Originally posted by NinjaTrader_Josh View PostWhere have you commented out the variable? You should not be commenting the line in Variables region of your code, but rather the one here:
Code:// If the order state is terminal, reset the order id value if (status[2] == "Filled" || status[2] == "Cancelled" || status[2] == "Rejected") { orderId = string.Empty; SendMail("[email protected]", "[email protected]", "Order", status[2]); } } } // If the strategy has terminated reset the strategy id else if (atmStrategyId.Length > 0 && GetAtmStrategyMarketPosition(atmStrategyId) == Cbi.MarketPosition.Flat) [B][COLOR=Red] atmStrategyId = string.Empty;[/COLOR][/B]
The current ATM Strategy market position is: Flat
The current ATM Strategy position quantity is: 0
The current ATM Strategy average price is: 0
The current ATM Strategy Unrealized PnL is: 0
GetAtmStrategyStopTargetOrderStatus: System.String[,]
Typically has this info:
The current ATM Strategy market position is: Long
The current ATM Strategy position quantity is: 10
The current ATM Strategy average price is: 936.75
The current ATM Strategy Unrealized PnL is: -625
GetAtmStrategyStopTargetOrderStatus: System.String[,]
Comment
-
m3power222,
Not following you. You need to make sure your collections are not empty. If they are empty for sure you will get no prints. You should also be checking your Control Center logs for errors.
I suggest you go back to SampleAtmStrategy and see how it works with the Output Window.Josh P.NinjaTrader Customer Service
Comment
-
Sort of got something working with this:
if (atmStrategyId.Length > 0)
SendMail("email", "email", "Target", "Realized PnL is: " + GetAtmStrategyRealizedProfitLoss(atmStrategyId).To String());
I get a email on every single bar ending. I only want a email when it's > 0 or < 0. Can it be done? Tried a few different things but got compile errors saying CS0019.
Strings cannot be compared with relational operators (<, >, <=, >=, ==, !=) to other object types. Strings can only be compared to other strings and only through the use of equality operators (==, !=).
Comment
-
m3power222, we would need to see the code that you're currently working on - also atmStrategyId.Length > 0 just checks for a valid ATM strategy id being used...so to get the status email not on every OnBarUpdate() you might want to limit with time filters to send an update for example each 30mins...BertrandNinjaTrader Customer Service
Comment
Latest Posts
Collapse
Topics | Statistics | Last Post | ||
---|---|---|---|---|
Started by Nickgiaco, 02-26-2024, 10:23 AM
|
2 responses
71 views
0 likes
|
Last Post Today, 05:12 AM | ||
Started by Johndc, Today, 04:39 AM
|
0 responses
4 views
0 likes
|
Last Post
by Johndc
Today, 04:39 AM
|
||
Started by johntraderuser2, Today, 02:34 AM
|
0 responses
9 views
0 likes
|
Last Post Today, 02:34 AM | ||
Started by IanS00, 03-27-2024, 11:24 AM
|
2 responses
13 views
0 likes
|
Last Post Today, 02:00 AM | ||
Started by Mariawilcoxi, Today, 01:32 AM
|
0 responses
5 views
0 likes
|
Last Post
by Mariawilcoxi
Today, 01:32 AM
|
Comment