//You have redundant signals because buy condition is True as long as
EMA15>EMA100; similar for Sell condition
//use either Cross (see below) OR ExRem
//added some text placement adustments for stocks and Forex
SepConst = ParamToggle("Stocks|Forex","Stocks|Forex",0);
TextAdj = Param("Text Adj",3,0,100,0.25);
SepParConst = IIf(SepConst==0,TextAdj ,0.01*TextAdj );
//BuyCond1= EMA( Close , 15 ) > EMA( Close , 100 ); original
//Buy = Buycond1 ;//original
//Sell = EMA (Close,15)<EMA(Close,100);
Buy= Cross(EMA( Close , 15 ), EMA( Close , 100 ));//added
Sell = Cross(EMA (Close,100),EMA(Close,15));//added
Plot(C,"PlotText2", colorBlack, styleLine );
Plot(EMA(C,15),"ema15", colorRed );
Plot(EMA(C,100),"ema100", colorGreen );//added
for( i = 0; i < BarCount; i++ )
{
if( Buy[i] ) PlotText( "Buy\n@" + C[ i ], i, L[ i ]*(1-SepParConst),
colorGreen );
if( Sell[i] ) PlotText( "Sell\n@" + C[ i ], i, H[ i ]*(1+SepParConst),
colorRed, colorYellow );
}
From: [email protected] [mailto:[email protected]] On Behalf
Of Noah Bender
Sent: Saturday, February 21, 2009 11:10 PM
To: [email protected]
Subject: [amibroker] question on formula for plot trade price
hello,
I am new to amibroker and am trying to figure this one out.
I have a simple formula
BuyCond1= EMA( Close , 15 ) > EMA( Close , 100 );
Buy = Buycond1 ;
Sell = EMA (Close,15)<EMA(Close,100);
I am trying to plot the trade price on the chart. so far I have this:
Plot(C,"Price", colorBlack, styleLine );
Plot(EMA(C,15),"ema", colorRed );
for( i = 0; i < BarCount; i++ )
{
if( Buy[i] ) PlotText( "Buy\n@" + C[ i ], i, L[ i ], colorGreen );
if( Sell[i] ) PlotText( "Sell\n@" + C[ i ], i, H[ i ], colorRed, colorYellow
);
WHen I apply indicator it plots the price at every point on the chart and
not just when the moving averages cross. Does anyone know why? and can show
me the formula???
It would be much appreciated.
thanks