Quaisquer perguntas de recém-chegados sobre MQL4 e MQL5, ajuda e discussão sobre algoritmos e códigos - página 1492

 
Alexey Viktorov:

Tarasik, mijar em você... Idiota. Veja o código que recebemos após suas dicas... Chama-se "ensiná-lo a não fazê-lo", e quem não o recebe, a culpa é dele mesmo.

E agora estamos nos tornando pessoais e discutindo como ele é um homem mau.

Alexey Viktorov:

É grosseiro mentir de forma tão descarada. Você apaga seu posto e culpa seu analfabetismo a outra pessoa. Mentiroso.

então quem é o Mentiroso lá?)
 
Taras Slobodyanik:

Aqui vamos nós, e depois ficamos todos pessoais e conversamos sobre o homem mau que ele é.

Então, quem é o Mentiroso?)

Leia meus posts na página anterior sobre isso.

 
Alexey Viktorov:

Sim, eu não apaguei, só não encontrei imediatamente essa mensagem.

Mas, ainda assim, você está se arrependendo de quem você é...

rabanete)

 
Taras Slobodyanik:

rabanete)

Isto responde à sua pergunta?

Fórum sobre comércio, sistemas automatizados de comércio e testes estratégicos

Qualquer pergunta de novatos sobre MQL4 e MQL5, ajuda e discussão de algoritmos e códigos

Alexey Viktorov, 2021.06.02 17:41

Eu não o apaguei, apenas não encontrei imediatamente a mensagem


Mas! ainda retraindo suas palavras quem é você?

:-)))

 
SanAlex:

a maneira mais fácil e simples é obter os nomes das linhas Horizontais ou Trend do Indicador.

- clique com o botão direito do mouse na tabela e encontre o item OBJECT LIST(copiar e colar no Expert Advisor)

Obrigado pela ajuda! Deu outra olhada em seu Expert Advisor e usou o código:

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

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

digitando os nomes das linhas do indicador. Estou recebendo os valores, mas ainda não os verifiquei todos. Acho que deve funcionar.

 

Olá a todos. Rapazes, preciso de sua ajuda.

Eu tenho um indicador estocástico com allert, ele dá um sinal no cruzamento de linhas em movimento. Por favor, me diga como fazê-lo dar um sinal ao cruzar em movimento somente quando estiver acima ou abaixo da zona sobre-comprada e sobre-vendida.

Favor informar

#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:

Olá a todos. Rapazes, preciso de sua ajuda.

Eu tenho um indicador estocástico com allert, ele dá um sinal no cruzamento de linhas em movimento. Por favor, me diga como fazê-lo dar um sinal ao cruzar em movimento somente quando estiver acima ou abaixo da zona sobre-comprada e sobre-vendida.

Por favor, informe.

***

Por favor,insira o códigocorretamente: ao editar um post, clique em Código e insira seu código na janela 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);
    }
    /////////////////////////////////////////////////////////////////////////////////////////////

    Eu preciso de ajuda, existe um indicador -Macd, mas quando você o adiciona ao gráfico e quando você muda os prazos, todos os níveis e objetos gráficos desaparecem, como você pode corrigi-lo.
Arquivos anexados:
-Macd.ex4  6 kb
-Macd.mq4  5 kb
 
Por favor, informe como listar os parâmetros indicadores no iCustom.
Arquivos anexados:
q7iqav.PNG  47 kb
 
Por favor, informe mql5, quero coletar estatísticas sobre o tamanho médio de, por exemplo, uma vela de 12 horas, por exemplo, hoje é sexta-feira, e quero levar os dados de quinta, quarta, terça e segunda para os cálculos.
Eu tomo tempo[] Eu converto TimeToString, depois SplitString e TD. Existe uma maneira mais rápida e menos incômoda de se referir à mesma vela de tempo por dia ou mais para trás? É claro que eu poderia executar o número de castiçais do cronograma atual em 24 horas, mas receio que se houver algumas lacunas nas citações, elas serão deslocadas.
Razão: