Questions from a "dummy" - page 206

 
paladin800:
Thank you very much. Your tip made it work! I was guided by the article How to use the Standard Library trade classes when writing an EA and there in the section "1.6 CPositionInfo Class" there is myposition.Type(), which should probably be corrected.
Thank you. Corrected.
 

Has anyone managed to get trading signals from MQL5???

20 торговых сигналов на MQL5
20 торговых сигналов на MQL5
  • 2010.08.17
  • Sergey Gritsay
  • www.mql5.com
В этой статье вы научитесь получать торговые сигналы, необходимые для работы торговой системы. Приведены примеры формирования 20 торговых сигналов в виде отдельных пользовательских функций, которые можно использовать в написании экспертов. Для вашего удобства все функции из статьи собраны в один включаемый mqh-файл, который легко подключается к будущему эксперту.
 

Did this:

CSymbolInfo   mysymbolinfo;
string ClassAsk, FuncAsk;
//---
int OnInit()
{ // ...
mysymbolinfo.Name(_Symbol);
}
void OnTick()
{ // ...
ClassAsk=DoubleToString(mysymbolinfo.Ask(),_Digits);
FuncAsk=DoubleToString(SymbolInfoDouble(_Symbol,SYMBOL_ASK),_Digits);

Comment("ClassAsk=",ClassAsk,",  FuncAsk=",FuncAsk);
// ...

Result:


In the article How to use Standard Library trade classes when writing an EA, section "1.2 Class CSymbolInfo" for msymbol.Ask() it says "Used to get the current Ask price for a set symbol." Maybe something in the article needs to be corrected or I have a mistake somewhere?

 
paladin800:

Did this:

Result:


In the article How to use Standard Library trading classes when writing an EA, section "1.2 Class CSymbolInfo" for msymbol.Ask() it says "Used to get the current Ask price for a set symbol." Maybe something in the article needs to be corrected or I have a mistake somewhere?

Make it like this:

CSymbolInfo   mysymbolinfo;
string ClassAsk, FuncAsk;
//---
int OnInit()
{ // ...
mysymbolinfo.Name(_Symbol);
}
void OnTick()
{ // ...
if(!mysymbolinfo.RefreshRates()) return;
ClassAsk=DoubleToString(mysymbolinfo.Ask(),_Digits);
FuncAsk=DoubleToString(SymbolInfoDouble(_Symbol,SYMBOL_ASK),_Digits);

Comment("ClassAsk=",ClassAsk,",  FuncAsk=",FuncAsk);
// ...
 
uncleVic:

Make it so:

Thanks, it works. Maybe to insert RefreshRates in the class before ask (bid) price definition, otherwise a newbie may understand the wording "Used to get current price..." by analogy with how in MQL4 the current Ask is without refresh of quotes, or add refresh before price definition in the article, or in the example it should be written directly in the article.
 
paladin800:
Thank you, it works. Maybe to insert RefreshRates in class before defining ask (bid) price, otherwise a newbie may understand the wording "Used to get current price..." by analogy with how in MQL4 the current Ask is located without refresh of quotes.
No.
 
uncleVic:
No.

Method Description
mysymbol.RefreshRates() Used to refresh rates. When a new symbol is set, it is called automatically.

mysymbolinfo.Name(_Symbol); 

Then it's not automatic!

 
A100:

Method: mysymbol.RefreshRates()

Description: Used to refresh quotes. When a new symbol is set, it is called automatically.

Method: Description

Mysymbol.RefreshRates() Used to refresh rates. When a new symbol is set, it is called automatically.

Then it turns out that it is not automatic!

It appears to be automatic, but only when a new character is inserted.
 
Reshetov:
It appears to be automatic, but only when a new character is set.
You should then write - when a character is changed
 
A100:
Then you should write - when you change the character
Are you all right in the head? And if the symbol has not yet been set, what are you going to change?
Reason: