Hi,
I have the code below, however I am unable to get the indicator to work.
---------
extern int MoveAvgPeriod = 1;
extern int MoveAvgMethod = MODE_SMA;
double BufferA[];
int init() {
IndicatorShortName("Price Action");
SetIndexBuffer(0,BufferA);
SetIndexLabel(0,"Price Action");
return(0);
}
int start() {
int iBarsToCalc = Bars - IndicatorCounted();
if (iBarsToCalc < Bars) iBarsToCalc++;
for (int i=iBarsToCalc-1;i>=0;i--) {
double CloseMA = iMA(NULL,0,MoveAvgPeriod,0,MoveAvgMethod,PRICE_CLOSE,i);
double OpenMA = iMA(NULL,0,MoveAvgPeriod,0,MoveAvgMethod,PRICE_OPEN, i);
double HigheMA = iMA(NULL,0,MoveAvgPeriod,0,MoveAvgMethod,PRICE_HIGH, i);
double LowMA = iMA(NULL,0,MoveAvgPeriod,0,MoveAvgMethod,PRICE_LOW, i);
double OpenMinusClose = OpenMA-CloseMA;
double OpenMinusLow = OpenMA-LowMA;
int Total = OpenMinusClose / HighMinusLow;
BufferA[i] = Total;
}
return(0);
}
----
If I replace the line
int Total = OpenMinusClose / HighMinusLow;
with any integer ie.
int Total = OpenMinusClose / 20;
it comes out fine.
Can someone please assist me?
Thank you.
I have the code below, however I am unable to get the indicator to work.
---------
extern int MoveAvgPeriod = 1;
extern int MoveAvgMethod = MODE_SMA;
double BufferA[];
int init() {
IndicatorShortName("Price Action");
SetIndexBuffer(0,BufferA);
SetIndexLabel(0,"Price Action");
return(0);
}
int start() {
int iBarsToCalc = Bars - IndicatorCounted();
if (iBarsToCalc < Bars) iBarsToCalc++;
for (int i=iBarsToCalc-1;i>=0;i--) {
double CloseMA = iMA(NULL,0,MoveAvgPeriod,0,MoveAvgMethod,PRICE_CLOSE,i);
double OpenMA = iMA(NULL,0,MoveAvgPeriod,0,MoveAvgMethod,PRICE_OPEN, i);
double HigheMA = iMA(NULL,0,MoveAvgPeriod,0,MoveAvgMethod,PRICE_HIGH, i);
double LowMA = iMA(NULL,0,MoveAvgPeriod,0,MoveAvgMethod,PRICE_LOW, i);
double OpenMinusClose = OpenMA-CloseMA;
double OpenMinusLow = OpenMA-LowMA;
int Total = OpenMinusClose / HighMinusLow;
BufferA[i] = Total;
}
return(0);
}
----
If I replace the line
int Total = OpenMinusClose / HighMinusLow;
with any integer ie.
int Total = OpenMinusClose / 20;
it comes out fine.
Can someone please assist me?
Thank you.