Hier mal n schneller Lösungsansatz
PHP-Code:
//+------------------------------------------------------------------+
//| MACD2_lesen.mq5 |
//| Copyright 2014, MetaQuotes Software Corp. |
//| http://www.mql5.com |
//+------------------------------------------------------------------+
#property copyright "Copyright 2014, MetaQuotes Software Corp."
#property link "http://www.mql5.com"
#property version "1.00"
int MACD2_Handle;
double MACD2_Buffer1[];
double MACD2_Buffer2[];
//+------------------------------------------------------------------+
//| Expert initialization function |
//+------------------------------------------------------------------+
int OnInit()
{
//---
MACD2_Handle = iCustom(_Symbol,PERIOD_CURRENT,"MACD2");
CopyBufferAsSeries(MACD2_Handle,0,0,100,true,MACD2_Buffer1);
CopyBufferAsSeries(MACD2_Handle,2,0,100,true,MACD2_Buffer2);
//---
return(INIT_SUCCEEDED);
}
//+------------------------------------------------------------------+
//| Expert deinitialization function |
//+------------------------------------------------------------------+
void OnDeinit(const int reason)
{
//---
}
//+------------------------------------------------------------------+
//| Expert tick function |
//+------------------------------------------------------------------+
void OnTick()
{
//---
if(MACD2_Buffer2[0] >= 0) {
Comment("Wert der Cloud = " + (string)MACD2_Buffer1[0] + " Farbe = grün");
}
else
{
Comment("Wert der Cloud = " + (string)MACD2_Buffer1[0] + " Farbe = pink");
}
}
//+------------------------------------------------------------------+
bool CopyBufferAsSeries(
int handle, // indicator's handle
int buffer, // buffer index
int start, // start index
int number, // number of elements to copy
bool asSeries, // if it's true, the elements will be indexed as series
double &M[] // target array
)
{
//--- filling the array M with current values of the indicator
if(CopyBuffer(handle,buffer,start,number,M)<=0) return(false);
//--- the elements will be indexed as follows:
//--- if asSeries=true, it will be indexed as timeseries
//--- if asSeries=false, it will be indexed as default
ArraySetAsSeries(M,asSeries);
//---
return(true);
}