Metatrader Forum | Forex Expert-Advisor | Broker & Forex Tools
Zurück   Metatrader Forum | Forex Expert-Advisor | Broker & Forex Tools > Metatrader 4 > Programmierung MQL4
Startseite Registrieren Hilfe Community Kalender Heutige Beiträge Suchen

Programmierung MQL4 Hier gehts rund ums Programmieren in MQL4.

Login
Benutzername:
Kennwort:


Statistik
Themen: 4978
Beiträge: 43266
Benutzer: 7.224
Aktive Benutzer: 75
Links: 84
Wir begrüßen unseren neuesten Benutzer: Sundaytrader
Mit 2.475 Benutzern waren die meisten Benutzer gleichzeitig online (16.01.20 um 22:38).
Neue Benutzer:
vor 4 Tagen
- Sundaytrad...
vor 4 Tagen
- TS_6
vor 6 Tagen
- Mane
vor 2 Wochen
- AlbertZiz
vor 2 Wochen
- michak

Onlineuser
'Wer ist online' anzeigen Benutzer: 0
Gäste: 180
Gesamt: 180
Team: 0
Team:  
Benutzer:  
Freunde anzeigen

Empfehlungen

Like Tree1Likes
  • 1 Post By pako
Thema geschlossen
 
Themen-Optionen Thema durchsuchen Ansicht
  #1 (permalink)  
Alt 20.05.15
Premium Mitglied
 
Registriert seit: Apr 2015
Beiträge: 422
Raul0 befindet sich auf einem aufstrebenden Ast
Standard Fehler mit dem Buffer vom Indikator beim auslesen

Hallo,

Stück für Stück müht es sich vorwärts.

Ich erhalte leider zwei Signale von einem Indikator nicht. Ich bin noch nicht so tief in der Materie, dass ich mich an den Indikator traue.

Die Abfrage, denke ich, habe ich richtig. Für 3 Buffer erhalte ich Werte, nur die zwei Fractalen(FrDn,FrUp) Signalwerte fehlen, da erhalte ich immer 0.

PHP-Code:
string DivOsMA0 iCustom(Symbol(),0,"DivOsMA",12,26,9,1,4,3,0,0);
Print(
"DivOsMA0(Osma): "DivOsMA0);
string DivOsMA1 iCustom(Symbol(),0,"DivOsMA",12,26,9,1,4,3,1,0);
Print(
"DivOsMA1(FrDn): "DivOsMA1);
string DivOsMA2 iCustom(Symbol(),0,"DivOsMA",12,26,9,1,4,3,2,0);
Print(
"DivOsMA2(FrUp): "DivOsMA2);
string DivOsMA3 iCustom(Symbol(),0,"DivOsMA",12,26,9,1,4,3,3,0);
Print(
"DivOsMA3(Macd): "DivOsMA3);
string DivOsMA4 iCustom(Symbol(),0,"DivOsMA",12,26,9,1,4,3,4,0);
Print(
"DivOsMA4(Signal): "DivOsMA4); 
Ich vermute, dass im Indikator ein Schalter noch nicht gesetzt ist. Der Indikator an sich scheint mir ganz brauchbar zur Weiterverwendung.

Über einen kurzen Hinweis würde ich mich freuen.
Gruss,Raul

Indikator: ds_HDiv_OsMA_01
Link: ds_HDiv_OsMA_01 - Desynced Forex MT4 Indicators and Expert Advisors Repository
Code
PHP-Code:
//+------------------------------------------------------------------
//                                                                  ds_HDiv_OsMA.mq4
//                                                                 dolsergon@yandex.ru
//                                                                 icq(qip)-366382375
//+------------------------------------------------------------------+
//|                                                         OsMA.mq4 |
//|                      Copyright © 2004, MetaQuotes Software Corp. |
//|                                       http://www.metaquotes.net/ |
//+------------------------------------------------------------------+
#property  copyright "Copyright © 2004, MetaQuotes Software Corp."
#property  link      "http://www.metaquotes.net/"
//---- indicator settings
#property  indicator_separate_window
#property  indicator_buffers 5
#property  indicator_color1  Silver
#property  indicator_width1  2
#property  indicator_color2  Blue
#property  indicator_width2  1
#property  indicator_color3  Orange
#property  indicator_width3  1
//---- indicator parameters
extern int FastEMA=12;
extern int SlowEMA=26;
extern int SignalSMA=9;

extern int FractRightBars=1;   // êîë-âî áàð ñïðàâà (ôðàêòàë)
extern int FractLeftBars 4;      // êîë-âî áàð ñëåâà (ôðàêòàë)
extern int MaxFanSize 3;         // ìàêñ. êîë-âî ëèíèé â "âååðå"



//---- indicator buffers
double     OsmaBuffer[];
double     MacdBuffer[];
double     SignalBuffer[];
double      FrUpBuffer[];
double      FrDnBuffer[];

string IndName;
//=======================================================================================================================================================================
int init()
  {
//---- 2 additional buffers are used for counting.
   
IndicatorBuffers(5);
//---- drawing settings
   
SetIndexStyle(0,DRAW_HISTOGRAM);
   
SetIndexDrawBegin(0,SignalSMA);
   
IndicatorDigits(Digits+2);
//---- 3 indicator buffers mapping
   
SetIndexBuffer(0,OsmaBuffer);

   
SetIndexBuffer(1,FrDnBuffer);
   
SetIndexStyle(1,DRAW_ARROW);
   
SetIndexArrow(1,119);
   
SetIndexEmptyValue(1,0.0);

   
SetIndexBuffer(2,FrUpBuffer);
   
SetIndexStyle(2,DRAW_ARROW);
   
SetIndexArrow(2,119);
   
SetIndexEmptyValue(2,0.0);

   
SetIndexBuffer(3,MacdBuffer);
   
SetIndexBuffer(4,SignalBuffer);
//---- name for DataWindow and indicator subwindow label
   
IndName="ds_HDiv_OsMA("+FastEMA+","+SlowEMA+","+SignalSMA+")";
   
IndicatorShortName(IndName);
//---- initialization done
   
return(0);
  }
//=======================================================================================================================================================================
void deinit() 
  {

   
ObjectsDeleteAll();
  }
//=======================================================================================================================================================================
//| Moving Average of Oscillator                                     |
int start()
  {
   
int counted_bars=IndicatorCounted();
   if(
counted_bars<0) return(-1);
   if(
counted_bars>0counted_bars--;
   
int limit=Bars-counted_bars;
   if(
counted_bars==0limit-=1+FractLeftBars;

//---- macd counted in the 1-st additional buffer
   
for(int i=0i<limiti++)
      
MacdBuffer[i]=iMA(NULL,0,FastEMA,0,MODE_EMA,PRICE_CLOSE,i)-iMA(NULL,0,SlowEMA,0,MODE_EMA,PRICE_CLOSE,i);
//---- signal line counted in the 2-nd additional buffer
   
for(i=0i<limiti++)
      
SignalBuffer[i]=iMAOnArray(MacdBuffer,0,SignalSMA,0,MODE_SMA,i);
//---- main loop
   
for(i=0i<limiti++)
      
OsmaBuffer[i]=MacdBuffer[i]-SignalBuffer[i];
//---- done

// FRACTALS -------------------------------------------------------------------------------------------------------------------------------------------------------------

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

   
int l_bars,r_bars;
   
int p;
   
double v,v2;

   for(
i=1+FractRightBarsi<limiti++) 
     {

      
l_bars 0;
      
r_bars 0;
      
v=OsmaBuffer[i];
      for(
p=1p<=FractLeftBarsp++) 
        {
         if(
OsmaBuffer[i+p]>v
           {
            
l_bars++;
            
v=OsmaBuffer[i+p];
           }
         else    break;
        }
      
v=OsmaBuffer[i];
      for(
p=1p<=FractRightBarsp++) 
        {
         if(
OsmaBuffer[i-p]>=v
           {
            
r_bars++;
            
v=OsmaBuffer[i-p];
           }
         else    break;
        }
      if((
l_bars==FractLeftBars) && (r_bars==FractRightBars)) 
        {
         
FrDnBuffer[i]=OsmaBuffer[i];
        }

      
l_bars 0;
      
r_bars 0;
      
v=OsmaBuffer[i];
      for(
p=1p<=FractLeftBarsp++) 
        {
         if(
OsmaBuffer[i+p]<v
           {
            
l_bars++;
            
v=OsmaBuffer[i+p];
           }
         else    break;
        }
      
v=OsmaBuffer[i];
      for(
p=1p<=FractRightBarsp++) 
        {
         if(
OsmaBuffer[i-p]<=v
           {
            
r_bars++;
            
v=OsmaBuffer[i-p];
           }
         else    break;
        }
      if((
l_bars==FractLeftBars) && (r_bars==FractRightBars)) 
        {
         
FrUpBuffer[i]=OsmaBuffer[i];
        }

     }

// DIVERGENCE -----------------------------------------------------------------------------------------------------------------------------------------------------------

   
int PointsOffset=9;

   for(
p=1+FractRightBarsp<limitp++) 
     {

      if(
FrUpBuffer[p]!=0
        {
         
int count=0;

         for(
i=FractLeftBars+pi<Barsi++) 
           {
            if(
FrUpBuffer[i]!=0
              {

               if((
FrUpBuffer[i]<FrUpBuffer[p]) && (High[i]>High[p])) 
                 {
                  
DrawIndicatorTrendLine(Time[i],Time[p],OsmaBuffer[i],OsmaBuffer[p],Red,2);
                  
DrawPriceTrendLine(Time[i],Time[p],High[i],High[p],Red,2);
                  
DrawPriceArrow(Time[p-2],Open[p-2]+PointsOffset*Point,Red,167);
                  
count++;
                  if(
count>=MaxFanSize) break;
                 }
               else    break;

              }
           }
        }

      if(
FrDnBuffer[p]!=0
        {
         
count=0;

         for(
i=FractLeftBars+pi<Barsi++) 
           {
            if(
FrDnBuffer[i]!=0
              {

               if((
FrDnBuffer[i]>FrDnBuffer[p]) && (Low[i]<Low[p])) 
                 {
                  
DrawIndicatorTrendLine(Time[i],Time[p],OsmaBuffer[i],OsmaBuffer[p],Green,2);
                  
DrawPriceTrendLine(Time[i],Time[p],Low[i],Low[p],Green,2);
                  
DrawPriceArrow(Time[p-2],Open[p-2]+PointsOffset*Point,Blue,167);
                  
count++;
                  if(
count>=MaxFanSize) break;
                 }
               else    break;

              }
           }
        }

     }


   return(
0);
  }
//=======================================================================================================================================================================
void DrawPriceTrendLine(datetime x1,datetime x2,double y1,
                        
double y2,color lineColor,double style)
  {
   
string label="DivergLine# "+DoubleToStr(x1+x2,0);
   
ObjectDelete(label);
   
ObjectCreate(label,OBJ_TREND,0,x1,y1,x2,y2,0,0);
   
ObjectSet(label,OBJPROP_RAY,0);
   
ObjectSet(label,OBJPROP_COLOR,lineColor);
   
ObjectSet(label,OBJPROP_STYLE,style);
  }
//=======================================================================================================================================================================
void DrawIndicatorTrendLine(datetime x1,datetime x2,double y1,
                            
double y2,color lineColor,double style)
  {
   
int indicatorWindow=WindowFind(IndName);
   if(
indicatorWindow<0)
      return;
   
string label="DivergLine$# "+DoubleToStr(x1+x2,0);
   
ObjectDelete(label);
   
ObjectCreate(label,OBJ_TREND,indicatorWindow,x1,y1,x2,y2,0,0);
   
ObjectSet(label,OBJPROP_RAY,0);
   
ObjectSet(label,OBJPROP_COLOR,lineColor);
   
ObjectSet(label,OBJPROP_STYLE,style);
  }
//=======================================================================================================================================================================
void DrawPriceArrow(datetime x1,double y1,color Color,double style)
  {
   
string label="DivergArrow# "+DoubleToStr(x1,0);
   
ObjectDelete(label);
   
ObjectCreate(label,OBJ_ARROW,0,x1,y1);
   
ObjectSet(label,OBJPROP_ARROWCODE,style);
   
ObjectSet(label,OBJPROP_COLOR,Color);
  }
//+------------------------------------------------------------------+ 
  #2 (permalink)  
Alt 20.05.15
Mitglied
 
Registriert seit: Sep 2012
Beiträge: 224
pako befindet sich auf einem aufstrebenden Ast
Standard

Code:
string DivOsMA0 = iCustom(Symbol(),0,"DivOsMA",12,26,9,1,4,3,0,0);

string DivOsMA0 = iCustom seit wann?
Raul0 likes this.
  #3 (permalink)  
Alt 21.05.15
Premium Mitglied
 
Registriert seit: Apr 2015
Beiträge: 422
Raul0 befindet sich auf einem aufstrebenden Ast
Standard

Wieder Problem mit shift, ok, Danke, ich wäre ehrlich gesagt nicht drauf gekommen, weil ich das Problem zu 100% im Indikator suchte.
Shift 2 bringt Werte.
Thema geschlossen

Lesezeichen

Stichworte
buffer, buffer indikator, indikator, mql4, programmierung, programmierung metatrader


Forumregeln
Es ist Ihnen nicht erlaubt, neue Themen zu verfassen.
Es ist Ihnen nicht erlaubt, auf Beiträge zu antworten.
Es ist Ihnen nicht erlaubt, Anhänge hochzuladen.
Es ist Ihnen nicht erlaubt, Ihre Beiträge zu bearbeiten.

BB-Code ist an.
Smileys sind an.
[IMG] Code ist an.
HTML-Code ist aus.
Trackbacks are aus
Pingbacks are aus
Refbacks are aus




Alle Zeitangaben in WEZ +2. Es ist jetzt 20:16 Uhr.





Suchmaschine - Reisen - Wavesnode - Facebook Forum - Spam Firewall
-----------------------------------------------------------------------------------------------------------------------------
Powered by vBulletin® Version 3.8.5 (Deutsch)
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Powered by vBCMS® 2.7.0 ©2002 - 2024 vbdesigns.de
SEO by vBSEO 3.6.1
Copyright ©2009 - 2023 by Expert-Advisor.com - Das Metatrader Forum
MetaTrader bzw. MetaTrader 4 und MetaTrader 5 sind eingetragene Marken der MetaQuotes Software Corp.
-----------------------------------------------------------------------------------------------------------------------------