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

 
Alexey Viktorov:
The answer is here.

I don't see a function. Where are the parentheses?

 
Алексей Барбашин:

I don't see the function. Where are the parentheses?


Aren't they in my answer? I showed you what to change, I think that should be enough to make you realise...

 
Алексей Барбашин:

I don't see the function. Where are the parentheses?

There are more links and one of them has this example

void OnInit();

And there are probably others, too...

And the link that the forum engine inserted has such a great example

()

[]

.

Call of the function

Select array element

Allocate a structure element

Left to right

 
Aleksey Vyazmikin:

Aren't they in my answer? Showed you what to change, I think that should be enough to make you realise...


Thank you, Alexei. Understood.

 

Hi all!

Remind me, was there a function in mql4 to check if there was enough money to open a position? Something like:

PositionCheck(Symbol()lot);
Something to quickly check if the deposit is enough to open a position.
 
Lopator:

Hi all!

Remind me, was there a function in mql4 to check if there was enough money to open a position? Something like:

Something to quickly check if the deposit is enough to open a position.
AccountFreeMarginCheck - Информация о счете - Справочник MQL4
AccountFreeMarginCheck - Информация о счете - Справочник MQL4
  • docs.mql4.com
AccountFreeMarginCheck - Информация о счете - Справочник MQL4
 

Hi all, can you tell me why this line outputs a warning ???? And how do I fix it so it doesn't show????

if(!OrderClose(OrderTicket(),OrderLots(),OrderClosePrice(),MarketInfo(OrderSymbol(),MODE_SPREAD)*3,Blue)){

Warning:

possible loss of data due to type conversion.

It frowns in the vicinity of

MarketInfo(OrderSymbol(),MODE_SPREAD)
Thank you!!!!!
 
Mihail Marchukajtes:

Hi all, can you tell me why this line outputs a warning ???? And how do I fix it so it doesn't show????

Warning:

possible loss of data due to type conversion.

It frowns in the vicinity of

Thank you!!!!!
if(!OrderClose(OrderTicket(),OrderLots(),OrderClosePrice(),(int)MarketInfo(OrderSymbol(),MODE_SPREAD)*3,Blue)){
 
Mihail Marchukajtes:

Hi all, can you tell me why this line outputs a warning ???? And how do I fix it so it doesn't show????

Warning:

possible loss of data due to type conversion.

It frowns in the vicinity of

Thank you!!!!!
See what type returns MarketInfo(), and what type requests OrderClose() in place of type mismatch. And put the correct type in parentheses in front of MarketInfo.
 

Thank you very much. All fixed.... Question then one more I have a piece of code which also gave out this error. Do you think my change will have any effect on functional execution after replacement?

It was like this and it gave me an error.

static int lt2=0;
if(TimeCurrent()>lt2+20){
lt2=TimeCurrent();
Pint("Need close BUYLIMIT "+DoubleToString(OrderTicket())+". Trade Context Busy");
}            

I did that and the error went away.

static datetime lt2=0;
if(TimeCurrent()>lt2+20){
lt2=TimeCurrent();
Pint("Need close BUYLIMIT "+DoubleToString(OrderTicket())+". Trade Context Busy");
}

It will greatly change result of work because comparison is used here, so I thought what if suddenly change in data type will change result of this comparison. What do you think?

Reason: