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
Strategy - Sending Too Many Multiple Emails because of multiple buy signals
Collapse
X
-
Strategy - Sending Too Many Multiple Emails because of multiple buy signals
Currently have a strategy that I am running which is NOT calculated on the close of a bar. The strategy is working perfect however it is sending too many buy signals and email notifications. I just need it to send ONE email notification when a buy signal is reached. And one email notification after it closes. Is there anyway to program the strategy where the next buy signal can not be given until the previous trade closes?Tags: None
-
Hello seahawk13,
Thanks for your reply.
You would need to add conditions to your entry conditions that prevent you from placing the orders until you are flat. You would use a combination of bool logic to accomplish this. One bool condition to check would be the MarketPosition. You can be either long, short or flat and this you can test against. In addition you would use bools that you create and set based on the conditions, for example use a bool called doitonce that you would initialize to true and then set false and true as needed.
For example:
if (your conditions for entry && Position.MarketPosition == MarketPosition.Flat && doitonce)
{
// entry logic here
// send mail here
doitonce = false; // set to false to prevent re-entry of this block before Position is updated
}
Later in your code you would need to reset doitonce = true; when you wish to again place an order.
Another method to consider is BarsSinceExit().
References:
http://ninjatrader.com/support/helpG...ssinceexit.htm
http://ninjatrader.com/support/helpG...etposition.htmPaul H.NinjaTrader Customer Service
Latest Posts
Collapse
Topics | Statistics | Last Post | ||
---|---|---|---|---|
Started by benmarkal, Yesterday, 12:52 PM
|
3 responses
22 views
0 likes
|
Last Post Today, 05:22 AM | ||
Started by helpwanted, Today, 03:06 AM
|
1 response
16 views
0 likes
|
Last Post Today, 03:35 AM | ||
Started by Brevo, Today, 01:45 AM
|
0 responses
11 views
0 likes
|
Last Post
by Brevo
Today, 01:45 AM
|
||
Started by aussugardefender, Today, 01:07 AM
|
0 responses
6 views
0 likes
|
Last Post Today, 01:07 AM | ||
Started by pvincent, 06-23-2022, 12:53 PM
|
14 responses
244 views
0 likes
|
Last Post
by Nyman
Today, 12:47 AM
|
Comment