Any questions from newcomers on MQL4 and MQL5, help and discussion on algorithms and codes - page 1000

 
cashnewmoney:

The Expert Advisor places only one order per algorithm, consider Sell:

SellOpen = (AC<0.0 && RSI<30 && Close[2]>Open[2] && Close[1]>Open[1] && Low[2]<Low[1] );

How to write the code so that it would continue placing orders while the condition AC<0.0 is present

Check if there is already something in the market:

double profit = 0;
int countBuy=0, countSell=0;
  for(int i = 0; i < OrdersTotal(); i++)
   {
    if(OrderSelect(i, SELECT_BY_POS) && OrderSymbol() == _Symbol && OrderMagicNumber() == Magic)
     {
      if(OrderType() < 2)
        profit += OrderProfit()+OrderCommission()+OrderSwap();

      if(OrderType() == 0)
         countBuy++;
      if(OrderType() == 1)
         countSell++;
     }
   }

If the amount is more than 0, it means that there is an opening according to the algorithm.

if(countBuy>0 && AC<0.0) OpenOrderBuy(...);
...
 
Vitaly Muzichenko:

See if there is already something in the market:

If the number is greater than 0, then there is an opening according to the algorithm, then add by condition

Two errors are given

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

double profit = 0;

int countBuy=0, countSell=0;

for(int i = 0; i < OrdersTotal(); i++)

{

if(OrderSelect(i, SELECT_BY_POS) && OrderSymbol() == _Symbol && OrderMagicNumber() == MAGIC)

{

if(OrderType() < 2)

profit += OrderProfit()+OrderCommission()+OrderSwap();


if(OrderType() == 0)

countBuy++;

if(OrderType() == 1)

countSell++;

}

}

if(countBuy>0 && AC<0.0) -tu OpenOrderBuy(100);

if(countSell>0 && AC<0.0) -then- OpenOrderSell(100);

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

'OpenOrderBuy' - function not defined SA2.mq4 102 29

'OpenOrderSell' - function not defined SA2.mq4 104 30

Where the error is blinking I wrote -there



 
cashnewmoney:

Two errors are given

...

Where the error is blinking I have written -too-.

Please insert the code (and not only) correctly:


MQL5.community - Памятка пользователя
MQL5.community - Памятка пользователя
  • www.mql5.com
Теперь вы можете не только читать статьи и скачивать программы на языке MQL5, но и участвовать в обсуждении интересующих вас тем на Форуме, оставлять комментарии к статьям и опубликованным кодам. Кроме того, вы можете не только выкладывать собственные разработки в Code Base, но и публиковать Статьи, за которые мы предлагаем вознаграждение...
 
Artyom Trishkin:

Please insert the code (and not only) correctly:


I don't get it.?

 
cashnewmoney:

Two errors are given.

This one you can fix yourself - gave an abstract application

if(countBuy>0 && AC<0.0) -тут- OpenOrderBuy(100);
if(countSell>0 && AC<0.0) -тут- OpenOrderSell(100);
 
Vitaly Muzichenko:

This you can do for yourself - gave an abstract application

NO DECOMPILING ALLOWED!

 
cashnewmoney:

With code like that:


I can't get into programming.

Be carefulwith that kind of code. You could get banned even without knowledge of programming. It has all the hallmarks of a decompiled

 
Maxim Kuznetsov:

Be careful with this code. You may get banned without knowledge of programming. It has all the hallmarks of a decompiled

This is the original test EA I replaced the other signs with Li le . No one will understand anything in this one.

 
I'm not putting anything out there, I'm just asking for help on how to do this and that.
 
Vitaly Muzichenko:

Fix it yourself - gave an abstract application

I don't know how to fix it.