// 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 | ||
---|---|---|---|---|
Change colour of Stop market and limit orders to red and green via indicator script
by Rapine Heihei
Started by Rapine Heihei, 04-23-2024, 07:51 PM
|
2 responses
30 views
0 likes
|
Last Post
by Max238
Today, 02:25 AM
|
||
Started by Shansen, 08-30-2019, 10:18 PM
|
24 responses
943 views
0 likes
|
Last Post
by spwizard
Today, 01:29 AM
|
||
Started by Max238, Today, 01:28 AM
|
0 responses
9 views
0 likes
|
Last Post
by Max238
Today, 01:28 AM
|
||
Started by rocketman7, Today, 01:00 AM
|
0 responses
7 views
0 likes
|
Last Post
by rocketman7
Today, 01:00 AM
|
||
Started by wzgy0920, 04-20-2024, 06:09 PM
|
2 responses
28 views
0 likes
|
Last Post
by wzgy0920
Yesterday, 10:43 PM
|
Comment