Metatrader Forum | Forex Expert-Advisor | Broker & Forex Tools

Metatrader Forum | Forex Expert-Advisor | Broker & Forex Tools (http://www.expert-advisor.com/forum/index.php)
-   Programmierung MQL5 (http://www.expert-advisor.com/forum/forumdisplay.php?f=221)
-   -   Indikatorbuffer - Statisch oder Dynamisch definieren (http://www.expert-advisor.com/forum/showthread.php?t=5336)

Kronenchakra 08.12.16 16:16

Indikatorbuffer - Statisch oder Dynamisch definieren
 
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 :D
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


Alle Zeitangaben in WEZ +2. Es ist jetzt 02:00 Uhr.

Powered by vBulletin® Version 3.8.5 (Deutsch)
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.6.1
Powered by vBCMS® 2.7.0 ©2002 - 2024 vbdesigns.de
Copyright ©2009 - 2023 by Expert-Advisor.com - Das Metatrader Forum