Skip to content

Commit

Permalink
Fixes compilation warnings in MQL4
Browse files Browse the repository at this point in the history
  • Loading branch information
kenorb committed Sep 19, 2021
1 parent de9a3d3 commit df3c21e
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 11 deletions.
4 changes: 2 additions & 2 deletions Registry.mqh
Original file line number Diff line number Diff line change
Expand Up @@ -24,15 +24,15 @@
* Class to provide storing mechanism.
*/
class Registry {
struct data
struct RegistryData
{
string key;
string val;
};

int handle;
string filename;
data array[], copyArray[];
RegistryData array[], copyArray[];

public:

Expand Down
4 changes: 2 additions & 2 deletions RegistryBinary.mqh
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,15 @@
*/

class RegistryBinary {
struct data
struct RegistryBinaryData
{
int key;
int val;
};

int handle, size;
string filename;
data array[], copyArray[];
RegistryBinaryData array[], copyArray[];

public:

Expand Down
4 changes: 2 additions & 2 deletions Session.mqh
Original file line number Diff line number Diff line change
Expand Up @@ -26,15 +26,15 @@
class Session {
public:

struct data
struct SessionData
{
string key;
string val;
};

int handle;
string filename;
data array[], copyArray[];
SessionData array[], copyArray[];

public:

Expand Down
4 changes: 2 additions & 2 deletions SetFile.mqh
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,14 @@
*/

class SetFile {
struct data
struct SetFileData
{
string key;
string val;
};

int handle, count;
data array[];
SetFileData array[];

public:

Expand Down
6 changes: 3 additions & 3 deletions Trade.mqh
Original file line number Diff line number Diff line change
Expand Up @@ -479,19 +479,19 @@ class Trade {
/**
* Free margin required for opening a position with the volume of one lot in the appropriate direction.
*/
static float GetMarginRequired(string _symbol, ENUM_ORDER_TYPE _cmd = ORDER_TYPE_BUY) {
static double GetMarginRequired(string _symbol, ENUM_ORDER_TYPE _cmd = ORDER_TYPE_BUY) {
#ifdef __MQL4__
return MarketInfo(_symbol, MODE_MARGINREQUIRED);
#else
// https://www.mql5.com/ru/forum/170952/page9#comment_4134898
// https://www.mql5.com/en/docs/trading/ordercalcmargin
double _margin_req;
bool _result = Trade::OrderCalcMargin(_cmd, _symbol, 1, SymbolInfoStatic::GetAsk(_symbol), _margin_req);
return _result ? (float)_margin_req : 0;
return _result ? _margin_req : 0;
#endif
}
float GetMarginRequired(ENUM_ORDER_TYPE _cmd = ORDER_TYPE_BUY) {
return GetMarginRequired(GetChart().GetSymbol(), _cmd);
return (float)GetMarginRequired(GetChart().GetSymbol(), _cmd);
}

/* Lot size methods */
Expand Down

0 comments on commit df3c21e

Please sign in to comment.