Your indicator is nice, but your code is seriously bad and hard to read. You have no structure.
If you share your code, you should try to write it in a better, easier way to read and understand.
It would be great to have a gradient color from green to reg to read the result more easily.
Here are two functions that would be useful for you:
int rgb2int(int r, int g, int b) {
return (b*65536+g*256+r);
}
int colorgradient(int r, int g, int b, int r2, int g2, int b2, double min, double max, double pos) {
double steps = (max-min);
pos = max-pos;
double stepR = (r-r2)/(steps-1);
double stepG = (g-g2)/(steps-1);
double stepB = (b-b2)/(steps-1);
return (rgb2int((r-(stepR*pos)),(g-(stepG*pos)),(b-(stepB*pos))));
}
rgb2int does what you would expect, no explanation needed.
colorgradient returns a color on a gradient scale. Here is how to use it:
Imagine you have a value oscillating between 0 and 100; You want each value to be color coded in a gradient going from green (value = 0) to red (value = 100).
int min = 0; int max = 100; int value = 70; // let say you want to get the color corresponding to value 70 color c = colorgradient(255,0,0, 0,255,0, min,max,value); // 255,0,0 -> red / 0,255,0 -> green
Your indicator is nice, but your code is seriously bad and hard to read. You have no structure.
If you share your code, you should try to write it in a better, easier way to read and understand.
I made it as simple as I could, sorry if it wasn't simple enough for you to read...
I will consider that function when I'll have time, thanks.
MT-Coder
The multicolor version is ready, it should appear shortly https://www.mql5.com/en/users/mt-coder/publications .
Thanks for comments
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Heat Map:
Author: mt-coder