mirror of
https://github.com/vdemydiuk/mtapi.git
synced 2026-08-18 05:08:11 +00:00
Issue #290: MQL5 - added Timeframe into event MtTimeBarEvent
This commit is contained in:
Binary file not shown.
+5
-2
@@ -82,7 +82,7 @@ void OnTick()
|
|||||||
MqlRates rates_array[];
|
MqlRates rates_array[];
|
||||||
CopyRates(symbol, Period(), 1, 1, rates_array);
|
CopyRates(symbol, Period(), 1, 1, rates_array);
|
||||||
|
|
||||||
MtTimeBarEvent time_bar(symbol, rates_array[0]);
|
MtTimeBarEvent time_bar(symbol, (int)Period(), rates_array[0]);
|
||||||
SendMtEvent(ON_LAST_TIME_BAR_EVENT, time_bar);
|
SendMtEvent(ON_LAST_TIME_BAR_EVENT, time_bar);
|
||||||
}
|
}
|
||||||
lastbar_time_changed = true;
|
lastbar_time_changed = true;
|
||||||
@@ -3663,9 +3663,10 @@ private:
|
|||||||
class MtTimeBarEvent: public MtObject
|
class MtTimeBarEvent: public MtObject
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
MtTimeBarEvent(string symbol, const MqlRates& rates)
|
MtTimeBarEvent(string symbol, int timeframe, const MqlRates& rates)
|
||||||
{
|
{
|
||||||
_symbol = symbol;
|
_symbol = symbol;
|
||||||
|
_timeframe = timeframe;
|
||||||
_rates = rates;
|
_rates = rates;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -3674,12 +3675,14 @@ public:
|
|||||||
JSONObject *jo = new JSONObject();
|
JSONObject *jo = new JSONObject();
|
||||||
jo.put("Rates", MqlRatesToJson(_rates));
|
jo.put("Rates", MqlRatesToJson(_rates));
|
||||||
jo.put("Instrument", new JSONString(_symbol));
|
jo.put("Instrument", new JSONString(_symbol));
|
||||||
|
jo.put("Timeframe", new JSONNumber(_timeframe));
|
||||||
jo.put("ExpertHandle", new JSONNumber(ExpertHandle));
|
jo.put("ExpertHandle", new JSONNumber(ExpertHandle));
|
||||||
return jo;
|
return jo;
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
string _symbol;
|
string _symbol;
|
||||||
|
int _timeframe;
|
||||||
MqlRates _rates;
|
MqlRates _rates;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user