0
Views
0
Downloads
0
Favorites
ATM_Regular_News_Times
//+------------------------------------------------------------------+
//| Dolly_Trading Times #3.mq4 |
//| Copyright © 2006, MetaQuotes Software Corp. |
//| http://www.metaquotes.net |
//+------------------------------------------------------------------+
#property copyright "Copyright © 2006, MetaQuotes Software Corp."
#property link "http://www.metaquotes.net"
#property link " Code used from i-ParamonWorkTime.mq4 "
#property indicator_chart_window
extern string Broker_GMT_Offset = "03:00";
int TradingTimes_NumberOfDays = 1;
extern string ASIAN_News = "23:29";
extern color ASIAN_Color = Yellow;
color ASIAN_TEXT_Color = Yellow;
bool Show_ASIAN_News = true;
extern string EUROPE_News = "06:59";
extern color EUROPE_Color = Lime;
color EUROPE_TEXT_Color = Lime;
bool Show_EUROPE_News = true;
extern string LONDON_News = "07:29";
extern color LONDON_Color = Red;
color LONDON_TEXT_Color = Red;
bool Show_LONDON_News = true;
extern string USA_News = "12:29";
extern color USA_Color = Blue;
color USA_TEXT_Color = Yellow;
bool Show_USA_News = true;
//+------------------------------------------------------------------+
//| Custom indicator initialization function |
//+------------------------------------------------------------------+
void init() {
DeleteObjects();
for (int i=0; i<TradingTimes_NumberOfDays; i++) {
CreateObjects("TradeTIME1"+i, ASIAN_Color);
CreateObjects("TradeTIME2"+i, EUROPE_Color);
CreateObjects("TradeTIME3"+i, LONDON_Color);
CreateObjects("TradeTIME4"+i, USA_Color);
}
}
//+------------------------------------------------------------------+
//| Custor indicator deinitialization function |
//+------------------------------------------------------------------+
void deinit() {
DeleteObjects();
ObjectDelete("TT1");ObjectDelete("TT2");ObjectDelete("TT3");
ObjectDelete("TT4");ObjectDelete("TT5");ObjectDelete("TT6");
ObjectDelete("TT7");ObjectDelete("TT8");
}
void CreateObjects(string TRADETIMES, color cl) {
ObjectCreate(TRADETIMES, OBJ_TREND, 0, 0,0, 0,0);
ObjectSet(TRADETIMES, OBJPROP_STYLE, STYLE_DASHDOT);
ObjectSet(TRADETIMES, OBJPROP_WIDTH,0);
ObjectSet(TRADETIMES, OBJPROP_COLOR, cl);
ObjectSet(TRADETIMES, OBJPROP_BACK, True);
}
void DeleteObjects() {
for (int i=0; i<TradingTimes_NumberOfDays; i++) {
ObjectDelete("TradeTIME1"+i);
ObjectDelete("TradeTIME2"+i);
ObjectDelete("TradeTIME3"+i);
ObjectDelete("TradeTIME4"+i);
}
}
//+------------------------------------------------------------------+
//| Custom indicator iteration function |
//+------------------------------------------------------------------+
void start()
{
datetime dt=CurTime();
for (int i=0; i<TradingTimes_NumberOfDays; i++) {
if (Show_ASIAN_News==true)
{
DrawObjects(dt, "TradeTIME1"+i, ASIAN_News, ASIAN_News);}
if (Show_EUROPE_News==true)
{
DrawObjects(dt, "TradeTIME2"+i, EUROPE_News, EUROPE_News);}
if (Show_LONDON_News==true)
{
DrawObjects(dt, "TradeTIME3"+i, LONDON_News, LONDON_News);}
if (Show_USA_News==true)
{
DrawObjects(dt, "TradeTIME4"+i, USA_News, USA_News);}
}
}
void DrawObjects(datetime dt, string TRADETIMES, string tb, string te) {
datetime t1, t2;
double p1, p2;
int b1, b2;
t1=StrToTime(TimeToStr(dt, TIME_DATE)+" "+tb);
t2=StrToTime(TimeToStr(dt, TIME_DATE)+" "+te);
b1=iBarShift(NULL, 0, t1);
b2=iBarShift(NULL, 0, t2);
p1=High[Highest(NULL, 0, MODE_HIGH, b1-b2, b2)];
p2=Low [Lowest (NULL, 0, MODE_LOW , b1-b2, b2)];
ObjectSet(TRADETIMES, OBJPROP_TIME1 , t1);
ObjectSet(TRADETIMES, OBJPROP_PRICE1, p1);
ObjectSet(TRADETIMES, OBJPROP_TIME2 , t2);
ObjectSet(TRADETIMES, OBJPROP_PRICE2, p2);
}
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
---