Alert Out put In Amibroker AFL (excellent MACD)

madhavareddy1203

Well-Known Member
#1
Hi guy,

can any one add alert out put when this programm generates buy or sell signals.

it need to generate alert message in alert output panel.
Like ex: buy signal generated in TCS. or sell signal generated in tcs.
This afl is really excellent. dont depend completely. But it giving good support to my trades.

thanks in advance.
Plz change this code and add output alert line.

or instruct me how and ehere to add output line.

Thanks again.

_SECTION_BEGIN("TSI");
r = Param( "TSI period 'R':", 7, 1, 100, 1 );
s = Param( "TSI period 'S':", 27, 1, 100, 1 );
u = Param( "TSI period 'U':", 1, 1, 100, 1 );
sig = Param( "Signal period:", 7, 1, 100, 1 );

Mtm = C - Ref ( C, -1 );
AbsMtm = abs ( Mtm );
Num_T = EMA ( EMA( EMA ( Mtm, r ), s ), u );
Den_T = EMA ( EMA( EMA ( AbsMtm, r ), s ), u);

TSI = 100 * Nz ( Num_T / Den_T );
TSIL = 100 * Nz ( Num_T / Den_T );

//Green TSIL Line=Rising; Red TSIL Line=Falling
col = IIf( TSIL > Ref( TSIL, -1 ), colorGreen, colorRed );
Plot( TSIL, "TSI("+r+","+s+","+u+")", col, styleLine | styleThick);
//Green EMA TSI,sig Line=Rising; Red EMA TSI,sig Line=Falling
col = IIf( EMA(TSI,sig) > Ref( EMA(TSI,sig), -1 ), colorGreen, colorRed );
Plot( EMA(TSI,sig), "", col, styleThick);
Histcol= IIf(TSI>0,colorLime,colorRed) ;
Plot( TSI, "", histcol, ParamStyle("Histogram style", styleThick |
styleHistogram | styleNoLabel, maskHistogram ) );
Plot(0,"",ParamColor( "ColorZero", colorBrown ),styleLine);

//Title = "TSI";
_SECTION_END();
//xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

//FORMULE
Cuptop1= C>BBandTop( C,20,1 ) ;
top1up= BBandTop( C,20,1 )>=Ref(BBandTop( C,20,1 ),-1) ;
top2up= BBandTop( C,20,2 )>=Ref(BBandTop( C,20,2 ),-1) ;
MACDup= MACD()>Signal() ;
Hist= MACD()-Signal() ;
Histup= Hist>Ref(Hist,-1) ;
stochup= StochK()>StochD() ;
stoch80= StochK()<80 ;
MFIup= MFI()>EMA(MFI(),5) AND MFI()>20 ;
ma10up= MA(C,10)>=Ref(MA(C,10),-1) ;
ma20up= MA(C,20)>=Ref(MA(C,20),-1) ;
EMA50up= EMA(C,50)>=Ref(EMA(C,50),-1) ;
Cupma10= C>MA(C,10) ;
Cupma20= C>MA(C,20) ;
cupema50= C>EMA(C,50) ;
Vup50= V>50000 ;
CCIup0= CCI()>0 ;
Cupo= C>O ;
//xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

mybuy= TSIL > Ref( TSIL, -1 ) AND EMA(TSI,sig) > Ref( EMA(TSI,sig), -1 ) AND TSIL>EMA(TSI,sig) AND
macdup AND ema50up AND mfiup ;
mysell= TSIL < Ref( TSIL, -1 ) AND EMA(TSI,sig) < Ref( EMA(TSI,sig), -1 ) AND TSIL<EMA(TSI,sig) ;

Buy = ExRem(myBuy, mysell);
Sell = ExRem(mysell, myBuy);

PlotShapes(IIf(Buy,shapeUpArrow,shapeNone),colorBlue,0);
PlotShapes(IIf(Sell,shapeDownArrow,shapeNone),colorRed,0);
 

johnnypareek

Well-Known Member
#3
HTML:
_SECTION_BEGIN("TSI");
r = Param( "TSI period 'R':", 7, 1, 100, 1 );
s = Param( "TSI period 'S':", 27, 1, 100, 1 );
u = Param( "TSI period 'U':", 1, 1, 100, 1 );
sig = Param( "Signal period:", 7, 1, 100, 1 );

Mtm = C - Ref ( C, -1 );
AbsMtm = abs ( Mtm );
Num_T = EMA ( EMA( EMA ( Mtm, r ), s ), u );
Den_T = EMA ( EMA( EMA ( AbsMtm, r ), s ), u);

TSI = 100 * Nz ( Num_T / Den_T );
TSIL = 100 * Nz ( Num_T / Den_T );

//Green TSIL Line=Rising; Red TSIL Line=Falling
col = IIf( TSIL > Ref( TSIL, -1 ), colorGreen, colorRed );
Plot( TSIL, "TSI("+r+","+s+","+u+")", col, styleLine | styleThick);
//Green EMA TSI,sig Line=Rising; Red EMA TSI,sig Line=Falling
col = IIf( EMA(TSI,sig) > Ref( EMA(TSI,sig), -1 ), colorGreen, colorRed );
Plot( EMA(TSI,sig), "", col, styleThick);
Histcol= IIf(TSI>0,colorLime,colorRed) ;
Plot( TSI, "", histcol, ParamStyle("Histogram style", styleThick |
styleHistogram | styleNoLabel, maskHistogram ) );
Plot(0,"",ParamColor( "ColorZero", colorBrown ),styleLine);

//Title = "TSI";
_SECTION_END();
//xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

//FORMULE
Cuptop1= C>BBandTop( C,20,1 ) ;
top1up= BBandTop( C,20,1 )>=Ref(BBandTop( C,20,1 ),-1) ;
top2up= BBandTop( C,20,2 )>=Ref(BBandTop( C,20,2 ),-1) ;
MACDup= MACD()>Signal() ;
Hist= MACD()-Signal() ;
Histup= Hist>Ref(Hist,-1) ;
stochup= StochK()>StochD() ;
stoch80= StochK()<80 ;
MFIup= MFI()>EMA(MFI(),5) AND MFI()>20 ;
ma10up= MA(C,10)>=Ref(MA(C,10),-1) ;
ma20up= MA(C,20)>=Ref(MA(C,20),-1) ;
EMA50up= EMA(C,50)>=Ref(EMA(C,50),-1) ;
Cupma10= C>MA(C,10) ;
Cupma20= C>MA(C,20) ;
cupema50= C>EMA(C,50) ;
Vup50= V>50000 ;
CCIup0= CCI()>0 ;
Cupo= C>O ;
//xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

mybuy= TSIL > Ref( TSIL, -1 ) AND EMA(TSI,sig) > Ref( EMA(TSI,sig), -1 ) AND TSIL>EMA(TSI,sig) AND
macdup AND ema50up AND mfiup ;
mysell= TSIL < Ref( TSIL, -1 ) AND EMA(TSI,sig) < Ref( EMA(TSI,sig), -1 ) AND TSIL<EMA(TSI,sig) ;

Buy = ExRem(myBuy, mysell);
Sell = ExRem(mysell, myBuy);
AlertIf( Buy, "", "BUY @ " + C, 1 );
AlertIf( Sell, "", "SELL @ " + C, 2 );

PlotShapes(IIf(Buy,shapeUpArrow,shapeNone),colorBlue,0);
PlotShapes(IIf(Sell,shapeDownArrow,shapeNone),colorRed,0);

hope this will solve ur problem.

johnnypareek @ yahoo .com
 

madhavareddy1203

Well-Known Member
#5
But... Im facing some problems here...

1. Why it generating more alert outputs for one signal. When buy signal coming that time it generating nearly 10 alerts for one stocks.

2. How to handle Multiple stocks? it generating outputs only for selected stock in Amibroker. At a time i have opened multiple stocks in different windows. but it giving alert only for active page stock.

3. Why this programm not generating buy/sell signals for Nifty??

Plz help me.

Thanks once again johney bhai.
 

madhavareddy1203

Well-Known Member
#6
Im using explorer option to track multiple stocks. Its working GR8.. thanks guys..

but why this programm not generating buy sell signals for NIFTY..

plz check once.

Im using this MACD combinatio with other AFLs.. excellent results.
 

johnnypareek

Well-Known Member
#10
But... Im facing some problems here...

1. Why it generating more alert outputs for one signal. When buy signal coming that time it generating nearly 10 alerts for one stocks.

2. How to handle Multiple stocks? it generating outputs only for selected stock in Amibroker. At a time i have opened multiple stocks in different windows. but it giving alert only for active page stock.

3. Why this programm not generating buy/sell signals for Nifty??

Plz help me.

Thanks once again johney bhai.
HTML:
_SECTION_BEGIN("TSI");
r = Param( "TSI period 'R':", 7, 1, 100, 1 );
s = Param( "TSI period 'S':", 27, 1, 100, 1 );
u = Param( "TSI period 'U':", 1, 1, 100, 1 );
sig = Param( "Signal period:", 7, 1, 100, 1 );

Mtm = C - Ref ( C, -1 );
AbsMtm = abs ( Mtm );
Num_T = EMA ( EMA( EMA ( Mtm, r ), s ), u );
Den_T = EMA ( EMA( EMA ( AbsMtm, r ), s ), u);

TSI = 100 * Nz ( Num_T / Den_T );
TSIL = 100 * Nz ( Num_T / Den_T );

//Green TSIL Line=Rising; Red TSIL Line=Falling
col = IIf( TSIL > Ref( TSIL, -1 ), colorGreen, colorRed );
Plot( TSIL, "TSI("+r+","+s+","+u+")", col, styleLine | styleThick);
//Green EMA TSI,sig Line=Rising; Red EMA TSI,sig Line=Falling
col = IIf( EMA(TSI,sig) > Ref( EMA(TSI,sig), -1 ), colorGreen, colorRed );
Plot( EMA(TSI,sig), "", col, styleThick);
Histcol= IIf(TSI>0,colorLime,colorRed) ;
Plot( TSI, "", histcol, ParamStyle("Histogram style", styleThick |
styleHistogram | styleNoLabel, maskHistogram ) );
Plot(0,"",ParamColor( "ColorZero", colorBrown ),styleLine);

//Title = "TSI";
_SECTION_END();
//xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

//FORMULE
Cuptop1= C>BBandTop( C,20,1 ) ;
top1up= BBandTop( C,20,1 )>=Ref(BBandTop( C,20,1 ),-1) ;
top2up= BBandTop( C,20,2 )>=Ref(BBandTop( C,20,2 ),-1) ;
MACDup= MACD()>Signal() ;
Hist= MACD()-Signal() ;
Histup= Hist>Ref(Hist,-1) ;
stochup= StochK()>StochD() ;
stoch80= StochK()<80 ;
//MFIup= MFI()>EMA(MFI(),5) AND MFI()>20 ;
ma10up= MA(C,10)>=Ref(MA(C,10),-1) ;
ma20up= MA(C,20)>=Ref(MA(C,20),-1) ;
EMA50up= EMA(C,50)>=Ref(EMA(C,50),-1) ;
Cupma10= C>MA(C,10) ;
Cupma20= C>MA(C,20) ;
cupema50= C>EMA(C,50) ;
//Vup50= V>5000 ;
CCIup0= CCI()>0 ;
Cupo= C>O ;
//xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

mybuy= TSIL > Ref( TSIL, -1 ) AND EMA(TSI,sig) > Ref( EMA(TSI,sig), -1 ) AND TSIL>EMA(TSI,sig) AND
macdup AND ema50up;// AND mfiup ;
mysell= TSIL < Ref( TSIL, -1 ) AND EMA(TSI,sig) < Ref( EMA(TSI,sig), -1 ) AND TSIL<EMA(TSI,sig) ;

Buy = ExRem(myBuy, mysell);
Sell = ExRem(mysell, myBuy);
AlertIf( Buy, "", "BUY @ " + C, 1 );
AlertIf( Sell, "", "SELL @ " + C, 2 );

PlotShapes(IIf(Buy,shapeUpArrow,shapeNone),colorBlue,0);
PlotShapes(IIf(Sell,shapeDownArrow,shapeNone),colorRed,0);
Hi ,
Above code will generate buy/sell for spot nifty now. To get scrips trigger, open in explorer n set explore every 5 min , thus it will auto explore n result will be there . Alert will be given only to selected scrip. u have to run explorer to get sig of all script

johnny