Hmm.. I'm having issues trying to call the MA in Color with Applied Price with iCustom. I cannot figure out how it decides the color for the line, despite looking over the source code and trying many things. It just doesn't seem to make sense. Can anyone shed any light as to how I would go about grabbing the colour for the line on the previous bar?
Here's the relevant portion of the code in the MA source:
ExtMapBuffer0[i] = MA_Cur; //red
ExtMapBuffer1[i] = MA_Cur; //green
ExtMapBuffer2[i] = MA_Cur; //yellow
if (MA_Prev > MA_Cur)
{
ExtMapBuffer1[i] = EMPTY_VALUE;
}
else if (MA_Prev < MA_Cur)
{
ExtMapBuffer2[i] = EMPTY_VALUE; //-1 red/greem tight
}
else
{
ExtMapBuffer2[i]=EMPTY_VALUE;//EMPTY_VALUE;
ExtMapBuffer1[i]=EMPTY_VALUE;//EMPTY_VALUE;
}
I've just replicated part of the code from the indy as that was quickest, with the following:
double MA_Cur = iMA(NULL,0,8,0,MODE_LWMA, 6, MAtimeperiod1);
double MA_Prev = iMA(NULL,0,8,0,MODE_LWMA, 6, MAtimeperiod2);
if (MA_Prev > MA_Cur) Comment("This is DOWN, possibly yellow");
else if (MA_Prev < MA_Cur) Comment("either UP or DOWN, but not yellow");
else Comment ("This is UP, possibly yellow");
The Comments show how little luck I've had with figuring out how it decides what colour the line is. If someone could shed some light on this I'd be damn grateful. Cheers!
Here's the relevant portion of the code in the MA source:
ExtMapBuffer0[i] = MA_Cur; //red
ExtMapBuffer1[i] = MA_Cur; //green
ExtMapBuffer2[i] = MA_Cur; //yellow
if (MA_Prev > MA_Cur)
{
ExtMapBuffer1[i] = EMPTY_VALUE;
}
else if (MA_Prev < MA_Cur)
{
ExtMapBuffer2[i] = EMPTY_VALUE; //-1 red/greem tight
}
else
{
ExtMapBuffer2[i]=EMPTY_VALUE;//EMPTY_VALUE;
ExtMapBuffer1[i]=EMPTY_VALUE;//EMPTY_VALUE;
}
I've just replicated part of the code from the indy as that was quickest, with the following:
double MA_Cur = iMA(NULL,0,8,0,MODE_LWMA, 6, MAtimeperiod1);
double MA_Prev = iMA(NULL,0,8,0,MODE_LWMA, 6, MAtimeperiod2);
if (MA_Prev > MA_Cur) Comment("This is DOWN, possibly yellow");
else if (MA_Prev < MA_Cur) Comment("either UP or DOWN, but not yellow");
else Comment ("This is UP, possibly yellow");
The Comments show how little luck I've had with figuring out how it decides what colour the line is. If someone could shed some light on this I'd be damn grateful. Cheers!
Attached File(s)
MA in Color_wAppliedPrice.mq4
5 KB
|
229 downloads