Questions from Beginners MQL4 MT4 MetaTrader 4 - page 94

 
Vasili Taucci:
The task is to interactively change an EA on a chart. The variant with several charts and several EAs is not considered.
I know version about using ChartApplyTemplate and it works, but sometimes it returns false response (in loop constant response) on the grounds that it cannot place command in the queue.
What kind of queue is this, where can I read about it or how can I clear this queue, since my task should have priority over all others?

Tried a different approach: you need to change the strategy! I put everything in one Expert Advisor. First, I managed scripts and global variables. Then I managed with buttons. One is green - the rest are yellow. As soon as I press the yellow one, it becomes green and the strategy changes. Then I left one small button. I pressed one button and the described buttons appeared. I press yellow button and strategy changes and buttons disappear. Then I taught the Expert Advisor to choose ...

 
STARIJ:

Tried a different approach: you need to change the strategy! I put everything in one EA. First I managed scripts and global variables. Then I managed with buttons. One is green - the others are yellow. As soon as I press the yellow one, it becomes green and the strategy changes. Then I left one small button. I pressed one button and the described buttons appeared. I press yellow button and strategy changes and buttons disappear. Then I taught the Expert Advisor to choose ...


in my case there are no source EAs. I'm just writing a manager by others ))

 

Help me understand. why buy positions are not opening. what is wrong with if ... else if OB=false by default



double lot=0.01;
bool OB=false;
string simb=Symbol();

int start()
{

 while(true)
  {
    if(OB=true)break;
    else
    {
    int ticket=OrderSend(simb,OP_BUY,lot,Ask,4,0,0);
    }
 if(ticket>0)
        {
        Alert("Open");
        }
        else Alert("Not open");
 int Error = GetLastError();
  switch(Error)
    {
    default: Alert("Error is NO = ",Error);
    }
    break;
   
  }
  return;
 }
 

 
Baruandreas:

помогите разобраться. почему не открываются позиции на покупку. что не так с  if ... else если OB=false по умолчанию


bool OB=false;

...
 while(true)

  {
    if(OB=true)break;
    else
    {
    int ticket=OrderSend(simb,OP_BUY,lot,Ask,4,0,0);
    }

...



In the line"if(OB=true)" you are assigning the value true to OB right inside the condition check. Do not confuse the assignment operator "=" with the comparison operator "==". Besides, it makes no sense to compare a Boolean variable to true. And there's no point in else for the operator, which we'll still exit the loop if it works, either.

The correct way would be

if(OB)break;
int ticket=OrderSend(simb,OP_BUY,lot,Ask,4,0,0);

 

should or should not it be checked? what could be the consequences?

 
Baruandreas:

should or should not you check? what are the consequences?

A warning is a potential mistake. It is advisable to eliminate it so that there are no consequences

 

Hello!

In my platform EAs were always taken from C:\Program Files (x86)\Broker\MQL4\Experts, now after restarting MT4 they started from C:\Users\Nauris\AppData\Roaming\MetaQuotes\Terminal\E1563977DAC5C4226D329EB321915A56\MQL4\Experts. How can I set up the first option back in the platform ?

 
Baruandreas:

should or shouldn't I check? What are the consequences?

Warnings are distracting. All are being eliminated. In this case, I do this:

bool x;
x=OrderSend(...);
.....................
x=...

in the future, if desired, a check can be added

 

Hello! Can you tell me why I can't download free EAs and indicators? It says "Do I have a terminal?" I press yes - and that's the end of it, no download. ??

 
MisterBond:

Hello! Can you tell me why I can't download free EAs and indicators? It says "Do I have a terminal?" I press yes - and that's the end of it, no download. ??


Look in the navigator. the file's small, it's a quick download. it installs right into mt4.

Reason: