Code:
#property copyright "Lowphat"
#property link "mystikvgv@yahoo.com"
extern int ShortEma=14;
extern int LongEma=45;
extern int ArrowDistance=7;
#property indicator_buffers 2
#property indicator_chart_window
#property indicator_color1 Blue
#property indicator_color2 Red
double ExtMapBuffer1[];
double ExtMapBuffer2[];
double Signal1,Signal2;
int init()
{
IndicatorBuffers(2);
SetIndexStyle(0,DRAW_ARROW,STYLE_SOLID,2);
SetIndexArrow(0, 234);
SetIndexBuffer(0,ExtMapBuffer1);
SetIndexStyle(1,DRAW_ARROW,STYLE_SOLID,2);
SetIndexArrow(1, 233);
SetIndexBuffer(1,ExtMapBuffer2);
return(0);
}
int start()
{
int counted_bars=IndicatorCounted();
//----
int i = Bars - counted_bars - 1;
while (i>=0)
{
Signal1=0;
Signal2=0;
double EmaL0 = iMA(NULL,0,LongEma,0,MODE_EMA, PRICE_CLOSE, i);
double EmaL1 = iMA(NULL,0,LongEma,0,MODE_EMA, PRICE_CLOSE, i+1);
double EmaS1 = iMA(NULL,0,ShortEma,0,MODE_EMA, PRICE_CLOSE, i+1);
double EmaS0 = iMA(NULL,0,ShortEma,0,MODE_EMA, PRICE_CLOSE, i);
if (EmaS1>EmaL1 && EmaS0<EmaL0 ) Signal1=High[i-1];
if (EmaS1<EmaL1 && EmaS0>EmaL0 ) Signal2=Low[i-1];
ExtMapBuffer1[i-1]= Signal1+ArrowDistance*Point;
ExtMapBuffer2[i-1]= Signal2-ArrowDistance*Point;
i--;
}
//----
return(0);
}