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

 
Maxim Kuznetsov #:

historically there have been situations where Ask Bid has come in non-normalised

have they come in with more characters than on the symbol?

 

Forum on trading, automated trading systems & strategy testing

Any questions from newbies on MQL4 and MQL5, tips and discussion on algorithms and codes

Maxim Kuznetsov, 2022.01.15 11:29

there is unfortunately...

the difference in the use of the two functions :

double foo(someargs..) {
   double tmpdata[];
   ArrayResize(tmpdata,100);
   ...
}
static double tmpdatabar[100];
double bar(someargs..) {
   ...
}

would be significant.

if you know beforehand the maximal volume of an array and it's not too big 🚲

it's better to distribute it beforehand.

And who does that when you need speed, I'm embarrassed to ask?

Here's how it's done:

Forum on trading, automated trading systems and trading strategy testing

Any questions from beginners on MQL4 and MQL5, help and discussion of algorithms and codes

Mihail Matkovskij, 2022.01.15 10:24

input int     trendSlowCountBar=9;

double  MAslowTrend[];

int OnInit() {
  ArrayResize(MAslowTrend, trendSlowCountBar, 0);
  ...
  return(INIT_SUCCEEDED);
}

You may use it as any array and it doesn't matter what kind of array it is.

These are simple things! But no. I'll explain in a hundred pages what is already obvious...

 
Andrey Sokolov #:

did those come with more marks than on the symbol?

????

what kind of signs?

 
Maxim Kuznetsov #:

????

What signs?

Now it will still prove what Ask and Bid come in. And in the new build there will be a failure and the price will not come normalized. Or maybe developers will decide to change the concept (since SL and TP should be normalized, it is possible to make entry prices on the same principle). And they will write that now Ask and Bid must be normalized. And then he will start to run. He will start to rewrite all his applications. And those to whom he has written freelance applications will not be satisfied (because orders will not open normally anymore) and will demand improvements.

 
Andrey Sokolov #:

those came with more marks than on the symbol?

Yes, that's what happened. In general, any floating-point numbers that go to the server - must be normalized - it's axiom of good tone and stable operation (regardless of what was or was not who-said or what is written in the documentation ... (Today says one thing, tomorrow another)).

If you need to build a graph object on the terminal, you don't need to normalize it, but if you request it on the server, you need to

 
Get your head in the game... If the server doesn't accept non-normalised price or lot size values, it can't have non-normalised ones either.
 

I recently noticed this feature

int array[];
Print(array.Size());

Dynamically, an array has all the attributes of an object (as in super high-level languages). What is a static array then?

P.S. Wouldn't it be great if the size could be set like this

array.Size(size);

or

array.Size(size, reserve);

as well as

array.Reserve(reserve);
 
Sergey Dymov a multi-currency EA, everything is working as planned except for opening orders. Please tell me what the problem is.
   if((USDTP<=0)&&(JPYTP>=3)&&(z_USDJPY!=2))
        {
         Alert("Продавай USDJPY. USD=", USDTP, ", JPY=", JPYTP);
         z_USDJPY=2; //
         text_massage="Продавай USDJPY";
         SendNotification(text_massage);
         RefreshRates();
         Ask1=MarketInfo("USDJPY",MODE_ASK);
         Bid1=MarketInfo("USDJPY",MODE_BID);
         Point1=MarketInfo("USDJPY",MODE_POINT);
         OrderSend("USDJPY", OP_BUY, 0.1, Bid1, 3, NormalizeDouble((Ask1+StopLoss*Point1),2), NormalizeDouble((Ask1-TakeProfit*Point1),2), NULL, 0, 0, 0);
        }

I don't get any errors, it just does not open orders.

I don't know what the author's idea was, but the error is that a buy order should be opened at Ask price and not at Bid price. I don't know what the author's idea is, but it is an error... If you do not know what to do, you may open a buy order at Ask price instead of Bid... And stop-loss should be lower and take profit higher... But here it is vice versa.

 
Nikolay Ivanov #:

It's all bullshit, hence it doesn't work...

Любые вопросы новичков по MQL4 и MQL5, помощь и обсуждение по алгоритмам и кодам
Любые вопросы новичков по MQL4 и MQL5, помощь и обсуждение по алгоритмам и кодам
  • www.mql5.com
В этой ветке я хочу начать свою помощь тем, кто действительно хочет разобраться и научиться программированию на новом MQL4 и желает легко перейти н...
 
Mihail Matkovskij #:

well clearly either the order type or the price with stops is messed up... again - it's all at a minimum...

Reason: