Hello could any programmer please help me.
I wanna have an arrow drawn for a shifted ema.
I've already included extern int ma_shift=0; but don't know how to include the rest of it, so that it works properly.
Here is the main part of the code:
#property indicator_chart_window
#property indicator_buffers 1
#property indicator_color1 Crimson
//---- buffers
double CrossDown[];
extern int FasterEMA = 1;
extern int SlowerEMA = 200;
extern int applied_price=PRICE_LOW;
extern int ma_shift=0;
extern bool Sound_ON = true;
extern bool Arrow_Opposite = true;
//---- miscelleanous global variables
double ArrowSide;
//+------------------------------------------------------------------+
//| Custom indicator initialization function |
//+------------------------------------------------------------------+
int init()
{
if(Arrow_Opposite) ArrowSide = -1*Point;
else ArrowSide = 1*Point;
//---- indicators
IndicatorBuffers(1);
// Red Arrows
SetIndexBuffer(0,CrossDown);
SetIndexStyle(0,DRAW_ARROW,EMPTY,1);
SetIndexArrow(0,234);
SetIndexLabel(0,"SHORT");
//----
return(0);
}
//+------------------------------------------------------------------+
//| Custom indicator deinitialization function |
//+------------------------------------------------------------------+
int deinit()
{
//----
//----
return(0);
}
//+------------------------------------------------------------------+
//| Custom indicator iteration function |
//+------------------------------------------------------------------+
int start() {
int limit, i,counter;
double fasterEMAnow, slowerEMAnow, fasterEMAprevious, slowerEMAprevious, fasterEMAafter, slowerEMAafter;
double Range, AvgRange;
int counted_bars=IndicatorCounted();
//---- check for possible errors
if(counted_bars<0) return(-1);
//---- last counted bar will be recounted
if(counted_bars>0) counted_bars--;
limit=Bars-counted_bars;
for(i = 0; i <= limit; i++) {
counter=i;
Range=0;
AvgRange=0;
for (counter=i ;counter<=i+9;counter++)
{
AvgRange=AvgRange+MathAbs(High[counter]-Low[counter]);
}
Range=AvgRange/10;
fasterEMAnow = iMA(NULL, 0, FasterEMA, 0, MODE_EMA, PRICE_CLOSE, i);
fasterEMAprevious = iMA(NULL, 0, FasterEMA, 0, MODE_EMA, PRICE_CLOSE, i+1);
fasterEMAafter = iMA(NULL, 0, FasterEMA, 0, MODE_EMA, PRICE_CLOSE, i-1);
slowerEMAnow = iMA(NULL, 0, SlowerEMA, 0, MODE_EMA, applied_price, i);
slowerEMAprevious = iMA(NULL, 0, SlowerEMA, 0, MODE_EMA, applied_price, i+1);
slowerEMAafter = iMA(NULL, 0, SlowerEMA, 0, MODE_EMA, applied_price, i-1);
if ((fasterEMAnow < slowerEMAnow) && (fasterEMAprevious > slowerEMAprevious) && (fasterEMAafter < slowerEMAafter)) {
CrossDown[i] = High[i] + Range*0.5;
}
.
.
.
.
.
.
.
Thank you!
I wanna have an arrow drawn for a shifted ema.
I've already included extern int ma_shift=0; but don't know how to include the rest of it, so that it works properly.
Here is the main part of the code:
#property indicator_chart_window
#property indicator_buffers 1
#property indicator_color1 Crimson
//---- buffers
double CrossDown[];
extern int FasterEMA = 1;
extern int SlowerEMA = 200;
extern int applied_price=PRICE_LOW;
extern int ma_shift=0;
extern bool Sound_ON = true;
extern bool Arrow_Opposite = true;
//---- miscelleanous global variables
double ArrowSide;
//+------------------------------------------------------------------+
//| Custom indicator initialization function |
//+------------------------------------------------------------------+
int init()
{
if(Arrow_Opposite) ArrowSide = -1*Point;
else ArrowSide = 1*Point;
//---- indicators
IndicatorBuffers(1);
// Red Arrows
SetIndexBuffer(0,CrossDown);
SetIndexStyle(0,DRAW_ARROW,EMPTY,1);
SetIndexArrow(0,234);
SetIndexLabel(0,"SHORT");
//----
return(0);
}
//+------------------------------------------------------------------+
//| Custom indicator deinitialization function |
//+------------------------------------------------------------------+
int deinit()
{
//----
//----
return(0);
}
//+------------------------------------------------------------------+
//| Custom indicator iteration function |
//+------------------------------------------------------------------+
int start() {
int limit, i,counter;
double fasterEMAnow, slowerEMAnow, fasterEMAprevious, slowerEMAprevious, fasterEMAafter, slowerEMAafter;
double Range, AvgRange;
int counted_bars=IndicatorCounted();
//---- check for possible errors
if(counted_bars<0) return(-1);
//---- last counted bar will be recounted
if(counted_bars>0) counted_bars--;
limit=Bars-counted_bars;
for(i = 0; i <= limit; i++) {
counter=i;
Range=0;
AvgRange=0;
for (counter=i ;counter<=i+9;counter++)
{
AvgRange=AvgRange+MathAbs(High[counter]-Low[counter]);
}
Range=AvgRange/10;
fasterEMAnow = iMA(NULL, 0, FasterEMA, 0, MODE_EMA, PRICE_CLOSE, i);
fasterEMAprevious = iMA(NULL, 0, FasterEMA, 0, MODE_EMA, PRICE_CLOSE, i+1);
fasterEMAafter = iMA(NULL, 0, FasterEMA, 0, MODE_EMA, PRICE_CLOSE, i-1);
slowerEMAnow = iMA(NULL, 0, SlowerEMA, 0, MODE_EMA, applied_price, i);
slowerEMAprevious = iMA(NULL, 0, SlowerEMA, 0, MODE_EMA, applied_price, i+1);
slowerEMAafter = iMA(NULL, 0, SlowerEMA, 0, MODE_EMA, applied_price, i-1);
if ((fasterEMAnow < slowerEMAnow) && (fasterEMAprevious > slowerEMAprevious) && (fasterEMAafter < slowerEMAafter)) {
CrossDown[i] = High[i] + Range*0.5;
}
.
.
.
.
.
.
.
Thank you!