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

 

The code I've written detects when the price goes up and outputs the corresponding message, but doesn't output any message when the price goes down.

Note that the variables OldPrice and NewPrice are set globally.

int start()
  {
   NewPrice=Bid;
   if (NewPrice>OldPrice)
   {
   Alert("Цена пошла НАВЕРХ");
   OldPrice=NewPrice;
   }
   else
   {
     if (NewPrice<OldPrice)
      {
         Alert("Цена пошла ВНИЗ");
         OldPrice=NewPrice;
      }
   }
//-------------------------------------------------------------------
    return;
  }
//+------------------------------------------------------------------+
 
Please advise installing Mt4 on the vps, installing an EA, but it is not in the terminal in the navigator
 
Greetings brother traders - programmers!
If so, may I ask whether there are such indicators (attached archive with screenshots)?
If so, what are they called?
I've downloaded the archive with indicators, I don't remember which site they are from. I did not even find any similar ones.
 
Trader7777:

Guys, please help, there is a function that returns the lot of the last open order (which is not yet closed). Can you modify it to return the lot of the next-to-last open order (also not yet closed)? Just do it without using arrays...


Once again, can someone modify it so that the penultimate order is selected rather than the last one?


double FindLastLots (int otype)
{
  double oldopenprice,oldlots;
  int oldticket;
  
  ticket = 0;
  
  for (int i = OrdersTotal()-1; i>=0; i--)
  {
    if (OrderSelect(i, SELECT_BY_POS,MODE_TRADES)) 
    {
      if (OrderSymbol()==Symbol() && OrderMagicNumber()==Magic && OrderType() == otype)
      {
         oldticket = OrderTicket();
         if (oldticket>ticket)
         {
            oldlots = OrderLots();
            ticket = oldticket; 
         } 
      }  
    }
  }
  return (oldlots);
}
 
artmedia70:
You don't have arrays here either. The code is not very reliable. You are looking for the last one in the list of open orders. IMHO, it's not very reliable to link to that. The most reliable way to find the last open order is by its open time (it is the lowest of all)

artmedia70:
You don't have arrays here either. The code is not very reliable. You are looking for the last one in the list of open orders. IMHO, binding to that is not very reliable. The most reliable way to find the last open order is by its open time (it is the lowest of all)


I know they aren't there!)

 
Trader7777:

Once again, can someone modify it so that the penultimate order is selected instead of the last one?



Arrays, example.
 
r772ra:

Arrays, example.

are you kidding or can't you read?
 
Trader7777:

Are you kidding me or can't you read?


I suggested it, it's up to you.

In my opinion, it's the only normal option.

 
skyjet:

Hi! Going to reinstall Windows, but when I move the EAs folder to harddrive, the EAs written recently are gone! Any advice on what to do?

*I can't save the code in a document and then re-create them, because there are a lot of them and I don't want to lose data because of a possible human factor :)


Please, someone please respond! Surely this is not a secret for a select few?
 
skyjet:

Please, someone please come forward! Surely this is not a secret for a select few?

What do you mean there are no experts? If they are written and compiled there should be at least two files on your computer. find them in the right folder and copy them. Your problem is either very simple or completely incomprehensible. Most likely you are just looking in the wrong folder. If you have an updated version (beta or 600), look in addition to /experts also in the folder MQL4/experts.
Reason: