Attachments forums

List of attachments posted on this forum.


All files on forums: 160719

Re: MACD indicators for MT4

mrtools, Fri Mar 07, 2025 11:10 am

mate wrote: Fri Mar 07, 2025 9:37 am Here's what happens with two options
Okay did a 4-color version, the only version I have the histogram for some reason was done as an object version, which I am not sure but think it is causing the colors to become different, this version I did is using the color scheme they were trying in the object version but not using objects and the results are different. The histograms I usually do is when the macd is <> 0 that is the main trend and when macd <> it's signal that designates a strong or weak trend, the zones version is using the opposite.

This is the color scheme for the zones version
if (macd[i]>signal[i] && macd[i]> 0) colors[i] = 1; // color up
if (macd[i]>signal[i] && macd[i]< 0) colors[i] = 2; // color neutral up
if (macd[i]<signal[i] && macd[i]< 0) colors[i] = 3; // color down
if (macd[i]<signal[i] && macd[i]> 0) colors[i] = 4; // color neutral down


switch (clr)
{
case 3 : ObjectSet(name,OBJPROP_COLOR,ColorDown); break;
case 4 : ObjectSet(name,OBJPROP_COLOR,ColorNeutralDown); break;
case 1 : ObjectSet(name,OBJPROP_COLOR,ColorUp); break;
default : ObjectSet(name,OBJPROP_COLOR,ColorNeutralUp); break;
}
All files in topic