Toute question des nouveaux arrivants sur MQL4 et MQL5, aide et discussion sur les algorithmes et les codes. - page 1492

 
Alexey Viktorov:

Tarasik, je te pisse dessus... Idiot. Regardez le code que nous avons obtenu après vos conseils... Cela s'appelle "vous apprendre comment ne pas le faire", et celui qui ne l'obtient pas, c'est sa propre faute.

Et maintenant on devient personnel et on discute de quel mauvais homme il est.

Alexey Viktorov:

C'est impoli de mentir de façon aussi flagrante. Vous supprimez votre message et vous reportez votre analphabétisme sur quelqu'un d'autre. Menteur.

alors qui est le menteur ici ?)
 
Taras Slobodyanik:

C'est parti, et ensuite on devient tout personnel et on parle de quel mauvais homme il est.

Alors qui est le menteur?)

Lisez mes posts sur la page précédente à ce sujet.

 
Alexey Viktorov:

Oui, je ne l'ai pas supprimé, je n'ai juste pas trouvé immédiatement ce message.

Mais ! Tu continues à te rétracter sur qui tu es.

radis)

 
Taras Slobodyanik:

radis)

Cela répond-il à votre question ?

Forum sur le trading, les systèmes de trading automatisés et les tests de stratégie

Toute question des débutants sur MQL4 et MQL5, toute aide et discussion sur les algorithmes et les codes.

Alexey Viktorov, 2021.06.02 17:41

Je ne l'ai pas supprimé, je n'ai simplement pas trouvé le message immédiatement.


Mais ! Tu te rétractes toujours, qui es-tu ?

:-)))

 
SanAlex:

Le moyen le plus simple et le plus facile est d'obtenir les noms des lignes horizontales ou de tendance à partir de l'indicateur.

- cliquez à droite sur le graphique et trouvez l'élément OBJECT LIST (copier et coller dans Expert Advisor)

Merci pour votre aide ! J'ai jeté un autre coup d'oeil à votre conseiller expert et j'ai utilisé le code :

double price_line_up=ObjectGetDouble(0, "Top",OBJPROP_PRICE) ;

double price_line_down=ObjectGetDouble(0, "Bottom",OBJPROP_PRICE) ;

taper les noms des lignes de l'indicateur. J'obtiens les valeurs mais je ne les ai pas encore toutes vérifiées. Je pense que ça devrait marcher.

 

Bonjour à tous. Les gars, j'ai besoin de votre aide.

J'ai un indicateur stochastique avec allert, il donne un signal sur le croisement des lignes mobiles. Veuillez me dire comment faire pour qu'il donne un signal en croisant le mouvement uniquement lorsqu'il est au-dessus ou au-dessous de la zone de surachat et de survente.

Veuillez me conseiller

#property indicator_separate_window
#property indicator_buffers 4
#property indicator_color1 LightSeaGreen
#property indicator_color2 Red
#property indicator_color3 Blue
#property indicator_color4 Red
#property indicator_level1 80
#property indicator_level2 20
#property indicator_maximum 100
#property indicator_minimum 0

//---- input parameters
/*************************************************************************
PERIOD_M1   1
PERIOD_M5   5
PERIOD_M15  15
PERIOD_M30  30 
PERIOD_H1   60
PERIOD_H4   240
PERIOD_D1   1440
PERIOD_W1   10080
PERIOD_MN1  43200
You must use the numeric value of the timeframe that you want to use
when you set the TimeFrame' value with the indicator inputs.
---------------------------------------
MODE_SMA    0 Simple moving average, 
MODE_EMA    1 Exponential moving average, 
MODE_SMMA   2 Smoothed moving average, 
MODE_LWMA   3 Linear weighted moving average. 
You must use the numeric value of the MA Method that you want to use
when you set the 'ma_method' value with the indicator inputs.

**************************************************************************/
extern int TimeFrame=240;
extern int KPeriod=5;
extern int DPeriod=3;
extern int Slowing=3;
extern int MAMethod=0;
extern int PriceField=0;// PriceField:  0=Hi/Low   1=Close/Close

extern string note_TimeFrames = "M1;5,15,30,60H1;240H4;1440D1;10080W1;43200MN";
extern string __MA_Method = "SMA0 EMA1 SMMA2 LWMA3";
extern string __PriceField = "0=Hi/Low   1=Close/Close";
//extern string __Price = "0O,1C 2H3L,4Md 5Tp 6WghC: Md(HL/2)4,Tp(HLC/3)5,Wgh(HLCC/4)6";


double ExtMapBuffer1[];
double ExtMapBuffer2[];
double ExtMapBuffer3[];
double ExtMapBuffer4[];

datetime last_t=0;
//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int init()
  {
//---- indicator line
   SetIndexBuffer(0,ExtMapBuffer1);
   SetIndexStyle(0,DRAW_LINE);
   SetIndexBuffer(1,ExtMapBuffer2);
   SetIndexStyle(1,DRAW_LINE,STYLE_DOT);
   SetIndexLabel(0,  "MTF_Stochastic("+KPeriod+","+DPeriod+","+Slowing+")TF"+TimeFrame+"");
   SetIndexLabel(1,"MTF_Stochastic("+KPeriod+","+DPeriod+","+Slowing+")TF"+TimeFrame+"");
   SetIndexBuffer(2,ExtMapBuffer3);
   SetIndexStyle(2,DRAW_ARROW);
   SetIndexArrow(2,233);
   SetIndexBuffer(3,ExtMapBuffer4);
   SetIndexStyle(3,DRAW_ARROW);
   SetIndexArrow(3,234);

//---- name for DataWindow and indicator subwindow label   
   switch(TimeFrame)
   {
      case 1 : string TimeFrameStr="Period_M1"; break;
      case 5 : TimeFrameStr="Period_M5"; break;
      case 15 : TimeFrameStr="Period_M15"; break;
      case 30 : TimeFrameStr="Period_M30"; break;
      case 60 : TimeFrameStr="Period_H1"; break;
      case 240 : TimeFrameStr="Period_H4"; break;
      case 1440 : TimeFrameStr="Period_D1"; break;
      case 10080 : TimeFrameStr="Period_W1"; break;
      case 43200 : TimeFrameStr="Period_MN1"; break;
      default : TimeFrameStr="Current Timeframe";
   } 
   IndicatorShortName("MTF_Stochastic("+KPeriod+","+DPeriod+","+Slowing+") "+TimeFrameStr);  
   start();
   return(0);
  }
//----
   
 
//+------------------------------------------------------------------+
//| MTF Stochastic                                                   |
//+------------------------------------------------------------------+
 int deinit()
  {
   for (int i=Bars;i>=0;i--){
      ObjectDelete("st"+Symbol()+Period()+DoubleToStr(KPeriod+DPeriod+Slowing,0)+DoubleToStr(i,0));
   }
   return(0);
  }

bool up_a=false;
bool dn_a=false;
int start()
  {
   datetime TimeArray[];
   ArrayResize(TimeArray,Bars);
   int    i,limit,y=0,counted_bars=IndicatorCounted();
    
// Plot defined timeframe on to current timeframe   
   ArrayCopySeries(TimeArray,MODE_TIME,Symbol(),TimeFrame); 
   
 //  limit=Bars-counted_bars+TimeFrame/Period(); //igorad
limit=Bars-1;
limit=MathMax(limit,TimeFrame/Period());
//limit=MathMin(limit,BarsToCount);
   for(i=0,y=0;i<limit;i++)
   {
   if (Time[i]<TimeArray[y]) y++; 
   
 /***********************************************************   
   Add your main indicator loop below.  You can reference an existing
      indicator with its iName  or iCustom.
   Rule 1:  Add extern inputs above for all neccesary values   
   Rule 2:  Use 'TimeFrame' for the indicator timeframe
   Rule 3:  Use 'y' for the indicator's shift value
 **********************************************************/  
   ExtMapBuffer3[i]=EMPTY_VALUE;  
   ExtMapBuffer4[i]=EMPTY_VALUE;
   ExtMapBuffer1[i]=EMPTY_VALUE;  
   ExtMapBuffer2[i]=EMPTY_VALUE;

   ExtMapBuffer1[i]=iStochastic(NULL,TimeFrame,KPeriod,DPeriod,Slowing,MAMethod,PriceField,0,y);
   ExtMapBuffer2[i]=iStochastic(NULL,TimeFrame,KPeriod,DPeriod,Slowing,MAMethod,PriceField,1,y);
   ObjectDelete("st"+Symbol()+Period()+DoubleToStr(KPeriod+DPeriod+Slowing,0)+DoubleToStr(i,0));   

   if (NormalizeDouble(ExtMapBuffer1[i],Digits)>NormalizeDouble(ExtMapBuffer2[i],Digits) && NormalizeDouble(ExtMapBuffer1[i+1],Digits)<=NormalizeDouble(ExtMapBuffer2[i+1],Digits)  && NormalizeDouble(ExtMapBuffer1[i+1],Digits)!=NormalizeDouble(ExtMapBuffer1[i],Digits) ){
      ExtMapBuffer3[i]=ExtMapBuffer1[i];
      ObjectDelete("st"+Symbol()+Period()+DoubleToStr(KPeriod+DPeriod+Slowing,0)+DoubleToStr(i,0));
      ObjectCreate("st"+Symbol()+Period()+DoubleToStr(KPeriod+DPeriod+Slowing,0)+DoubleToStr(i,0),22,0,Time[i],Low[i]-5*Point);
      ObjectSet("st"+Symbol()+Period()+DoubleToStr(KPeriod+DPeriod+Slowing,0)+DoubleToStr(i,0),6,Blue);
      ObjectSet("st"+Symbol()+Period()+DoubleToStr(KPeriod+DPeriod+Slowing,0)+DoubleToStr(i,0),14,233);      
   }
   if (NormalizeDouble(ExtMapBuffer1[i],Digits)<NormalizeDouble(ExtMapBuffer2[i],Digits) && NormalizeDouble(ExtMapBuffer1[i+1],Digits)>=NormalizeDouble(ExtMapBuffer2[i+1],Digits)  && NormalizeDouble(ExtMapBuffer1[i+1],Digits)!=NormalizeDouble(ExtMapBuffer1[i],Digits)){
      ExtMapBuffer4[i]=ExtMapBuffer1[i];
      ObjectDelete("st"+Symbol()+Period()+DoubleToStr(KPeriod+DPeriod+Slowing,0)+DoubleToStr(i,0));
      ObjectCreate("st"+Symbol()+Period()+DoubleToStr(KPeriod+DPeriod+Slowing,0)+DoubleToStr(i,0),22,0,Time[i],High[i]+5*Point);
      ObjectSet("st"+Symbol()+Period()+DoubleToStr(KPeriod+DPeriod+Slowing,0)+DoubleToStr(i,0),6,Red);
      ObjectSet("st"+Symbol()+Period()+DoubleToStr(KPeriod+DPeriod+Slowing,0)+DoubleToStr(i,0),14,234);      
   }
   }  
     
//
   //----  Refresh buffers ++++++++++++++ 
   if (TimeFrame < Period()) TimeFrame = Period();
   if (TimeFrame>Period()) {
     int PerINT=TimeFrame/Period()+1;
     datetime TimeArr[]; ArrayResize(TimeArr,PerINT);
     ArrayCopySeries(TimeArr,MODE_TIME,Symbol(),Period()); 
     for(i=0;i<PerINT+1;i++) {if (TimeArr[i]>=TimeArray[0]) {
 /********************************************************     
    Refresh buffers:         buffer[i] = buffer[0];
 ************************************************************/  

   ExtMapBuffer1[i]=ExtMapBuffer1[0];
   ExtMapBuffer2[i]=ExtMapBuffer2[0];

   } } }
//+++++++++++++++++++++++++++++++++++++++++++++++++++++   Raff 

   if (ExtMapBuffer3[0]!=EMPTY_VALUE && !up_a){
      up_a=true;
      dn_a=false;    
      Alert("MTF Stochastic Long cross Signal on "+Symbol());
   }
   if (ExtMapBuffer4[0]!=EMPTY_VALUE && !dn_a){
      dn_a=true;
      up_a=false;    
      Alert("MTF Stochastic Short cross Signal on "+Symbol());
   }

   return(0);
  }
 
jarikn:

Bonjour à tous. Les gars, j'ai besoin de votre aide.

J'ai un indicateur stochastique avec allert, il donne un signal sur le croisement des lignes mobiles. Veuillez me dire comment faire pour qu'il donne un signal en croisant le mouvement uniquement lorsqu'il est au-dessus ou au-dessous de la zone de surachat et de survente.

Veuillez me conseiller.

***

Veuillezinsérer le codecorrectement : lorsque vous modifiez un article, cliquez sur Code et insérez votre code dans la fenêtre pop-up.
MQL5.community - Памятка пользователя
MQL5.community - Памятка пользователя
  • www.mql5.com
Вы недавно зарегистрировались и у вас возникли вопросы: Как вставить картинку в сообщение на форуме, как красиво оформить исходный код MQL5, где находятся ваши Личные сообщения? В этой статье мы подготовили для вас несколько практических советов, которые помогут быстрее освоиться на сайте MQL5.community и позволят в полной мере воспользоваться доступными функциональными возможностями.
 
  • //| mymacd v2 12/11/05
    /////////////////////////////////////////////////////////////////////////////////////////////
    #property link "jpygbp@yahoo.com"
    #property indicator_buffers 5
    #property indicator_separate_window
    #property indicator_color1 HotPink    //macd
    #property indicator_color2 Lime     //signal
    #property indicator_color3 Gray  //histogram
    #property indicator_color4 Blue  //macd[1]
    #property indicator_color5 Black     //zero line
    //---- buffers
    double Buffer1[]; //macd
    double Buffer2[]; //signal
    double Buffer3[]; //histogram
    double Buffer4[]; //macd[1]
    double Buffer5[]; //zero line
    //
    extern int FastEMA = 9;
    extern int SlowEMA = 64;
    extern int SignalSMA = 112;
    //extern bool plotMACD = true;
    //extern bool plotSignalLine = true;
    //extern bool plotHistogram = true;
    //extern bool plotMACDOneBarAgo = true;
    //extern bool plotZeroLine = true;
    extern bool plotArrows = false;
    extern double HistThreshold = 0;
    //
    ///////////////////////////////////////////////////////////////////////////////////////////////
    
    int limit = 0;
    int fontsize=10;
    int i = 0;
    bool InLTrade = false;
    bool InSTrade = false;
    /////////////////////////////////////////////////////////////////////////////////////////////
    int init()
    {
       ObjectsDeleteAll();
       //---- indicators
       SetIndexStyle(0,DRAW_LINE,STYLE_SOLID,2);//macd
       SetIndexStyle(1,DRAW_LINE,STYLE_SOLID,2);//signal
       SetIndexStyle(2,DRAW_HISTOGRAM,STYLE_SOLID,2);//hist
       SetIndexStyle(3,DRAW_LINE,STYLE_SOLID,2);//macd[1]
       SetIndexStyle(4,DRAW_LINE,STYLE_SOLID,1);//zero
       //
       SetIndexBuffer(0,Buffer1);
       SetIndexBuffer(1,Buffer2);
       SetIndexBuffer(2,Buffer3); 
       SetIndexBuffer(3,Buffer4); 
       SetIndexBuffer(4,Buffer5); 
       //
       SetIndexDrawBegin(1,SignalSMA);
       //
       IndicatorDigits(MarketInfo(Symbol(),MODE_DIGITS)+1);
       //
       IndicatorShortName("MACD("+FastEMA+","+SlowEMA+","+SignalSMA+")");
       //
       SetIndexLabel(0,"MACD");
       SetIndexLabel(1,"Signal");
       SetIndexLabel(2,"Histogram");
       SetIndexLabel(3,"MACD[1]");
       SetIndexLabel(4,"Zero");
       //
       return(0);
    }
    /////////////////////////////////////////////////////////////////////////////////////////////
    string NewArrow(datetime T1, double P1, color collor) 
    {
       string N=StringConcatenate("A",collor,"-",TimeToStr(T1));
       int AC=SYMBOL_STOPSIGN;
       if(collor==Blue)
          AC=SYMBOL_ARROWUP;
       if(collor==Red) 
          AC=SYMBOL_ARROWDOWN;
       //
       ObjectCreate(N, OBJ_ARROW, 0, T1, P1);
       ObjectSet(N, OBJPROP_ARROWCODE, AC);
       ObjectSet(N, OBJPROP_COLOR, collor);
       ObjectSet(N, OBJPROP_WIDTH, 1);
       ObjectsRedraw();
       return(N);
    }
    /////////////////////////////////////////////////////////////////////////////////////////////
    int deinit()
    {
       ObjectsRedraw();
       return(0);
    }
    /////////////////////////////////////////////////////////////////////////////////////////////
    int start()
    {
       int counted_bars=IndicatorCounted();
       if(counted_bars<0) return(-1);//---- check for possible errors
       if(counted_bars>0) counted_bars--;//---- last counted bar will be recounted
       limit=Bars-counted_bars;
       //
       for(i=0; i<limit; i++)//---- macd counted in the 1-st buffer histogram
          Buffer1[i]=iMA(NULL,0,FastEMA,0,MODE_EMA,PRICE_CLOSE,i)-iMA(NULL,0,SlowEMA,0,MODE_EMA,PRICE_CLOSE,i);
       //
       for(i=0; i<limit; i++)//---- signal line counted in the 2-nd buffer line
          Buffer2[i]=iMAOnArray(Buffer1,Bars,SignalSMA,0,MODE_SMA,i);
       //
       for(i=0; i<limit; i++)//---- histogram is the difference between macd and signal line
       {
          Buffer3[i]=Buffer1[i]-Buffer2[i];
          Buffer5[i]=0;
       }
       //
       for(i=1; i<limit; i++)//---- macd[1]
          Buffer4[i]=iMA(NULL,0,FastEMA,0,MODE_EMA,PRICE_CLOSE,i-1)-iMA(NULL,0,SlowEMA,0,MODE_EMA,PRICE_CLOSE,i-1);
       //
       if (plotArrows)
       {
          ObjectsDeleteAll();
          InLTrade = false;
          InSTrade = false;
          for(int i=Bars;i>=0;i--)
          {
             if ((Buffer3[i-1]  > 0) && (Buffer3[i] < 0) && Buffer3[i-1] > HistThreshold)//Long Begin
             {
               string upArrow1=NewArrow(Time[i-1], High[i-1]+0.0005, Blue);
                InLTrade = true; 
             }
             if ((Buffer3[i-1]  < 0) && (Buffer3[i] > 0) && Buffer3[i-1] < -HistThreshold)//Short Begin
             {
                string dnArrow1=NewArrow(Time[i-1], Low[i-1]-0.0003, Red);
                InSTrade = true; 
                InLTrade = false;  
             }
             if ((InSTrade  == true) && (Buffer3[i-1] > Buffer3[i]))//Short End
             {
                string upArrow2=NewArrow(Time[i-1], Low[i-1]-0.0003, Aqua);
                InSTrade = false; 
             }
             if ((InLTrade == true) && (Buffer3[i-1] < Buffer3[i]))//Long End
             {
                string dnArrow2=NewArrow(Time[i-1], High[i-1]+0.0005, Aqua);
                InLTrade = false;   
             }
          }
       }
       //
       //
       return(0);
    }
    /////////////////////////////////////////////////////////////////////////////////////////////

    J'ai besoin d'aide, il y a un indicateur -Macd, mais quand vous l'ajoutez au graphique et quand vous changez de timeframes, tous les niveaux et objets graphiques disparaissent, comment pouvez-vous le réparer.
Dossiers :
-Macd.ex4  6 kb
-Macd.mq4  5 kb
 
Veuillez m'indiquer comment lister les paramètres de l'indicateur dans iCustom.
Dossiers :
q7iqav.PNG  47 kb
 
Veuillez conseiller mql5, je veux collecter des statistiques sur la taille moyenne d'une bougie de 12 heures, par exemple, aujourd'hui nous sommes vendredi, et je veux prendre les données du jeudi, mercredi, mardi et lundi pour les calculs.
Je prends time[], je convertis TimeToString, puis SplitString et TD. Existe-t-il un moyen plus rapide et moins encombrant de se référer à la même bougie horaire un jour ou plus en arrière ? Bien sûr, je pourrais exécuter le nombre de bougies du cadre temporel actuel en 24 heures, mais j'ai peur que s'il y a des trous dans les cotations, elles soient décalées.
Raison: