Indikatoren: Farbe der Kerzen ändern
Hallo kourosh1347, wie hat Ihr Code ist ähnlich mit dem einen in Forum(https://www.mql5.com/en/forum/9142#comment_382841), die Benutzer TIMisthebest gehören?
Hallo;
nein; kourosh1347 hat die erste Version davon geschrieben;
als ich ihn danach fragte ;
TIMisthebest 2012.12.04 13:37 # thank you. i correct it but ; still has a problem; //+------------------------------------------------------------------+ //|Z4_ColorCandles_Daily_Hours.mq5 | //| Copyright 2012, MetaQuotes Software Corp. | //| http://www.mql5.com | //+------------------------------------------------------------------+ #property copyright "Copyright 2012, MetaQuotes Software Corp." #property link "http://www.mql5.com" #property version "1.00" #property indicator_chart_window int Day_End=4; int Hour_Start=6; int Minute_Start=0; int Hour_End=23; int Minute_End=59; input color Color_Chart_Line_0=Magenta; input color Color_Candle_Bull_0=SkyBlue; input color Color_Candle_Bear_0=LightPink; input color Color_Bar_Up_0=PowderBlue; input color Color_Bar_Down_0=Bisque; //--- input color Color_Chart_Line_1=Red; input color Color_Candle_Bull_1=Red; input color Color_Candle_Bear_1=Red; input color Color_Bar_Up_1=Red; input color Color_Bar_Down_1=Red; //------------------------------------------------------------------------------ Farbe für Liniendiagramm und Doji-Kerzen color GetColorChartLine() { return((color)ChartGetInteger(0,CHART_COLOR_CHART_LINE)); } void SetColorChartLine(color Color_Chart_Line) { ChartSetInteger(0,CHART_COLOR_CHART_LINE,Color_Chart_Line); } //-------------------------------------------------------------------------------------- Körperfarbe der Stierkerze color GetColorCandleBull() { return((color)ChartGetInteger(0,CHART_COLOR_CHART_UP)); } void SetColorCandleBull(color Color_Candle_Bull) { ChartSetInteger(0,CHART_COLOR_CHART_UP,Color_Candle_Bull); } //-------------------------------------------------------------------------------------- Körperfarbe der Bärenkerze color GetColorCandleBear() { return((color)ChartGetInteger(0,CHART_COLOR_CHART_DOWN)); } void SetColorCandleBear(color Color_Candle_Bear) { ChartSetInteger(0,CHART_COLOR_CHART_DOWN,Color_Candle_Bear); } //----------------------------------------------------------------------------------- Körperfarbe eines Bullenleuchters color GetColorBarUp() { return((color)ChartGetInteger(0,CHART_COLOR_CANDLE_BULL)); } void SetColorBarUp(color Color_Bar_Up) { ChartSetInteger(0,CHART_COLOR_CANDLE_BULL,Color_Bar_Up); } //----------------------------------------------------------------------------------- Körperfarbe eines Bullenleuchters color GetColorBarDown() { return((color)ChartGetInteger(0,CHART_COLOR_CANDLE_BEAR)); } void SetColorBarDown(color Color_Bar_Down) { ChartSetInteger(0,CHART_COLOR_CANDLE_BEAR,Color_Bar_Down); } //+------------------------------------------------------------------+ //| Benutzerdefinierte Initialisierungsfunktion für Indikatoren | //+------------------------------------------------------------------+ int OnInit() { //--- Zuordnung von Indikatorpuffern //--- return(0); } //+------------------------------------------------------------------+ //| Benutzerdefinierte Indikator-Iterationsfunktion| //+------------------------------------------------------------------+ int OnCalculate(const int rates_total, const int prev_calculated, const datetime &time[], const double &open[], const double &high[], const double &low[], const double &close[], const long &tick_volume[], const long &volume[], const int &spread[]) { //--- ChartSetInteger(0,CHART_COLOR_CHART_LINE,Color_Chart_Line_0); ChartSetInteger(0,CHART_COLOR_CHART_UP,Color_Candle_Bull_0); ChartSetInteger(0,CHART_COLOR_CHART_DOWN,Color_Candle_Bear_0); ChartSetInteger(0,CHART_COLOR_CANDLE_BULL,Color_Bar_Up_0); ChartSetInteger(0,CHART_COLOR_CANDLE_BEAR,Color_Bar_Down_0); MqlDateTime time_now; datetime candle_time=TimeTradeServer(time_now); if( time_now.day_of_week==Day_End && time_now.hour>=Hour_End && time_now.min>=Minute_End ) { ChartSetInteger(0,CHART_COLOR_CHART_LINE,Color_Chart_Line_1); ChartSetInteger(0,CHART_COLOR_CHART_UP,Color_Candle_Bull_1); ChartSetInteger(0,CHART_COLOR_CHART_DOWN,Color_Candle_Bear_1); ChartSetInteger(0,CHART_COLOR_CANDLE_BULL,Color_Bar_Up_1); ChartSetInteger(0,CHART_COLOR_CANDLE_BEAR,Color_Bar_Down_1); } //+------------------------------------------------------------------+ Comment( "\ntime_now=",candle_time ,"\ntime_now_year=",time_now.year," time_now_mon=",time_now.mon ,"\ntime_now_day=",time_now.day," time_now_hour=",time_now.hour," time_now_min=",time_now.min ," time_now_sec=",time_now.sec); //--- Rückgabewert von prev_calculated für den nächsten Aufruf return(rates_total); } //+------------------------------------------------------------------+ //+------------------------------------------------------------------+ //| Benutzerdefinierte Indikator-Deinitialisierungsfunktion | //+------------------------------------------------------------------+ void OnDeinit(const int reason) { Comment(""); //---- //---- } //+----------------------------------
schrieb er dies:
//+------------------------------------------------------------------------------+ //|kerzenfarbe | //+------------------------------------------------------------------------------+ #property indicator_chart_window #property version "1.0" #property indicator_buffers 6 #property indicator_label1 "Open;High;Low;Close" #property indicator_plots 1 #property indicator_type1 DRAW_COLOR_CANDLES #property indicator_width1 3 input int Day_Start=1; input int Hour_Start=22; input int Minute_Start=30; input int Day_End=1; input int Hour_End=23; input int Minute_End=30; input color Color_Bar_Up_1=Magenta; input color Color_Bar_Down_1=Blue; input color Color_Bar_Up_0=Green; input color Color_Bar_Down_0=Red; double buffer_open[],buffer_high[],buffer_low[],buffer_close[]; double buffer_color_line[]; double buffer_tmp[1]; int OnInit() { SetIndexBuffer(0,buffer_open,INDICATOR_DATA); SetIndexBuffer(1,buffer_high,INDICATOR_DATA); SetIndexBuffer(2,buffer_low,INDICATOR_DATA); SetIndexBuffer(3,buffer_close,INDICATOR_DATA); SetIndexBuffer(4,buffer_color_line,INDICATOR_COLOR_INDEX); PlotIndexSetInteger(0,PLOT_COLOR_INDEXES,4); PlotIndexSetInteger(0,PLOT_LINE_COLOR,0,Color_Bar_Up_0); PlotIndexSetInteger(0,PLOT_LINE_COLOR,1,Color_Bar_Down_0); PlotIndexSetInteger(0,PLOT_LINE_COLOR,2,Color_Bar_Up_1); PlotIndexSetInteger(0,PLOT_LINE_COLOR,3,Color_Bar_Down_1); return(0); } int OnCalculate(const int rates_total, const int prev_calculated, const datetime &time[], const double &open[], const double &high[], const double &low[], const double &close[], const long &tick_volume[], const long &volume[], const int &spread[]) { MqlDateTime time_now; for(int i=prev_calculated;i<=rates_total-1;i++) { buffer_open[i]=open[i]; buffer_high[i]=high[i]; buffer_low[i]=low[i]; buffer_close[i]=close[i]; datetime candle_time=time[i]; TimeToStruct(time[i],time_now); if( (time_now.day_of_week==Day_Start && time_now.hour>=Hour_Start && time_now.min>=Minute_Start) &&( time_now.day_of_week==Day_End && time_now.hour<=Hour_End && time_now.min<=Minute_End ) ) { if ( open[i]>= close[i]) buffer_color_line[i]=3; else buffer_color_line[i]=2; } else { if ( open[i]>= close[i]) buffer_color_line[i]=1; else buffer_color_line[i]=0; } } return(rates_total-1); } //+------------------------------------------------------------------+
und schickte es mir;
und es war nicht das, was ich erwartet hatte;
also habe ich mit kourosh1347 per Telefon darüber gesprochen;
danach habe ich es geteilt, um es zu modifizieren:( wie kann ich helfen? )
und es hat keinen Namen;
von : ( hallo; eine frage zur zeitdefinition in mql5 .
in this code: but still has problem ; can you please check it //+------------------------------------------------------------------------------+ #property indicator_chart_window #property version "1.0"
und ich sagte ihm ( in messsage):
Das Problem ist, dass : (
Day_Start=6; and Day_End=6
( mein Broker arbeitete am Tag=6 von 22:00 bis 24:00 )
und
Indikatoren: Ändern Sie die Farbe der Kerzen
gehört zu " kourosh1347 "
bevor ich dies schrieb, schickte ich eine Nachricht an " kourosh1347 " :
lesen :
hallo; eine frage zur zeitdefinition in mql5 .
&
Indikatoren: Ändern Sie die Farbe der Kerzen
&
ich sende auch sms an sein Mobiltelefon
Wie kann ich erreichen, dass nur die letzte Kerze ihre Farbe ändert? Und der Rest der Kerzen bleibt in der gleichen Farbe?
Farbe der Kerzen ändern:
Der Indikator erlaubt die Änderung der Farbe der Kerzen.
Autor: Kourosh Davallou