Learning and writing together in MQL5 - page 30

 
О. So I'll put it in the same folder and...
 
AUser:

Listen, people, what is the initial value of the variable string?

Writing here If string equals :?, but what does it equal? "", " ", 0 - doesn't seem to work. Of course, one can skip strings and use clear int, but it will be better to use letters))))


"" - means an empty string value, the same will be true for (string)0.

But "0" is a 48-character character.

 
Urain:

"" - means an empty string value, the same will be true for (string)0.

But "0" is a 48 character string.

if (Statys != "In progress" && Statys != "Busy")
{Statys = "Free";}
Or else: if (Statys == "")
 
AUser:
if (Statys != "In progress" && Statys != "Busy")
{Statys = "Free";}
But it doesn't work: if (Statys == "")

Why doesn't it work? It works, and it's even a rather popular option,

but the question was about initialisation.

 
Something about the Unicode question can't be answered. In the terminal help under "Client terminal / Getting started / Directory and file structure" it says

All text files are in Unicode format, so you have to use the correct software to edit them."

The point is that there is at least one Unicode standard. Which one should you use if you are programming in an editor other than a meta-editor?

 
drknn:

The point is that there is at least one Unicode standard. Which one should be used when programming in editors other than the meta-editor?

Can you provide a link to the source?
 
drknn:

The point is that there is at least one Unicode standard. Which one should be used when programming in an editor other than the meta-editor?

Since programs are written for Windows, the Unicode is used in its format. UTF-16LE is a two-byte Little Endian with a 0xFFFE token.

 

I don't see any fundamental difference:

void OpenSell()
{
MqlTradeRequest o; MqlTradeResult p;
double Bid = SymbolInfoDouble(_Symbol,SYMBOL_BID);

o.action = TRADE_ACTION_PENDING;
o.symbol = _Symbol;
o.volume = Lot;
o.price = Bid - Otklonenie;
o.sl = 0;
o.tp = 0;
o.type = ORDER_TYPE_SELL_STOP;
o.type_filling = ORDER_FILLING_AON;
o.type_time = ORDER_TIME_GTC;
OrderSend(o,p);

if (p.retcode == 10009)
{
Tiket = p.order;
Price = /*p.price;*/ Bid - Otklonenie;
Statys = In progress;
}

}

However, the commented variant does not open trades in tests. What's the catch? The difference in accuracy is quite small.

Документация по MQL5: Стандартные константы, перечисления и структуры / Торговые константы / Свойства ордеров
Документация по MQL5: Стандартные константы, перечисления и структуры / Торговые константы / Свойства ордеров
  • www.mql5.com
Стандартные константы, перечисления и структуры / Торговые константы / Свойства ордеров - Документация по MQL5
 
Urain:

Why wouldn't it work, it does, and it's even quite common,

but the question was about initialisation.

Check it yourself:

string Statys;

void OnTick()
{
if(Statys == "")
{OpenBuy();}
}

void OpenBuy()
{
MqlTradeRequest o; MqlTradeResult p;
double Ask = SymbolInfoDouble(_Symbol,SYMBOL_ASK);

o.action = TRADE_ACTION_PENDING;
o.symbol = _Symbol;
o.volume = 1;
o.price = Ask + 0.1;
o.sl = 0;
o.tp = 0;
o.type = ORDER_TYPE_BUY_STOP;
o.type_filling = ORDER_FILLING_AON;
o.type_time = ORDER_TIME_GTC;
OrderSend(o,p);

}

The trades do not go that way)) Pair for the test USDJPY

Документация по MQL5: Стандартные константы, перечисления и структуры / Торговые константы / Свойства ордеров
Документация по MQL5: Стандартные константы, перечисления и структуры / Торговые константы / Свойства ордеров
  • www.mql5.com
Стандартные константы, перечисления и структуры / Торговые константы / Свойства ордеров - Документация по MQL5
 
AUser:

Check it yourself:

...

Will Pushkin initialise?

string Statys="";
if(Statys == "")Print("Yes");