Questions from Beginners MQL5 MT5 MetaTrader 5 - page 835

 
pivomoe:
This is how it should be.

2795/2797 will be 0. Since rounding is not performed. Either write s3 = (double)s2/s1; or select double for s2 and s1 at once

Thank you!

 
pivomoe:

Thank you. I solved the problem.

It turned out that theStavka variable before Print. was equal to -1. Its value was passed into the Print function and saved as a copy. My functionMatOgidanieStavk changed theStavkavariable itselfand not its copy that will be printed.

The problem lies not only in its copy but also in the calculations sequence when passed to the Print() function.

The parameters are calculated there from right to left.

First, the oldStavka is calculated and then the value calculated in the function is written to this variable (i.e.,the value ofStavka has changed via reference). This changed value prints the second print.

If you change the sequence of parameters in the first print you will see it.

Write parameterStavka firstthen function. Itwill printStavka calculated in the function which comes later.

That's the tricky part ))

 
Hello! I can't open a position, it says "not enough money". Demo account. I have 7,000,000 in my account. I tried $50. Can't open a position.

 
RashRash:
Hello, I cannot open a position, I keep getting "Not enough money". Demo account. I have 7,000,000 in my account. I tried $50. It does not work.

You must have tried 50 lots, not $50? Little information, what currency pair, what leverage on the demo account? What and how did you try? Buy? Sell?

By the way, just as an example,1 lot for EUR/USD= 100 000 EUR.

 
Alexandr Saprykin:

You must have tried 50 lots, not $50? Little information, what currency pair, what leverage on the demo account? What and how did you try? Buy? Sell?

By the way, just as an example.1 lot for EUR/USD= 100 000 EUR.

I tried 1 lot as well, but the answer is the same!

 
Doesn't open any positions at all! Neither 1 lot nor 100!
 
RashRash:
"Not enough money"

Too many trades (by volume) have been opened.

Can you open a new order after closing all the trades?

 
All the deals are closed, as late as yesterday...
Reason: