Skip to content

Commit d333bc7

Browse files
committed
Add account info and fix somethings
1 parent 62c696f commit d333bc7

File tree

3 files changed

+39
-2
lines changed

3 files changed

+39
-2
lines changed
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
//+------------------------------------------------------------------+
2+
//| Copyright 2018, Erlon F. Souza |
3+
//| https://github.com/erlonfs |
4+
//+------------------------------------------------------------------+
5+
6+
#property copyright "Copyright 2018, Erlon F. Souza"
7+
#property link "https://github.com/erlonfs"
8+
#property version "1.0"
9+
10+
class Account
11+
{
12+
private:
13+
ENUM_ACCOUNT_TRADE_MODE _tradeMode;
14+
ENUM_ACCOUNT_MARGIN_MODE _marginMode;
15+
16+
public:
17+
18+
Account(){
19+
_tradeMode = (ENUM_ACCOUNT_TRADE_MODE)AccountInfoInteger(ACCOUNT_TRADE_MODE);
20+
_marginMode = (ENUM_ACCOUNT_MARGIN_MODE)AccountInfoInteger(ACCOUNT_MARGIN_MODE);
21+
}
22+
23+
bool IsReal(){
24+
return _tradeMode == ACCOUNT_TRADE_MODE_REAL;
25+
}
26+
27+
bool IsDemo(){
28+
return _tradeMode == ACCOUNT_TRADE_MODE_DEMO;
29+
}
30+
31+
bool IsHedging(){
32+
return _marginMode == ACCOUNT_MARGIN_MODE_RETAIL_HEDGING;
33+
}
34+
35+
36+
37+
};
178 Bytes
Binary file not shown.

Include/BadRobot.Framework/Logger.mqh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,14 +35,14 @@ class Logger
3535

3636
string newText = (TimeToString(TimeCurrent(), TIME_SECONDS)) + " > " + text;
3737

38-
if(_logs[0] == NULL){
38+
if(Logger::Last() == NULL){
3939
Add(newText);
4040
return;
4141
}
4242

4343
string textAux[];
4444

45-
StringSplit(_logs[0], 62, textAux);
45+
StringSplit(Logger::Last(), 62, textAux);
4646
StringTrimLeft(textAux[1]);
4747
StringTrimRight(textAux[1]);
4848

0 commit comments

Comments
 (0)