Skip to content

Commit

Permalink
Fixes recent syntax errors for C++.
Browse files Browse the repository at this point in the history
  • Loading branch information
nseam committed Mar 8, 2023
1 parent 30d6f7f commit 35cb712
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 14 deletions.
6 changes: 3 additions & 3 deletions Chart.struct.static.h
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ struct ChartStatic {
if (_start < 0) return (-1);
_count = (_count <= 0 ? ChartStatic::iBars(_symbol_tf.Symbol(), _symbol_tf.Tf()) : _count);
ARRAY(double, arr_d);
ARRAY(long, arr_l);
ARRAY(int64, arr_l);
ARRAY(datetime, arr_dt);
ArraySetAsSeries(arr_d, true);
switch (_type) {
Expand Down Expand Up @@ -208,7 +208,7 @@ struct ChartStatic {
if (_start < 0) return (-1);
_count = (_count <= 0 ? iBars(_symbol, _tf) : _count);
ARRAY(double, arr_d);
ARRAY(long, arr_l);
ARRAY(int64, arr_l);
ARRAY(datetime, arr_dt);
ArraySetAsSeries(arr_d, true);
switch (_type) {
Expand Down Expand Up @@ -314,7 +314,7 @@ struct ChartStatic {
}
return _volume;
#else // __MQL5__
ARRAY(long, _arr);
ARRAY(int64, _arr);
ArraySetAsSeries(_arr, true);
return (_shift >= 0 && CopyTickVolume(_symbol, _tf, _shift, 1, _arr) > 0) ? _arr[0] : 0;
#endif
Expand Down
5 changes: 4 additions & 1 deletion Indicator/IndicatorTf.h
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,10 @@ class IndicatorTf : public IndicatorCandle<TFP, double, ItemsHistoryTfCandleProv
/**
* Class constructor with parameters.
*/
IndicatorTf(TFP& _icparams, const IndicatorDataParams& _idparams) : IndicatorCandle(_icparams, _idparams) { Init(); }
IndicatorTf(const TFP& _icparams, const IndicatorDataParams& _idparams)
: IndicatorCandle<TFP, double, ItemsHistoryTfCandleProvider<double>>(_icparams, _idparams) {
Init();
}

/**
* Gets indicator's time-frame.
Expand Down
4 changes: 2 additions & 2 deletions Orders.mqh
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ class Orders {
// Terminal::GetErrorText(GetLastError()));
break;
}
if (Order::OrderSymbol() == _Symbol) {
if (Order::OrderSymbol() == (string)_Symbol) {
double order_tp = Order::OrderTakeProfit();
double order_sl = Order::OrderStopLoss();
switch (Order::OrderType()) {
Expand Down Expand Up @@ -268,7 +268,7 @@ class Orders {
Terminal::GetErrorText(GetLastError()));
break;
}
if (Order::OrderSymbol() == _Symbol) {
if (Order::OrderSymbol() == (string)_Symbol) {
switch (Order::OrderType()) {
case ORDER_TYPE_BUY:
buy_lots += Order::OrderLots();
Expand Down
14 changes: 7 additions & 7 deletions Platform.h
Original file line number Diff line number Diff line change
Expand Up @@ -747,19 +747,19 @@ string TimeToString(datetime value, int mode) {
std::strftime(minutes, 32, "%H:%M", ptm);
std::strftime(seconds, 32, "%S", ptm);

if (mode | TIME_DATE) ss << date;
if (mode & TIME_DATE) ss << date;

if (mode | TIME_MINUTES) {
if (mode | TIME_DATE) {
if (mode & TIME_MINUTES) {
if (mode & TIME_DATE) {
ss << " ";
}
ss << minutes;
}

if (mode | TIME_SECONDS) {
if (mode | TIME_DATE && !(mode | TIME_MINUTES)) {
if (mode & TIME_SECONDS) {
if (mode & TIME_DATE && !(mode & TIME_MINUTES)) {
ss << " ";
} else if (mode | TIME_MINUTES) {
} else if (mode & TIME_MINUTES) {
ss << ":";
}
ss << seconds;
Expand All @@ -785,7 +785,7 @@ bool TimeToStruct(datetime dt, MqlDateTime &dt_struct) {
return true;
}

SymbolGetter::operator string() { return Platform::GetSymbol(); }
SymbolGetter::operator string() const { return Platform::GetSymbol(); }

ENUM_TIMEFRAMES Period() { return Platform::GetPeriod(); }

Expand Down
2 changes: 1 addition & 1 deletion SymbolInfo.extern.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,6 @@ extern bool SymbolInfoTick(string symbol, MqlTick &tick);
// Define external global variables.
class SymbolGetter {
public:
operator string();
operator string() const;
} _Symbol;
#endif

0 comments on commit 35cb712

Please sign in to comment.