Price Data Components
Miscellaneous
0
Views
0
Downloads
0
Favorites
SymbolInfo
//+------------------------------------------------------------------+
//| SymbolInfo.mq4 |
//| Êèì Èãîðü Â. aka KimIV |
//| http://www.kimiv.ru |
//| 02.04.2006 Ñêðèïò äëÿ âûãðóçêè èíôîðìàöèè î ñèìâîëàõ. |
//| 04.05.2006 Äîáàâèë ñòîëáåö "Çàëîã". |
//+------------------------------------------------------------------+
#property copyright "Êèì Èãîðü Â. aka KimIV"
#property link "http://www.kimiv.ru"
#property show_inputs
//------- Âíåøíèå ïàðàìåòðû ñêðèïòà ---------------------------------+
extern string siFileName = "SymbolInfo.csv";
extern string siSeparator = ".";
//------- Ãëîáàëüíûå ïåðåìåííûå ñêðèïòà -----------------------------+
string siMS[16]={"AUDUSD","CHFJPY","EURAUD","EURCAD","EURCHF",
"EURGBP","EURJPY","EURUSD","GBPCHF","GBPJPY",
"GBPUSD","GOLD","NZDUSD","USDCAD","USDCHF","USDJPY"};
//+------------------------------------------------------------------+
//| script program start function |
//+------------------------------------------------------------------+
void start()
{
double b, ls, z;
double aud = MarketInfo("AUDUSD", MODE_BID);
double eur = MarketInfo("EURUSD", MODE_BID);
double gbp = MarketInfo("GBPUSD", MODE_BID);
double nzd = MarketInfo("NZDUSD", MODE_BID);
int d, i, k;
string st;
FileDelete(siFileName);
st = ";" + TimeToStr(LocalTime(), TIME_DATE) + ";" + AccountCompany();
WritingLineInFile(siFileName, st);
WritingLineInFile(siFileName, "");
st = "¹;Ñèìâîë;Long;Short;Ñïðýä;Ñòîïû;Êîíòðàêò;Çàëîã";
WritingLineInFile(siFileName, st);
for(i = 0; i < ArraySize(siMS); i++)
{
b = MarketInfo(siMS[i], MODE_BID);
d = MarketInfo(siMS[i], MODE_DIGITS);
ls = MarketInfo(siMS[i], MODE_LOTSIZE);
z = 0;
st = DoubleToStr(i + 1, 0) + ";" +
siMS[i] + ";" +
DoubleToStr(MarketInfo(siMS[i], MODE_SWAPLONG), 2) + ";" +
DoubleToStr(MarketInfo(siMS[i], MODE_SWAPSHORT), 2) + ";" +
DoubleToStr(MarketInfo(siMS[i], MODE_SPREAD), 0) + ";" +
DoubleToStr(MarketInfo(siMS[i], MODE_STOPLEVEL), 0) + ";" +
DoubleToStr(ls, 0) + ";";
if(d == 2)
k = 10000;
else
k = 100;
if(StringSubstr(siMS[i], 0, 3) == "AUD")
z = ls*aud / 100;
if(StringSubstr(siMS[i], 0, 3) == "EUR")
z = ls*eur / 100;
if(StringSubstr(siMS[i], 0, 3) == "GBP")
z = ls*gbp / 100;
if(StringSubstr(siMS[i], 0, 3) == "NZD")
z = ls*nzd / 100;
if(StringSubstr(siMS[i], 0, 3) == "USD")
z = ls / 100; // else z = ls*b / k;
st = st + DoubleToStr(z, 2);
if(siSeparator != ".")
st = StrTran(st, ".", siSeparator);
WritingLineInFile(siFileName, st);
}
st = "Ñôîðìèðîâàí ôàéë: " + siFileName;
Comment(st);
Print(st);
}
//+------------------------------------------------------------------+
//| Çàìåíà ïîäñòðîêè |
//| Ïàðàìåòðû: |
//| str - òåêñòîâàÿ ñòðîêà, â êîòîðîé ïðîèçâîäèòñÿ çàìåíà |
//| strfrom - çàìåíÿåìàÿ ïîäñòðîêà |
//| strto - çàìåíÿþùàÿ ïîäñòðîêà |
//+------------------------------------------------------------------+
string StrTran(string str, string strfrom, string strto)
{
int n;
string outstr = "", tempstr;
for(n = 0; n < StringLen(str); n++)
{
tempstr = StringSubstr(str, n, StringLen(strfrom));
if(tempstr == strfrom)
{
outstr = outstr + strto;
n = n + StringLen(strfrom) - 1;
}
else
outstr = outstr + StringSubstr(str, n, 1);
}
return(outstr);
}
//+------------------------------------------------------------------+
//| Çàïèñü ñòðîêè â ôàéë |
//+------------------------------------------------------------------+
void WritingLineInFile(string FileName, string text)
{
int file_handle = FileOpen(FileName, FILE_READ|FILE_WRITE, " ");
if(file_handle > 0)
{
FileSeek(file_handle, 0, SEEK_END);
FileWrite(file_handle, text);
FileClose(file_handle);
}
}
//+------------------------------------------------------------------+
Comments
Markdown Formatting Guide
# H1
## H2
### H3
**bold text**
*italicized text*
[title](https://www.example.com)

`code`
```
code block
```
> blockquote
- Item 1
- Item 2
1. First item
2. Second item
---