0
Views
0
Downloads
0
Favorites
DealingWithTime_TestIndi
//+------------------------------------------------------------------+
//| DealingWithTime_TestIndi.mq5 |
//| Calli |
//| https://www.mql5.com/de/users/gooly |
//+------------------------------------------------------------------+
#property copyright "Calli"
#property link "https://www.mql5.com/de/users/gooly"
#property version "1.00"
#property indicator_chart_window
#property indicator_buffers 0
#property indicator_plots 0
#include <DealingWithTime.mqh>
//+------------------------------------------------------------------+
//| Custom indicator initialization function |
//+------------------------------------------------------------------+
int OnInit()
{
//--- indicator buffers mapping
datetime Tme[];
bool isTimeSet = setBokerOffset();
if(!isTimeSet)
{
Print("setBokerOffset failed at OnInit(), it will be set at the first tick");
}
//---
return(INIT_SUCCEEDED);
}
//+------------------------------------------------------------------+
//| Custom indicator iteration function |
//+------------------------------------------------------------------+
int OnCalculate(const int rates_total,
const int prev_calculated,
const int begin,
const double &price[])
{
//---
checkTimeOffset(TimeCurrent()); // check changes of DST
datetime tC, tGMT, tNY, tLon, tFfm, tMosc, tSyd, tTok;
tC = TimeCurrent();
tGMT = TimeCurrent() + OffsetBroker.actOffset; // GMT
tNY = tGMT - (NYShift+DST_USD); // time in New York
tLon = tGMT - (LondonShift+DST_EUR); // time in London
tFfm = tGMT - (FfmShift+DST_EUR); // time in Frankfurt
tSyd = tGMT - (SidneyShift+DST_AUD); // time in Sidney
tMosc = tGMT - (MoskwaShift+DST_RUS); // time in Moscow
tTok = tGMT - (TokyoShift); // time in Tokyo - no DST
string cmmt = StringFormat("\nDST_EUR: %+i DST_USD: %+i DST_AUD: %+i DST_RUS: %+i"+
"\n%-17s %s %s = GMT - (%+3i h)\n%-17s %s %s = GMT - (%+3i h)"+
"\n%-17s %s %s = GMT - (%+3i h)\n%-17s %s %s = GMT - (%+3i h)"+
"\n%-17s %s %s = GMT - (%+3i h)\n%-17s %s %s = GMT - (%+3i h)"+
"\n%-17s %s %s = GMT - (%+3i h)\n%-17s %s %s = GMT - (%+3i h)"+
"\n%-17s %s %s\n%-17s %.2f h %i sec",
DST_EUR,DST_USD,DST_AUD,DST_RUS,
"Broker:", DoWs(tC), _t2s(tC),OffsetBroker.actOffset/3600,
"GMT:", DoWs(tGMT), _t2s(tGMT), 0,
"London:", DoWs(tLon), _t2s(tLon), (LondonShift+DST_EUR)/3600,
"Frankfurt:", DoWs(tFfm), _t2s(tFfm), (FfmShift+DST_EUR)/3600,
"New York:", DoWs(tNY), _t2s(tNY), (NYShift+DST_USD)/3600,
"Sydney:", DoWs(tSyd), _t2s(tSyd), (SidneyShift+DST_AUD)/3600,
"Moscow:", DoWs(tMosc),_t2s(tMosc),(MoskwaShift+DST_RUS)/3600,
"Tokio:", DoWs(tTok), _t2s(tTok), TokyoShift/3600,
"Last Second FX:", DoWs(tC+SecTillClose(tC)),_t2s(tC+SecTillClose(tC)),
"Time FX open:", 1.0*SecTillClose(tC)/3600.0, SecTillClose(tC)
);
//...
Comment(cmmt);
//--- return value of prev_calculated for next call
return(rates_total);
}
//+------------------------------------------------------------------+
Comments
Markdown Formatting Guide
# H1
## H2
### H3
**bold text**
*italicized text*
[title](https://www.example.com)

`code`
```
code block
```
> blockquote
- Item 1
- Item 2
1. First item
2. Second item
---