Any rookie question, so as not to clutter up the forum. Professionals, don't pass by. Nowhere without you - 6. - page 662

 
berezhnuy:
Well, does anyone already have an RSI iMAOnArray ready to use?

I can see why no one has responded to you with much "help"...
 
berezhnuy:
Well, does anyone already have an RSI iMAOnArray ready to use?

there's one in the kodobase, you just have to look it up
 
Comrades. I decided for the sake of practice to build the simplest display of takeovers. But in the end there was a problem that if I change the timeframe on the chart and return to the timeframe with the absorption, the alert is triggered again. I found an option to alert only once per bar, but again everything resets when I switch timeframes.
if (Bars != ThisBarTrade ) {
   ThisBarTrade = Bars;  // ensure only one trade opportunity per bar
   // Trade logic goes here
}
Here is the code itself, without graphical drawings, only logic. How to correct it?
   if(engulfAlerter && Open[2]>Close[2] && Open[1]<Close[1] && Close[1]>Open[2])
      {
         Alert("Bullish Engulf");
      }
   if(engulfAlerter && Open[2]<Close[2] && Open[1]>Close[1] && Close[1]<Open[2])
      {
         Alert("Bearish Engulf");
      }
P.S. The inductor resets the conditional "ThisBarTrade" during deinitialization while switching to other timeframes.
 

Can you tell me how to separate the ticket for buy and sell separately?

ticket=OrderSend("EURUSD",OP_SELL,SellLot,Bid,3,0,0,",MAGICMA,0,Red);


else

{

OrderSelect(ticket-3,SELECT_BY_POS,MODE_TRADES);

OrderClose(ticket-3,SellLot,Ask,3,Red);


}

ticket-3 specially, TK trade is sort of averaged price across multiple orders ) but how do I separate Buy Tickets from Sell Tickets ? so I can take an order that was opened 3 bays ago ) Also for sell

 

Hello friends!) I have such a problem:

I wrote a prog that opens a template (with the indicators and graphical object I need) on startup, then analyzes the data and trades. when I just run it on a chart, everything works fine. when I run it in a tester, it only works when visualized. i understand that the template can only be loaded on a visually open chart... so it doesn't work in normal test mode, because it just runs on the chart without loading the template... and what about the optimization? i have quite a few parameters, and somehow it's very unreasonable to run each option manually with visualization.

help plz)) how can you solve the problem with the optimization and template?

 
evillive:

Score ))))


But I didn't write in MQL, but formally, that's the problem (:

And how could it be determined?

Since the number of values is very limited, we can check it with a direct brute force:

#property strict

/******************************************************************************/
void fun1(int const A) {
  Print("fun1()");

  if (A == 0 || A == 1) {
    Print("fun1 do!");
  }
}

/******************************************************************************/
void fun2(int const A) {
  Print("fun2()");

  if (A != 2) {
    Print("fun2 do!");
  }
}

/******************************************************************************/
void Гарантия_0_1_2(int const A) {
  switch (A) {
  case 0:
  case 1:
  case 2:
    fun1(A);
    fun2(A);
    break;
  default:
    Print("Не соблюдены условия (теоремы)");
  }
}

/******************************************************************************/
void OnStart() {
  for (int A = 0, limit = 4; A < limit; A++) {
    Print("Проверяем для A = ", A);
    Гарантия_0_1_2(A);
  }
}

Here we get:

22:52:38 Script 3 EURUSDm,H1: loaded successfully
22:52:38 3 EURUSDm,H1: initialized
22:52:38 3 EURUSDm,H1: Проверяем для A = 0
22:52:38 3 EURUSDm,H1: fun1()
22:52:38 3 EURUSDm,H1: fun1 do!
22:52:38 3 EURUSDm,H1: fun2()
22:52:38 3 EURUSDm,H1: fun2 do!
22:52:38 3 EURUSDm,H1: Проверяем для A = 1
22:52:38 3 EURUSDm,H1: fun1()
22:52:38 3 EURUSDm,H1: fun1 do!
22:52:38 3 EURUSDm,H1: fun2()
22:52:38 3 EURUSDm,H1: fun2 do!
22:52:38 3 EURUSDm,H1: Проверяем для A = 2
22:52:38 3 EURUSDm,H1: fun1()
22:52:38 3 EURUSDm,H1: fun2()
22:52:38 3 EURUSDm,H1: Проверяем для A = 3
22:52:38 3 EURUSDm,H1: Не соблюдены условия (теоремы)
22:52:38 3 EURUSDm,H1: uninit reason 0
22:52:38 Script 3 EURUSDm,H1: removed

It turns out that they are equal. If there were not 3 but, say, 3 million values, you could still have a machine check - return the results from the functions and compare them. If no difference is found for the entire range, then they are equal.

If an expression is used instead of a variable, e.g. a function call, then equivalence becomes "equivalence with reservations" because of the short circuit of calculating logical expressions.

 

Hi all!

Made an indicator based on another indicator.

The first buffer counts as it should.

The second one does not: I want it to start counting on every bar after "line1 > 0".

That is basically what I have done in my Expert Advisor:

if (line1 > 0 && time ==0){time=Time[i+0];}//сработало предварительное условие входа, записываем время
if (time > 0)shift=iBarShift(Symbol(),Period(),i+time);//находим индекс бара

And after "shift >= shet", the drawing condition is triggered.

I change external parameters of variable "shet", there is no change in indicator.

What may be the problem?

Indicator code:

#property indicator_buffers 2
#property indicator_color1 Lime 
#property indicator_color2 Red
//--- input parameters
extern int       Period_MA_r=14;
extern int       r2          =7;
extern int       Period_MA_1=46;
extern int       p2          =19;
extern int       shet=7;
extern int       s        =0;
//--- buffers
double ExtMapBuffer1[];
double ExtMapBuffer2[];
//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int init()
  {
//---- indicators
   SetIndexBuffer(0,ExtMapBuffer1);
   SetIndexStyle(0,DRAW_ARROW);
   SetIndexArrow(0,119);
   SetIndexEmptyValue(0,0.0);
   SetIndexBuffer(1,ExtMapBuffer2);
   SetIndexStyle(1,DRAW_ARROW);
   SetIndexArrow(1,119);
   SetIndexEmptyValue(1,0.0);
   IndicatorDigits(Digits+1);
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| Custom indicator deinitialization function                       |
//+------------------------------------------------------------------+
int deinit()
  {
   return(0);
  }
//+------------------------------------------------------------------+
//| Custom indicator iteration function                              |
//+------------------------------------------------------------------+
int start()
  {
   int counted_bars=IndicatorCounted(),
   i,limit1,shift;
   limit1=Bars-counted_bars-1;
   double line1,signal_line;
   static datetime time;
   for(i=limit1;i>=0;i--) 
   {
   line1=0;
   signal_line=0;
   line1=iCustom(NULL,0,"indikator1",Period_MA_r,r2,1,i+0);
   signal_line=iCustom(NULL,0,"indikator2",Period_MA_1,p2,0,i+0);
   
   if (line1 > 0 && time ==0){time=Time[i+0];}//сработало предварительное условие входа, записываем время
   if (time > 0)shift=iBarShift(Symbol(),Period(),i+time);//находим индекс бара
   if (line1 == 0){time=0;}//если индикатор равен нолю, то время сбрасывается на ноль
   if (line1 > 0 && signal_line < s){ExtMapBuffer1[i]=Low[i]-95*Point;}
   if (line1 > 0 && shift >= shet && signal_line < s){ExtMapBuffer2[i]=High[i]+95*Point;}
   }
   return(0);
  }
//+------------------------------------------------------------------+
 
Forexman77:

Hi all!

Made an indicator based on another indicator.

The first buffer counts as it should.

The second one does not: I want it to start counting on every bar after "line1 > 0".

That is basically what I have done in my Expert Advisor:

And after "shift >= shet", the drawing condition is triggered.

I change external parameters of variable "shet", there is no change in indicator.

What may be the problem?

Indicator code:


There's some confusion about adding 0, but try it this way:

//+------------------------------------------------------------------+
//| Custom indicator iteration function                              |
//+------------------------------------------------------------------+
int start()
{
   int counted_bars=IndicatorCounted(),
   i,limit1,shift = 0;
   limit1=Bars-counted_bars-1;
   double line1,signal_line;
   static datetime time;
   for (i=limit1;i>=0;i--) 
   {
       line1=0.;
       signal_line=0.;
       line1 = iCustom (_Symbol, _Period,"indikator1",Period_MA_r,r2,1, i+0);       // Не понятно - зачем прибавлять 0 ???
       signal_line = iCustom (_Symbol, _Period,"indikator2",Period_MA_1,p2,0,i+0);  // Не понятно - зачем прибавлять 0 ???
   
       if (line1 > 0. && time == 0) {time = Time[i+0];}                   //сработало предварительное условие входа, записываем время [тоже + 0]
       if (time > 0.) shift= i + iBarShift (_Symbol, _Period, time);      //находим индекс бара
       if (line1 == 0.) {time = 0;}                                       //если индикатор равен нолю, то время сбрасывается на ноль
       if (line1 > 0.)
       {
           if (signal_line < s)
           {
               ExtMapBuffer1[i] = Low[i] - 95.*Point;
               if (shift >= shet) {ExtMapBuffer2[i] = High[i]+95.*Point;}
           }
       }
   }
   return(0);
}
//+------------------------------------------------------------------+
 

Good afternoon.

In the terminal, if I double click on the order line, a modification window opens.

But if the opening price of one order and the take profit of another order are on the line, the last modified order opens.

Please, advise if mql4 has a function to open the order modification window by clicking the necessary order in the indicator?

 
Is it possible to download charts for technical analysis, in MT-4 - indexes S & P 500 Futures Chart, TA 25 Chart, and S & P 500 Chart if it is possible can tell you how to do it, maybe there is an explanation of how to download!
Reason: