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 (& quot ; Trend Line & quot ;)|| draw . Tag . StartsWith (& quot ; Resistance & quot ;)|| draw . Tag . StartsWith (& quot ; Support & quot ;)) & amp ;& amp ; draw is ILine ) { ILine drawnLine = ( ILine ) draw ; if( drawnLine . DrawType == DrawType . ExtendedLine || drawnLine . DrawType == DrawType . Line || drawnLine . DrawType == DrawType . HorizontalLine ) { LineName = draw . Tag ; currentY = drawnLine . 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 & gt ; & amp ;& amp ; lastprice - currentY & lt ;= )) { Alert (& quot ; Alert & quot ;, Priority . High , InstrumentName +& quot ;: $& quot ;+ Close [ ]+& quot ;, Rising Above Trendline & quot ;+ LineName , soundFileR , 1 , Color . Black , Color . Lime ); Print(& quot ; TrendLineCustom & quot ; + InstrumentName +& quot ;: $& quot ;+ Close [ ]+& quot ;, Rising Above & quot ;+ LineName ); if(! over ) Say ( InstrumentName +& quot ; crossing ABOVE & quot ;+ LineName +& quot ; at & quot ;+ Close [ ]); over = true ; } //Price falling below the manually drawn Trend Line if(( Close [ ]- currentY & lt ; & amp ;& amp ; lastprice - currentY & gt ;= )) { Alert (& quot ; Alert & quot ;, Priority . High , InstrumentName +& quot ;: $& quot ;+ Close [ ]+& quot ;, Falling Below Trendline & quot ;+ LineName , soundFileF , 1 , Color . Red , Color . Yellow ); Print(& quot ; TrendLineCustom & quot ;+ InstrumentName +& quot ;: $& quot ;+ Close [ ]+& quot ;, Falling Below & quot ;+ LineName +& quot ; at & quot ;+ Close [ ]); if(! under ) Say ( InstrumentName +& quot ; crossing BELOW & quot ;+ LineName +& quot ; at & quot ;+ Close [ ]); under = true ; } } }
NinjaTrader How-To's