Alerts for NT7 - futures io
futures io


Alerts for NT7

Alerts features of NT7 using an indicator, like TrendLineAlertCustom in Downloads, uses an Extended Line as the trigger and the Alert, Print and Say functions to communicate the message.

The following code is necessary:

 
Code
                            foreach (IDrawObject draw in DrawObjects)
     {
        if ((
draw.Tag.StartsWith("Trend Line")||draw.Tag.StartsWith("Resistance")||draw.Tag.StartsWith("Support")) &&draw is ILine)
          {
           
ILine drawnLine = (ILinedraw;    
           if(  
drawnLine.DrawType==DrawType.ExtendedLine||drawnLine.DrawType==DrawType.Line||drawnLine.DrawType==DrawType.HorizontalLine )
            {
                 
LineName=draw.Tag;
                
currentYdrawnLine.StartY+(drawnLine.StartBarsAgo)/(-drawnLine.EndBarsAgo+drawnLine.StartBarsAgo+.0000001)*(drawnLine.EndY-drawnLine.StartY);
    
Values[].Set(currentY);
            }  
    
//Price rising above the manually drawn Trend Line        
            
if((Close[]-currentY>&&lastprice-currentY<=))
            {    
Alert("Alert", Priority.HighInstrumentName+": $"+Close[]+", Rising Above Trendline "+LineNamesoundFileR1Color.BlackColor.Lime);
                Print(&
quot;TrendLineCustom " +InstrumentName+": $"+Close[]+", Rising Above  "+LineName);
                if(!
over)Say(InstrumentName+&quotcrossing ABOVE "+LineName+"   at   "+Close[]);
                
over=true;
            }
              
    
//Price falling below the manually drawn Trend Line        
            
if((Close[]-currentY<&&lastprice-currentY>=))
            
            {    
Alert("Alert", Priority.HighInstrumentName+": $"+Close[]+", Falling Below Trendline "+LineNamesoundFileF1Color.RedColor.Yellow);
                Print(&
quot;TrendLineCustom "+  InstrumentName+": $"+Close[]+", Falling Below  "+LineName+"   at  "+Close[]);    
                if(!
under)Say(InstrumentName+&quotcrossing BELOW "+LineName+"   at  "+Close[]);
                
under=true;
            }   
          }    
    
         } 
NinjaTrader How-To's
Contributors:  Big Mike ,  ZTR 


Copyright © 2021 by futures io, s.a., Av Ricardo J. Alfaro, Century Tower, Panama, Ph: +507 833-9432 (Panama and Intl), +1 888-312-3001 (USA and Canada), 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.