Questions from Beginners MQL5 MT5 MetaTrader 5 - page 23

 
andm2:

I'm trying to find out the value of one lot with SymbolInfoDouble(Symbol(),SYMBOL_MARGIN_INITIAL),but the result is =0.Can you tell me what's wrong?

https://www.mql5.com/ru/forum/1111/page95#comment_14665

 
 
Good day! I am trying to write a distinction for the selected position - buy or sell. I am writing it this way.
 if (PositionGetInteger(POSITION_TYPE)== ??? {
What should I compare it with? I do not see it in the reference. There it really is not written, it is not false and True, some kind of ENUM_POSITION_TYPE, I click on it and the link leads to the same table.
 
Dimka-novitsek:
Good day! I am trying to make a distinction for a position - buy or sell. I am writing it this way. With what should it be compared? I do not see it in the help. There it really is not written, it is not false and True, it is some ENUM_POSITION_TYPE, I click on it and the link leads to the same table.

There is a table at the very bottom of the page

compare with

POSITION_TYPE_BUY for BUY and

POSITION_TYPE_SELL for SELL

 
Thank you!!!!
 
I'm sorry, could you please write a few lines above and let's say I have an order selected somehow, not a position. Here I use the function PositionGetDouble, what will happen? What will this function report, and will it report anything?
 
Dimka-novitsek:
Excuse me, let's say, a few lines above, I have an order selected, not a position. Here I use the PositionGetDouble function, what will happen? What will the function report, and will it report anything?

The function will give out something, but there is no guarantee, before using the PositionGetDouble function you should use PositionSelect(symbol)

if it hasn't been called before.

It looks like moving the cursor to the right line. If the cursor is already on the correct line (the situation when the PositionSelect(symbol) function was called earlier in the code and returned true), one can use the PositionGetXXX or PositionSetXXX functions immediately; if the cursor is on another line, it needs to be positioned first.

 
THANK YOU!!!
 
Dimka-novitsek:
THANK YOU!!!
Corrected the comment.
 
THANK YOU!!! I understood the whole point, it is important to choose the right order, or even to check
 string PositionSymboll = "";
   if  (PositionSymboll=PositionGetSymbol(i))

if (PositionSymboll = ="")