NexusFi: Find Your Edge


Home Menu

 





need help for email alert on a target and stopLoss


Discussion in NinjaTrader

Updated
    1. trending_up 1,706 views
    2. thumb_up 1 thanks given
    3. group 2 followers
    1. forum 4 posts
    2. attach_file 1 attachments




 
Search this Thread

need help for email alert on a target and stopLoss

  #1 (permalink)
 Jacka777 
Herkimer NY US
 
Experience: Intermediate
Platform: NT7, CQG
Broker: NT
Trading: ES CL YM
Posts: 59 since Jan 2013
Thanks Given: 10
Thanks Received: 51

Hi Everyone,
how do i add a email alert to a my target and my stop loss when its triggered. i did the entery long and i get the email alert for that, but dont know how to do the other 2. \this is what i have so far. thanks all

Started this thread Reply With Quote

Can you help answer these questions
from other members on NexusFi?
New Micros: Ultra 10-Year & Ultra T-Bond -- Live Now
Treasury Notes and Bonds
Better Renko Gaps
The Elite Circle
NT7 Indicator Script Troubleshooting - Camarilla Pivots
NinjaTrader
Exit Strategy
NinjaTrader
The space time continuum and the dynamics of a financial …
Emini and Emicro Index
 
  #3 (permalink)
kandlekid
College Point, NY (Queens)
 
Posts: 63 since Nov 2009
Thanks Given: 5
Thanks Received: 20


I think you need to use the OnExecution NT function to access the executions you'll get from fireing the target and/or stop loss functions. You will probably need to set the signal name in the target and stop loss orders so that you can determine in OnExecution which execution it has gotten. You would then put your email alert code in the OnExecution function at the point where you determine which execution you've gotten.

Here is some sample code of mine (the NT manual talks about this also:

private void StopLossSet( IOrder iOrder )
{
...
iExitOrder = ExitLongStop( 0, true, DefaultQuantity, exitPrice, "LongStop", "LongEntry" );
...
}


protected override void OnExecution( IExecution iexecution )
{
...
if ( string.Compare( iexecution.Name, "LongStop" ) == 0 )
{
// do something like send alert.
}
...
}

Reply With Quote
  #4 (permalink)
 Jacka777 
Herkimer NY US
 
Experience: Intermediate
Platform: NT7, CQG
Broker: NT
Trading: ES CL YM
Posts: 59 since Jan 2013
Thanks Given: 10
Thanks Received: 51

I did what you said but i keep getting errors message. is this the ony way? and the private is for the variable yes? and the other goes under the onbarstartup too?
Thanks

Started this thread Reply With Quote
  #5 (permalink)
kandlekid
College Point, NY (Queens)
 
Posts: 63 since Nov 2009
Thanks Given: 5
Thanks Received: 20

For stop loss orders, I'm fairly certain that you need to call your code from the OnExecution function (really anytime you want to do something on a fill). The reason being that fills are somewhat asynchronous. I'm not as sure about the target, but I believe so also, because it requires something being done on a fill.

The private function was just my wrapper around the ExitLongStop function. It would be good for you to consult the NT manual pages, especially the OnExecution, EnterLongStop, EnterShortStop, etc pages.

Reply With Quote
Thanked by:




Last Updated on March 11, 2013


© 2024 NexusFi™, s.a., All Rights Reserved.
Av Ricardo J. Alfaro, Century Tower, Panama City, Panama, Ph: +507 833-9432 (Panama and Intl), +1 888-312-3001 (USA and Canada)
All information is for educational use only and is not investment advice. There is a substantial risk of loss in trading commodity futures, stocks, options and foreign exchange products. Past performance is not indicative of future results.
About Us - Contact Us - Site Rules, Acceptable Use, and Terms and Conditions - Privacy Policy - Downloads - Top
no new posts