Farbe anpassen
hallo
ich würde gerne bei einem überschreiten eines bestimmten levels die farbe bei einem indicator ändern? hat wer einen tipp? danke! lg dominik |
ist übrigens ein einfaches histgramm
|
Mal in die Eigenschaften des Indikators gehen und dort die Farbe einfach ändern oder direkt im Code, falls die mq4-Datei vorliegt.
traderdoc |
Hi,
das geht natürlich sehr einfach händisch, wenn Du das allerdings durch den Indikator erledigen lassen willst, denk über Folgendes nach: 1.) Kennt der Indikator das bestimmte Level? 2.) Wenn JA, gibt es im Indikator bereits eine Möglichkeit es einzugeben? 3.) Welche Farbe soll verändert werden? Die Balken im Histogramm oder Farben im Chart selbst? Grüße |
es soll der balken im histogramm geändert werden.
die farbe kennt er, das level auch. nur wie ich es ihm beibringe, da hapert es lg |
Hi, so könnte so was aussehen. Ich hoffe, es hilft Dir! Das ist für MT4.
################################################## ## #property indicator_separate_window #property indicator_buffers 4 #property indicator_color1 Red #property indicator_color2 Green #property indicator_color3 Orange #property indicator_color4 DodgerBlue // exported variables extern double mylevel = 1; // local variables string LF = "\n"; // use this in custom or utility blocks where you need line feeds int ObjCount = 0; // count of all objects created on the chart, allows creation of objects with unique names int current = 0; // variable points to current bar double Buffer13[]; double Buffer23[]; double Buffer12[]; double Buffer22[]; //+------------------------------------------------------------------+ int init() { if (false) ObjectsDeleteAll(); // clear the chart IndicatorShortName("MACD Change Color"); IndicatorDigits(0); IndicatorBuffers(4); SetIndexBuffer(0, Buffer13); SetIndexStyle(0, DRAW_HISTOGRAM, STYLE_SOLID, 2, indicator_color1); SetIndexBuffer(1, Buffer23); SetIndexStyle(1, DRAW_HISTOGRAM, STYLE_SOLID, 2, indicator_color2); SetIndexBuffer(2, Buffer12); SetIndexStyle(2, DRAW_HISTOGRAM, STYLE_SOLID, 2, indicator_color3); SetIndexBuffer(3, Buffer22); SetIndexStyle(3, DRAW_HISTOGRAM, STYLE_SOLID, 2, indicator_color4); return(0); } //+------------------------------------------------------------------+ int deinit() { if (false) ObjectsDeleteAll(); return(0); } //+------------------------------------------------------------------+ int start() { OnEveryTick(); return(0); } //+------------------------------------------------------------------+ void OnEveryTick() { int i; int counted_bars = IndicatorCounted(); if(counted_bars < 0) return(-1); if(counted_bars > 0) counted_bars--; i = Bars - counted_bars; // main calculation loop while (i >= 0) { current = i; if (Ask >= mylevel) { if (iMA(NULL, NULL,14,0,MODE_SMA,PRICE_CLOSE,current) > iMA(NULL, NULL,24,0,MODE_SMA,PRICE_CLOSE,current)) { Buffer13[current]= (iMA(NULL, NULL,14,0,MODE_SMA,PRICE_CLOSE,current)-iMA(NULL, NULL,24,0,MODE_SMA,PRICE_CLOSE,current))*100; Buffer23[current] = EMPTY_VALUE; } else { Buffer23[current]= (iMA(NULL, NULL,14,0,MODE_SMA,PRICE_CLOSE,current)-iMA(NULL, NULL,24,0,MODE_SMA,PRICE_CLOSE,current))*100; Buffer13[current] = EMPTY_VALUE; } } if (Bid <= mylevel) { if (iMA(NULL, NULL,14,0,MODE_SMA,PRICE_CLOSE,current) > iMA(NULL, NULL,24,0,MODE_SMA,PRICE_CLOSE,current)) { Buffer12[current]= (iMA(NULL, NULL,14,0,MODE_SMA,PRICE_CLOSE,current)-iMA(NULL, NULL,24,0,MODE_SMA,PRICE_CLOSE,current))*100; Buffer22[current] = EMPTY_VALUE; } else { Buffer22[current]= (iMA(NULL, NULL,14,0,MODE_SMA,PRICE_CLOSE,current)-iMA(NULL, NULL,24,0,MODE_SMA,PRICE_CLOSE,current))*100; Buffer12[current] = EMPTY_VALUE; } } i--; } } ################################################## ## |
Alle Zeitangaben in WEZ +2. Es ist jetzt 10:33 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