mirror of
https://github.com/vdemydiuk/mtapi.git
synced 2026-07-27 18:47:55 +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[];
|
||||
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);
|
||||
}
|
||||
lastbar_time_changed = true;
|
||||
@@ -3663,9 +3663,10 @@ private:
|
||||
class MtTimeBarEvent: public MtObject
|
||||
{
|
||||
public:
|
||||
MtTimeBarEvent(string symbol, const MqlRates& rates)
|
||||
MtTimeBarEvent(string symbol, int timeframe, const MqlRates& rates)
|
||||
{
|
||||
_symbol = symbol;
|
||||
_timeframe = timeframe;
|
||||
_rates = rates;
|
||||
}
|
||||
|
||||
@@ -3674,12 +3675,14 @@ public:
|
||||
JSONObject *jo = new JSONObject();
|
||||
jo.put("Rates", MqlRatesToJson(_rates));
|
||||
jo.put("Instrument", new JSONString(_symbol));
|
||||
jo.put("Timeframe", new JSONNumber(_timeframe));
|
||||
jo.put("ExpertHandle", new JSONNumber(ExpertHandle));
|
||||
return jo;
|
||||
}
|
||||
|
||||
private:
|
||||
string _symbol;
|
||||
int _timeframe;
|
||||
MqlRates _rates;
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user