Background Chart Colour
- 2014.09.26
- www.mql5.com
Hi I have the attached indicator, but have been unable to get hold of the clever programmer...
I doubts,he asking chart background color changing according to arrows (up/down) an selectable color choice when arrow up and different coloring choice when arrow to down
I don't see why not
Global variable:
input color colorChangeOnSignal = clrBlack;
In OnCalculate:
if(signal){ ChartSetInteger(0, CHART_COLOR_BACKGROUND, colorChangeOnSignal); }
maxtitu835 #: please add it on attached code, iam newbie on coding.
- Usually people who can't code don't receive free help on this forum.
- If you show your attempts and describe your problem clearly, you will most probably receive an answer from the community. Use the CODE button (Alt-S) when inserting code.
- To learn MQL programming, you can research the many available Articles on the subject, or examples in the Codebase, as well as reference the online Documentation.
- If you do not want to learn to code, that is not a problem. You can either look at the Codebase if something free already exists, or in the Market for paid products (also sometimes free). However, recommendations or suggestions for Market products are not allowed on the forum, so you will have to do your own research.
- Finally, you also have the option to hire a programmer in the Freelance section.
But you didn't say what the signal should be.
If the indicator should change background when the Alert occurs...for example...then it would be as such:
// global variables at the top of the script input bool bgChangerActive = true; input color colorChangeOnSignal = clrRed;
for(int i = limit-1; i >= 0; i--) { if (i >= MathMin(5000-1, rates_total-1-50)) continue; //omit some old rates to prevent "Array out of range" or slow calculation //Indicator Buffer 1 if(Stochastic_Main[i] > Stochastic_Signal[i] && Stochastic_Main[i+1] < Stochastic_Signal[i+1]) //Stochastic Oscillator crosses above Stochastic Oscillator { if(bgChangerActive){ ChartSetInteger(0, CHART_COLOR_BACKGROUND, colorChangeOnSignal); } Buffer1[i] = Low[i]; //Set indicator value at Candlestick Low if(i == 0 && Time[0] != time_alert) { myAlert("indicator", "Buy"); time_alert = Time[0]; } //Instant alert, only once per bar } else { Buffer1[i] = EMPTY_VALUE; } //Indicator Buffer 2 if(Stochastic_Main[i] < Stochastic_Signal[i] && Stochastic_Main[i+1] > Stochastic_Signal[i+1]) //Stochastic Oscillator crosses below Stochastic Oscillator { Buffer2[i] = High[i]; //Set indicator value at Candlestick High if(i == 0 && Time[0] != time_alert) { myAlert("indicator", "Sell"); time_alert = Time[0]; } //Instant alert, only once per bar } else { Buffer2[i] = EMPTY_VALUE; } }
You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
when signal arrow appear on the chart i want to change chart background color, suggest me how to do it.....