Stop Loss/Target & SendMail() - futures io
futures io futures trading



Stop Loss/Target & SendMail()


Discussion in NinjaTrader

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




Welcome to futures io: the largest futures trading community on the planet, with well over 125,000 members
  • Genuine reviews from real traders, not fake reviews from stealth vendors
  • Quality education from leading professional traders
  • We are a friendly, helpful, and positive community
  • We do not tolerate rude behavior, trolling, or vendors advertising in posts
  • We are here to help, just let us know what you need
You'll need to register in order to view the content of the threads and start contributing to our community.  It's free and simple.

-- Big Mike, Site Administrator

(If you already have an account, login at the top of the page)

Closed Thread
 
Search this Thread
 

Stop Loss/Target & SendMail()

(login for full post details)
  #1 (permalink)
New York, NY
 
 
Posts: 142 since Dec 2009
Thanks: 41 given, 87 received

Hi All,

I'm trying to get my strat to email me when my stop loss or target gets filled but am not having any luck. I was hoping someone could take a look at my code and tell me what I'm missing. I'm sure it's something small. Since I'm assuming the code is pretty much the same for both, here's what I have for stop loss:

Variables
private bool stopSent = false;
private ArrayList stopLossTokens = new ArrayList();

protected override void OnBarUpdate() <---using this for breakeven/trail
SetStopLoss("Name", CalculationMode.Ticks, 12, false);

protected override void OnOrderUpdate(IOrder order)
if(order.OrderState == OrderState.PendingSubmit)
{
if(order.name == "Name")
stopLossTokens.Add(order.Token);
}

if(stopLossTokens.Contains(order.Token))
{
if(order.OrderState == OrderState.Filled && stopSent == false)
{
SendMail("", username@yahoo.com, Instrument.MasterInstrument.Name + " Name Stop Filled " + order.AvgFillPrice + ": " + lastProfit, "");
stopSent = true;
stopLossTokens.Remove(order.Token);
}
}

Anyone? Bueller?

Thanks,
Dave

P.S. As an alternative, if anyone has a working snippet they'd be willing to share, I'd be extremely grateful.


Can you help answer these questions
from other members on futures io?
NT8 indicator to simulate a Funding Evaluation where to …
NinjaTrader
Regarding Multicharts strategy trigger
MultiCharts
Help Needed: TOS Options Chain IV & IMPL MOVE Calcul …
ThinkOrSwim
Cross border fund flows / fx correlations
Treasury Notes and Bonds
ZigZag with Depth and Backstep
EasyLanguage Programming
 
 
(login for full post details)
  #3 (permalink)
Site Administrator
Swing Trader
Data Scientist & DevOps
Manta, Ecuador
 
Experience: Advanced
Platform: My own custom solution
Trading: Emini Futures
 
Big Mike's Avatar
 
Posts: 49,785 since Jun 2009
Thanks: 32,314 given, 97,581 received


Why not use the existing thread that you already created?



Mike

We're here to help -- just ask

For the best trading education, watch our webinars
Searching for trading reviews? Review this list

Follow us on Twitter, YouTube, and Facebook

Support our community as an Elite Member:
https://futures.io/elite/
Follow me on Twitter Visit my futures io Trade Journal
 
(login for full post details)
  #4 (permalink)
New York, NY
 
 
Posts: 142 since Dec 2009
Thanks: 41 given, 87 received

Hey Mike,

Sorry if I caused a problem. The other thread I started was probably a little overcomplicated in hindsight so I thought I'd break it down into smaller parts. Want me to delete this one (though I'm not sure how)?

Thanks,
Dave

 
(login for full post details)
  #5 (permalink)
Site Administrator
Swing Trader
Data Scientist & DevOps
Manta, Ecuador
 
Experience: Advanced
Platform: My own custom solution
Trading: Emini Futures
 
Big Mike's Avatar
 
Posts: 49,785 since Jun 2009
Thanks: 32,314 given, 97,581 received


dsraider View Post
Hey Mike,

Sorry if I caused a problem. The other thread I started was probably a little overcomplicated in hindsight so I thought I'd break it down into smaller parts. Want me to delete this one (though I'm not sure how)?

Thanks,
Dave

I will close this thread.

It seems to me it is the same problem as before so should be on the same thread.

You should just post an update to the other thread with whatever new info and ask for more help.

Mike

We're here to help -- just ask

For the best trading education, watch our webinars
Searching for trading reviews? Review this list

Follow us on Twitter, YouTube, and Facebook

Support our community as an Elite Member:
https://futures.io/elite/
Follow me on Twitter Visit my futures io Trade Journal

Closed Thread

futures io Trading Community Platforms and Indicators NinjaTrader > Stop Loss/Target & SendMail()


Last Updated on May 30, 2010


Upcoming Webinars and Events
 

NinjaTrader Indicator Challenge!

Ongoing
 

Battlestations! Show us your trading desk - $1,500 in prizes!

March
 

Importance of Finding Your Own Way w/Adam Grimes

Elite only
 

Journal Challenge w/Jigsaw

April
     



Copyright © 2021 by futures io, s.a., Av Ricardo J. Alfaro, Century Tower, Panama, +507 833-9432, info@futures.io
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.
no new posts