82 lines
1.8 KiB
MQL5
82 lines
1.8 KiB
MQL5
|
#ifndef FRAMEWORK_KERNEL_ACCOUNT_MQH
|
||
|
#define FRAMEWORK_KERNEL_ACCOUNT_MQH
|
||
|
|
||
|
class kernel_account {
|
||
|
public:
|
||
|
static string company() {
|
||
|
return AccountInfoString ( ACCOUNT_COMPANY );
|
||
|
}
|
||
|
|
||
|
static string server() {
|
||
|
return AccountInfoString ( ACCOUNT_SERVER );
|
||
|
}
|
||
|
|
||
|
static double stopout_level() {
|
||
|
return AccountInfoDouble ( ACCOUNT_MARGIN_SO_SO );
|
||
|
}
|
||
|
|
||
|
static long stopout_mode() {
|
||
|
return AccountInfoInteger ( ACCOUNT_MARGIN_SO_MODE );
|
||
|
}
|
||
|
|
||
|
static double balance() {
|
||
|
return AccountInfoDouble ( ACCOUNT_BALANCE );
|
||
|
}
|
||
|
|
||
|
static double equity() {
|
||
|
return AccountInfoDouble ( ACCOUNT_EQUITY );
|
||
|
}
|
||
|
|
||
|
static long number() {
|
||
|
return AccountInfoInteger ( ACCOUNT_LOGIN );
|
||
|
}
|
||
|
|
||
|
static string currency() {
|
||
|
return AccountInfoString ( ACCOUNT_CURRENCY );
|
||
|
}
|
||
|
|
||
|
static bool is_testing() {
|
||
|
return (bool)MQLInfoInteger ( ( int ) MQL5_TESTING );
|
||
|
}
|
||
|
|
||
|
static bool is_optimization() {
|
||
|
return (bool)MQLInfoInteger ( ( int ) MQL5_OPTIMIZATION );
|
||
|
}
|
||
|
|
||
|
static bool is_trade_allowed() {
|
||
|
return (bool)MQLInfoInteger ( ( int ) MQL5_TRADE_ALLOWED );
|
||
|
}
|
||
|
|
||
|
static bool is_visual_mode() {
|
||
|
return (bool)MQLInfoInteger ( ( int ) MQL5_VISUAL_MODE );
|
||
|
}
|
||
|
|
||
|
|
||
|
static int digits() {
|
||
|
return _Digits;
|
||
|
}
|
||
|
|
||
|
static double margin() {
|
||
|
return AccountInfoDouble ( ACCOUNT_MARGIN );
|
||
|
}
|
||
|
|
||
|
static double free_margin() {
|
||
|
return AccountInfoDouble ( ACCOUNT_MARGIN_FREE );
|
||
|
}
|
||
|
|
||
|
static double free_margin_check ( string symbol,
|
||
|
enum_order_operation_type order_type,
|
||
|
double lot ) {
|
||
|
// return -1;
|
||
|
//return AccountFreeMarginCheck ( symbol,
|
||
|
// kernel_order::convert_order_operation_type ( order_type ),
|
||
|
// lot );
|
||
|
return free_margin() - lot * layer_market::margin_required ();
|
||
|
}
|
||
|
|
||
|
static long leverage() {
|
||
|
return AccountInfoInteger ( ACCOUNT_LEVERAGE );
|
||
|
}
|
||
|
};
|
||
|
|
||
|
#endif
|