Hilfe bei iCustom() Befehl.

 

Ich habe einen Indikator geschrieben/umgeschrieben dass entweder ein "Neutral" "Buy" oder "Sell" in einem string "signal" gespeichert ist. 

Gibt es eine Möglichkeit aus einem Expert Advisor auf diesen String zuzugreifen? 


Alternativ habe ich es mit iCustom versucht mir die Werte des Indikators in den EA zu holen und dann dort einfach das signal zu errechenen, nur kriege ich keine sinnvollen werte sondern nur ein "Handle" das von 0 bei jedem Tick +1 größer wird und ich hab keine idee wie ich das in die Arrays mit richtigen werten zurück übersetzen soll. Die Werte von fastln[] und slowln[] bräuchte ich im EA.

Tut mir leid wenn die Frage zu Anfängerhaft ist, aber ich suche schon seit Stunden alles ab und finde einfach nicht weiter. Danke!!!

Hier ist der Code vom Indicator:


//------------------------------------------------------------------
#property copyright   "©Fetteecke,2020"
#property link        "fetteecke@gmail.com"
#property description "PTL X"
//------------------------------------------------------------------
#property indicator_chart_window
#property indicator_buffers 9
#property indicator_plots   4
#property indicator_label1  "PTL trend candles"
#property indicator_type1   DRAW_COLOR_CANDLES
#property indicator_color1  clrDodgerBlue,clrCrimson
#property indicator_label2  "PTL slow line"
#property indicator_type2   DRAW_LINE
#property indicator_style2  STYLE_DOT
#property indicator_color2  clrDodgerBlue
#property indicator_label3  "PTL fast line"
#property indicator_type3   DRAW_LINE
#property indicator_color3  clrCrimson
#property indicator_style3  STYLE_DOT
#property indicator_label4  "PTL trend start"
#property indicator_type4   DRAW_COLOR_ARROW
#property indicator_color4  clrDodgerBlue,clrCrimson
#property indicator_width4  2
////


//
//
//

input int inpFastLength = 3; // Fast length
input int inpSlowLength = 7; // Slow length


//
//
//

double slowlu[],slowln[],fastln[],arrowar[],arrowcl[],candleo[],candleh[],candlel[],candlec[],candleC[];

int _fastPeriod,_slowPeriod;

string signal= "";

//------------------------------------------------------------------
//
//------------------------------------------------------------------
//
//
//

int OnInit()
{
   SetIndexBuffer( 0,candleo,INDICATOR_DATA);
   SetIndexBuffer( 1,candleh,INDICATOR_DATA);
   SetIndexBuffer( 2,candlel,INDICATOR_DATA);
   SetIndexBuffer( 3,candlec,INDICATOR_DATA);
   SetIndexBuffer( 4,candleC,INDICATOR_COLOR_INDEX);
   SetIndexBuffer( 5,slowln ,INDICATOR_DATA);
   SetIndexBuffer( 6,fastln ,INDICATOR_DATA);
   SetIndexBuffer( 7,arrowar,INDICATOR_DATA); 
   SetIndexBuffer( 8,arrowcl,INDICATOR_COLOR_INDEX);

      _fastPeriod = MathMax(MathMin(inpFastLength,inpSlowLength),1);
      _slowPeriod = MathMax(MathMax(inpFastLength,inpSlowLength),1);
      
      //
      //---
      //      

      PlotIndexSetInteger(3,PLOT_ARROW,159);

   return(INIT_SUCCEEDED);
}
void OnDeinit(const int reason) { return; }

//------------------------------------------------------------------
//
//------------------------------------------------------------------
//
//
//

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[])
{                
   struct sPtlStruct
   {
      datetime time;
      double   fastHigh;
      double   fastLow;
      double   slowHigh;
      double   slowLow;
      int      trend;
      int      trena;
   };
   static sPtlStruct m_array[];
   static int        m_arraySize=-1;
                 if (m_arraySize<rates_total) m_arraySize = ArrayResize(m_array,rates_total+500,2000);
   
   //
   //
   //
     
   
   
   int i= prev_calculated-1; if (i<0) i=0; for (; i<rates_total && !_StopFlag; i++)
   {
      if (m_array[i].time != time[i])
      {
         m_array[i].time = time[i];
            int _startf = i-_fastPeriod+1; if (_startf<0) _startf = 0;
            int _starts = i-_slowPeriod+1; if (_starts<0) _starts = 0;
                                           if (i<rates_total-1) m_array[i+1].time = 0;
               m_array[i].fastHigh = high[ArrayMaximum(high,_startf,_fastPeriod-1)];
               m_array[i].fastLow  = low [ArrayMinimum(low ,_startf,_fastPeriod-1)];
               m_array[i].slowHigh = high[ArrayMaximum(high,_starts,_slowPeriod-1)];
               m_array[i].slowLow  = low [ArrayMinimum(low ,_starts,_slowPeriod-1)];
      }

      //
      //
      //
      
      double thighs = (high[i]<m_array[i].slowHigh) ? m_array[i].slowHigh : high[i];
      double tlows  = (low[i] >m_array[i].slowLow)  ? m_array[i].slowLow  : low[i];
      double thighf = (high[i]<m_array[i].fastHigh) ? m_array[i].fastHigh : high[i];
      double tlowf  = (low[i] >m_array[i].fastLow)  ? m_array[i].fastLow  : low[i];

      //
      //
      //
            
         m_array[i].trend = -1;
         if (i>0)
         {
            m_array[i].trena  = m_array[i-1].trena;
               slowln[i] = (close[i]>slowln[i-1]) ? tlows : thighs;
               fastln[i] = (close[i]>fastln[i-1]) ? tlowf : thighf;
                  if (close[i]<slowln[i] && close[i]<fastln[i])     m_array[i].trend = 1;
                  if (close[i]>slowln[i] && close[i]>fastln[i])     m_array[i].trend = 0;
                  if (slowln[i]>fastln[i] || m_array[i].trend == 1) m_array[i].trena = 1;
                  if (slowln[i]<fastln[i] || m_array[i].trend == 0) m_array[i].trena = 0;
               
                  //
                  //
                  //
               
                  arrowar[i] = (m_array[i].trena !=m_array[i-1].trena) ? (m_array[i].trena==1) ? MathMax(fastln[i],slowln[i]) : MathMin(fastln[i],slowln[i]) : EMPTY_VALUE;
         }
         else 
         { 
            arrowcl[i] = 0; 
            arrowar[i] = EMPTY_VALUE; 
            fastln[i]  = slowln[i] = close[i]; 
            m_array[i].trend = m_array[i].trena = 0;
         }
         if (m_array[i].trend!=-1)
            { 
               candleo[i] = open[i];
               candleh[i] = high[i];
               candlel[i] = low[i];
               candlec[i] = close[i];
            }
         else candleo[i] = candleh[i] = candlel[i] = candlec[i] = EMPTY_VALUE;
         
         //
         //
         //
         
         candleC[i] = m_array[i].trend;
         arrowcl[i] = m_array[i].trena;
         
         double current_bid = SymbolInfoDouble(_Symbol, SYMBOL_BID);
                                 
         //int signalAverage = iMA (_Symbol,_Period,signalPeriod,0,MODE_SMA,PRICE_CLOSE);
         
         //CopyBuffer(signalAverage,0,0,3,signalAverageArray);
                 
         if(current_bid>fastln[i] && current_bid>slowln[i])
         
         signal = "Buy";
         
         if(current_bid<fastln[i] && current_bid<slowln[i])            
               
         
         signal = "Sell";
         
         if(current_bid<fastln[i] && current_bid>slowln[i]) 
         
         signal = "Neutral";
         
         if(current_bid>fastln[i] && current_bid<slowln[i])
         
         signal = "Neutral";        
          
         Comment(fastln[i]," ",slowln[i]," ",signal);
         
         
   }         
   return(rates_total);
}
 

Indikatoren 'kommunizieren' mit einem EA nur über die Puffer vom Typ double!

Also musst Du in Deinem Indikator einen Puffer definieren und dem dann zB. einen Null für Neutral und +/- 1 für Kauf und Verkauf zuweisen.

 
Carl Schreiber:

Indikatoren 'kommunizieren' mit einem EA nur über die Puffer vom Typ double!

Also musst Du in Deinem Indikator einen Puffer definieren und dem dann zB. einen Null für Neutral und +/- 1 für Kauf und Verkauf zuweisen.

Danke für die Antwort. Ich bin aber trotzdem ratlos wie ich auf den double im EA zugreife. Wenn ich beim EA "handle = iCustom(NULL,0,Parameter,Parameter)" eingebe bekomme ich nur unbrauchbares raus. Die handle ist dann nur ein Wert von 0 der bei jedem Tick 1 addiert. 
 
Stell mal den Kursor auf iCustom und drück die Zaubertaste F1 dann öffnet sich die MQL-Referenz zu iCustom mit einem Beispiel.
Grund der Beschwerde: