Hallo MQL5 Spezialisten.
Ich hab' schon wieder MQL5-Schmerzen.
Die statische Definition von Plotbuffern empfinde ich als sehr schmerzhaft.
Das muß wohl ein Relikt von MQL4 sein. Das tut richtig weh
Code:
#property indicator_plots 1
#property indicator_type1 DRAW_LINE
#property indicator_color1 clrAqua
#property indicator_level1 160.0
#property indicator_level2 -160.0
#property indicator_levelcolor clrSilver
#property indicator_levelstyle STYLE_DOT
Besser ist die dynamische Definition
Code:
PlotIndexSetInteger(0,PLOT_DRAW_TYPE, DRAW_LINE);
PlotIndexSetInteger(0,PLOT_LINE_COLOR, cci_Color);
PlotIndexSetInteger(0,PLOT_LINE_WIDTH, cci_Width);
PlotIndexSetString (0,PLOT_LABEL, "CCI");
PlotIndexSetDouble (0,PLOT_EMPTY_VALUE,NULL);
PlotIndexSetInteger(0,PLOT_DRAW_BEGIN,Period-1);
Diese Definition kann ich in Funktionen und Objekte packen.
Siehe dazu
http://www.expert-advisor.com/forum/...eile-code.html
Jetzt aber mein Problem: Wie definiere ich die Farben eines INDICATOR_COLOR_INDEX
Code:
#property indicator_color1 clrRed,clrLime
mit
Code:
PlotIndexSetInteger(3,PLOT_LINE_COLOR, clrRed );
geht das ja nicht.
Und überhaupt sind mir diese colorlines etwas suspekt,
vor allem die indexnummern. anscheinend wird der colorindex nach hinten verschoben
Dieser Code funktioniert! Sonderbar ist die Indizierung
Code:
SetIndexBuffer(0,IndBuffer,INDICATOR_DATA); // Ozymandias Centerline
SetIndexBuffer(1,ColBuffer,INDICATOR_COLOR_INDEX);
SetIndexBuffer(2,Up_Buffer,INDICATOR_DATA); // Upper Ozymandias
SetIndexBuffer(3,Dn_Buffer,INDICATOR_DATA); // Lower Ozymandias
SetIndexBuffer(4,Up_Signal,INDICATOR_DATA); // Signal Up
SetIndexBuffer(5,Dn_Signal,INDICATOR_DATA); // Signal Down
PlotIndexSetString(0,PLOT_LABEL,"Ozymandias Centerline");
PlotIndexSetString(1,PLOT_LABEL,"Upper Ozymandias");
PlotIndexSetString(2,PLOT_LABEL,"Lower Ozymandias");
PlotIndexSetString(3,PLOT_LABEL,"OZY Down");
PlotIndexSetString(4,PLOT_LABEL,"OZY Up");
PlotIndexSetInteger(0,PLOT_DRAW_TYPE, DRAW_COLOR_LINE);
PlotIndexSetInteger(1,PLOT_DRAW_TYPE, DRAW_LINE);
PlotIndexSetInteger(2,PLOT_DRAW_TYPE, DRAW_LINE);
PlotIndexSetInteger(3,PLOT_DRAW_TYPE, DRAW_ARROW);
PlotIndexSetInteger(4,PLOT_DRAW_TYPE, DRAW_ARROW);
Wohin verschwindet der Indexbuffer #1 ?
Grüße Otto