mention your exact rules, coding buy sell will not be difficult....
a=1;
_SECTION_BEGIN("HeikenAshiSmoothed");
GraphXSpace=5;
p=200; //DEFAULT 5 final50
Om=DEMA(O,p);
Hm=DEMA(H,p);
lm=DEMA(L,p);
Cm=DEMA(C,p);
HACLOSE=(Om+Hm+Lm+Cm)/4;
HaOpen = AMA( Ref( HaClose, 1), 1);
HaHigh = Max( Hm, Max( HaClose, HaOpen ) );
HaLow = Min( Lm, Min( HaClose, HaOpen ) );
slope = Param("slope",2,2,100,1);
Color20= IIf(LinRegSlope(MA(HaClose,a),slope)>10,colorRed,colorGreen);
Plot(MA(HaClose,a),"", color20,styleThick);// for buy
Color=IIf(Haclose>MA(HaClose,a),colorGreen, colorRed);
_SECTION_END();
//Buy=Color==colorGreen;
//Sell=Color==colorRed;
//Buy=ExRem(Buy,Sell);
//Sell=ExRem(Sell,Buy);
//PlotShapes(IIf(Buy , shapeUpArrow, shapeNone),colorGreen);
//PlotShapes(IIf(Sell, shapeDownArrow, shapeNone),colorRed);
b=1; //DEFAULT 20//CHANGED BY MOMIN//
_SECTION_BEGIN("HeikenAshiSmoothed");
GraphXSpace=5;
p=205; //DEFAULT 5 final50 //for red line
Om=DEMA(O,p);
hm=DEMA(H,p);
lm=DEMA(L,p);
Cm=DEMA(C,p);
HACLOSE=(Om+Hm+Lm+Cm)/4;
HaOpen = AMA( Ref( HaClose, 1), 1);
HaHigh = Max( Hm, Max( HaClose, HaOpen ) );
HaLow = Min( Lm, Min( HaClose, HaOpen ) );
slope = Param("slope",2,2,100,1);
Color20= IIf(LinRegSlope(MA(HaClose,b),slope)<100,colorRed,colorGreen);
Plot(MA(HaClose,b),"", color20,styleThick);//for sale
Color=IIf(Haclose>MA(HaClose,b),colorGreen, colorRed);
_SECTION_END();
Buy=Color==colorGreen;
Sell=Color==colorRed;
Buy=ExRem(Buy,Sell);
Sell=ExRem(Sell,Buy);
PlotShapes(IIf(Buy , shapeUpArrow, shapeNone),colorGreen);
PlotShapes(IIf(Sell, shapeDownArrow, shapeNone),colorRed);
//MOMIN//////////////////
_SECTION_BEGIN("Magfied Market Price");
FS=Param("Font Size",30,11,100,1);
GfxSelectFont("Times New Roman", FS, 700, True );
GfxSetBkMode( colorWhite );
GfxSetTextColor( ParamColor("Color",colorYellow) );
Hor=Param("Horizontal Position",1480,1,1800,1);
Ver=Param("Vertical Position",12,1,830,1);
GfxTextOut(""+C, Hor-690 , Ver );
YC=TimeFrameGetPrice("C",inDaily,-1);
DD=Prec(C-YC,2);
xx=Prec((DD/YC)*100,2);
GfxSelectFont("Times New Roman", 11, 700, True );
GfxSetBkMode( colorBlack );
GfxSetTextColor(ParamColor("Color",colorYellow) );
GfxTextOut(""+DD+" ("+xx+"%)", Hor-690 , Ver+45 );
/////MOMIN///////
_SECTION_BEGIN("Price");
SetChartOptions(0,chartShowArrows|chartShowDates);
_N(Title = StrFormat("{{NAME}} - {{INTERVAL}} {{DATE}} Open %g, Hi %g, Lo %g, Close %g (%.1f%%) Vol " +WriteVal( V, 1.0 ) +" {{VALUES}}", O, H, L, C, SelectedValue( ROC( C, 1 )) ));
_SECTION_END();
Buy and Sell Signal is not generating when EMA Line is crossing each other .
Please help.