modificar código para poder cambiar colores histograma
Publicado: 23 Jul 2021 11:40
Hola chicos:
Me pasa que al instalar un ESTOCASTICO EN FORMA DE HISTOGRAMA, no cambia los colores que trae por defecto aq los cambie en la configuracion. Se que es pura estetica pero me gustaria cambiar los que trae, os paso el codigo original a ver si podeis ayudarme. Mil gracias!: (los colores que trae por defecto son GREEN e INDIAN RED, no se porque en el código pone otros... Tampoco sé de programacion mql4:
*********************************************************************
*/
#property copyright "Copyright © 2006-07, Akuma99"
#property link "http://www.//beginnertrader.//com "
#property indicator_separate_window
#property indicator_buffers 3
#property indicator_color1 Green //uptrend
#property indicator_width1 2
#property indicator_color2 Red //downtrend
#property indicator_width2 2
#property indicator_color3 Black // First Stochastic line
#property indicator_width3 2
extern string note1 = "First Stochastic";
extern int StochPeriod1=5;
extern int DPeriod1=3;
extern int SlowingPeriod1=3;
double upB[];
double loB[];
double Stoch1[];
//+------------------------------------------------------------------+
int init() {
IndicatorBuffers(3);
SetIndexStyle(0,DRAW_HISTOGRAM,STYLE_SOLID,indicator_width1,indicator_color1);
SetIndexBuffer(0,upB);
SetIndexEmptyValue(0,EMPTY_VALUE);
SetIndexStyle(1,DRAW_HISTOGRAM,STYLE_SOLID,indicator_width2,indicator_color2); //downtrend
SetIndexBuffer(1,loB);
SetIndexEmptyValue(1,EMPTY_VALUE);
SetIndexStyle(2,DRAW_LINE);
SetIndexBuffer(2,Stoch1);
return(0);
}
//+------------------------------------------------------------------+
int deinit() {
}
//+------------------------------------------------------------------+
int start() {
int counted_bars=IndicatorCounted();
int shift,limit;
IndicatorShortName("Stoch Histogram ("+StochPeriod1+","+DPeriod1+","+SlowingPeriod1+")");
if (counted_bars<0) return(-1);
if (counted_bars>0) counted_bars--;
limit=Bars-31;
if(counted_bars>=31) limit=Bars-counted_bars-1;
for (shift=limit;shift>=0;shift--) {
Stoch1[shift]=iStochastic(NULL,0,StochPeriod1,DPeriod1,SlowingPeriod1,MODE_SMA,0,MODE_MAIN,shift)-50;
if(Stoch1[shift]>0) {
upB[shift]=Stoch1[shift];
} else if (Stoch1[shift]<0){
loB[shift]=Stoch1[shift];
}
}
return(0);
}
//+------------------------------------------------------------------+
Me pasa que al instalar un ESTOCASTICO EN FORMA DE HISTOGRAMA, no cambia los colores que trae por defecto aq los cambie en la configuracion. Se que es pura estetica pero me gustaria cambiar los que trae, os paso el codigo original a ver si podeis ayudarme. Mil gracias!: (los colores que trae por defecto son GREEN e INDIAN RED, no se porque en el código pone otros... Tampoco sé de programacion mql4:
*********************************************************************
*/
#property copyright "Copyright © 2006-07, Akuma99"
#property link "http://www.//beginnertrader.//com "
#property indicator_separate_window
#property indicator_buffers 3
#property indicator_color1 Green //uptrend
#property indicator_width1 2
#property indicator_color2 Red //downtrend
#property indicator_width2 2
#property indicator_color3 Black // First Stochastic line
#property indicator_width3 2
extern string note1 = "First Stochastic";
extern int StochPeriod1=5;
extern int DPeriod1=3;
extern int SlowingPeriod1=3;
double upB[];
double loB[];
double Stoch1[];
//+------------------------------------------------------------------+
int init() {
IndicatorBuffers(3);
SetIndexStyle(0,DRAW_HISTOGRAM,STYLE_SOLID,indicator_width1,indicator_color1);
SetIndexBuffer(0,upB);
SetIndexEmptyValue(0,EMPTY_VALUE);
SetIndexStyle(1,DRAW_HISTOGRAM,STYLE_SOLID,indicator_width2,indicator_color2); //downtrend
SetIndexBuffer(1,loB);
SetIndexEmptyValue(1,EMPTY_VALUE);
SetIndexStyle(2,DRAW_LINE);
SetIndexBuffer(2,Stoch1);
return(0);
}
//+------------------------------------------------------------------+
int deinit() {
}
//+------------------------------------------------------------------+
int start() {
int counted_bars=IndicatorCounted();
int shift,limit;
IndicatorShortName("Stoch Histogram ("+StochPeriod1+","+DPeriod1+","+SlowingPeriod1+")");
if (counted_bars<0) return(-1);
if (counted_bars>0) counted_bars--;
limit=Bars-31;
if(counted_bars>=31) limit=Bars-counted_bars-1;
for (shift=limit;shift>=0;shift--) {
Stoch1[shift]=iStochastic(NULL,0,StochPeriod1,DPeriod1,SlowingPeriod1,MODE_SMA,0,MODE_MAIN,shift)-50;
if(Stoch1[shift]>0) {
upB[shift]=Stoch1[shift];
} else if (Stoch1[shift]<0){
loB[shift]=Stoch1[shift];
}
}
return(0);
}
//+------------------------------------------------------------------+