[Archive!] Any rookie question, so as not to clutter up the forum. Professionals, don't pass it by. Couldn't go anywhere without you - 2. - page 464

 

Colleagues help !!! really need AMA indicator which is standard in MT5, but only for MT4 PLEASE!!!

 
Hi, could you please tell me how to do this? I want to add a ZigZag indicator to my EA. How do I compare the prices of peaks 0, 1 and 2.
 
// в модуле extern int ExtDepth = 12; extern int ExtDeviation = 5; extern int ExtBackstep = 3; extern int ShiftBars = 2; // в функции double y3=0, y2=0, y1=0, zz; // экстремумы Зиг-Зага int x3, x2, x1, sh=ShiftBars;// номера баров // Берём три экстремума Зиг-Зага while (y3==0) { zz=iCustom(NULL, 0, "ZigZag", ExtDepth, ExtDeviation, ExtBackstep, 0, sh); if (zz!=0 && zz!=EMPTY_VALUE) { if (y1==0) { x1=sh; y1=zz; } else if (y2==0) { x2=sh; y2=zz; } else if (y3==0) { x3=sh; y3=zz; } } sh++; }
thanks to KimIV
 

how is this possible:

buying on the market,

Ask:1.05310000, Bid:1.05280000, price:1.05310000, sl:1.05251000, tp:0.00000000

gives out error 130.

sl is normalized before transmission.

MODE_STOPLEVEL==0

 
beruk:
thanks to KimIV
Thank you.
 

Why... demo account:

Morning: Market analysis...news for today, levels...Oanda and other % open trades, no indicators...enter trades...on many pairs, with large SL and TP, TP is 2 times larger than SL, set by support and resistance levels, .... I leave monitor until evening.

In the evening: about 55-60% of trades, equity is in profit... I close almost all of them... I keep some of them and average them out by levels...

Why... Real account:I do the morning - after which there is no evening like on the demo..... I leave for an hour or two... as soon as i see a profit i close... then i do a brutal averaging.... ...then I wait for the closing of the series of averages... although the profit on the demo is greater in percentage of the deposit... even without averaging...

I understand that the psychological factor prevents me ... greed ... fear of even 300 ppm to lose ... What do I do? Forget about the real account?

 
demlin:
The expert trades several instruments at the same time
///// Есть некий массив торгуемых инстурментов
string symbolfotrade[] = {"EURUSD", .........}
///// Массив флагов
bool isTradedClosed[] = {false, .....}
bool isTradedOpen[]   = {false, .....}
//// Общая переменная
bool isAllTraded = false;
int  isTradedCount = 0;
start()
  {
   symbfotradeCount = ArraySize(symbolfotrade);
   вначале перебор закрытых ордеров. С конца в начало
   if (!isAllTraded)
     {
      
      Перебор массива торгуемых инструментов
        {
          if (isTradedClosed[i]) continue;


           Перебор закрытых ордеров  с конца в начало
             { 

              Если (символ равен symbolfotrade[i]) то {isTradedClosed[i] = true; isTradedCount++; break}
             {
        }
      Если isTradedCount==symbfotradeCount то  isAllTraded = true; ///// Чтобы не лазать по массивам
     }
   /// ОБнуляем
   ArrayInicialized(isTradedOpen, false);
   Потом перебор по открытым ордерам
     {
       Если (симвло равен symbolfotrade[i]) то isTradedOpen[i] = true;
     }   

   Все теперь если (isTradedOpen[i] = труе и isTradedClosed[i] = труе) то ордер открыт, при этом было закрытие по этому инструменту symbolfotrade[i] ранее.
  

   Только после остальные расчеты

   

  }
 
butthead:

... to forget that the real score...?


that's the answer.
 
Help me understand the code. I don't know how to describe the condition correctly.

Here is a piece of the Expert Advisor.


total=OrdersTotal();

if(total<1)

{

while (d_mn_1>d_pl_1 && (d_mn_0-d_pl_0)>=2) //Пока это условие выполняется открывать только селл при таком условии (iRSI(NULL,0,rsi_period,PRICE_CLOSE,2)>0.7)&&(iRSI(NULL,0,rsi_period,PRICE_CLOSE,0)<0.7)) -какой оператор использовать и как его оформить?
{
OrderSend(Symbol(), OP_SELL, lots, NormalizeDouble(Bid, Digits), 3, /*Ask+10*Point*/0, /*Bid-10*Point*/0, "ADX sell", magic, 0, CLR_NONE);
}

while (d_pl_1>d_mn_1 && (d_pl_0-d_mn_0)>=2) // Пока это условие выполняется открывать только Бай при таком условии (iRSI(NULL,0,rsi_period,PRICE_CLOSE,2)<0.3)&&(iRSI(NULL,0,rsi_period,PRICE_CLOSE,0)>0.3)) - какой оператор использовать и как его оформить?
{
OrderSend(Symbol(), OP_BUY, lots, NormalizeDouble(Ask, Digits), 3, /*Bid-10*Point*/0, /*Ask+10*Point*/0, "ADX buy", magic, 0, CLR_NONE);

}
}
}
}
Can you tell me how to do it correctly?
 
extralifes:

Help me understand the code. I don't know how to describe the condition correctly.

Here's a piece of the EA.
Подскажите как это правильно оформить?

Start by reading https://book.mql4.com/ru/operators/if

Reason: