Price Data Components
0
Views
0
Downloads
0
Favorites
b-clockN_mtf
//+------------------------------------------------------------------+
//| b-clock_mtf: added mtf comments;I/Oswitches; b-clock.mq4 |
//| forexTSD.com 2007 ki Core time code by Nick Bilak |
//| http://metatrader.50webs.com/ beluck[at]gmail.com |
//| modified by adoleh2000 and dwt5 |
//+------------------------------------------------------------------+
#property copyright "Copyright © 2005, Nick Bilak"
#property link "http://metatrader.50webs.com/"
#property indicator_chart_window
extern int TimeFrame=0;
extern string TimeFrames = "M1;5,15,30,60H1;240H4;1440D1;10080W1;43200MN|0-CurrentTF";
extern color ClockColor = Magenta;
extern bool showTF_D1 = true;
extern bool showTF_H4 = true;
extern bool showTF_H1 = true;
extern bool showTF_M30 = true;
extern bool showTF_M15 = true;
extern bool showTF_M5 = true;
extern bool showTF_M1 = true;
extern bool LastTick_Time = true;
string commTF,comm, comm1,comm2,comm3, comm4, comm5,comm6,comm7,comm8;
//---- buffers
double s1[];
//+------------------------------------------------------------------+
int deinit() {
ObjectDelete("time");
Comment("");
return(0);
}
//+------------------------------------------------------------------+
//| Custom indicator initialization function |
//+------------------------------------------------------------------+
int init()
{
}
return(0);
//void deinit()
// {
// Comment("");
// }
//+------------------------------------------------------------------+
//| Custom indicator iteration function |
//+------------------------------------------------------------------+
int start()
{
commTF= ""; comm= ""; comm1= ""; comm2= ""; comm3= ""; comm4= ""; comm5= ""; comm6= ""; comm7= ""; comm8= "";
double i,i1,i2,i3,i4,i5,i6,i7;
int m,s,k,
m1,m2,m3,m4,m5,m6,m7,
s1,s2,s3,s4,s5,s6,s7,
h,h1,h2,h3,h4,h5,h6,h7;
// if (TimeFrame ==0) comm="(Current)";
if (TimeFrame ==0)TimeFrame=Period();
m=iTime(NULL,TimeFrame,0)+TimeFrame*60 - TimeCurrent();
// m=Time[0]+Period()*60-CurTime();
m1=iTime(NULL,1440,0)+1440*60-CurTime();
m2=iTime(NULL,240,0)+240*60-CurTime();
m3=iTime(NULL,60,0)+60*60-CurTime();
m4=iTime(NULL,30,0)+30*60-CurTime();
m5=iTime(NULL,15,0)+15*60-CurTime();
m6=iTime(NULL,5,0)+5*60-CurTime();
m7=iTime(NULL,1,0)+1*60-CurTime();
i=m/60.0;
i1=m1/60.0;
i2=m2/60.0;
i3=m3/60.0;
i4=m4/60.0;
i5=m5/60.0;
i6=m6/60.0;
i7=m7/60.0;
s=m%60;
s1=m1%60;
s2=m2%60;
s3=m3%60;
s4=m4%60;
s5=m5%60;
s6=m6%60;
s7=m7%60;
m=(m-m%60)/60;
m1=(m1-m1%60)/60;
m2=(m2-m2%60)/60;
m3=(m3-m3%60)/60;
m4=(m4-m4%60)/60;
m5=(m5-m5%60)/60;
m6=(m6-m6%60)/60;
m7=(m7-m7%60)/60;
h=m/60;
h1=m1/60;
h2=m2/60;
h3=m3/60;
h4=m4/60;
h5=m5/60;
h6=m6/60;
h7=m7/60;
//---
// comm =
//"Current TF: " + h + " hour(s) "+ (m-(h*60)) + " min. " + s + " sec. left to bar end;\n";
commTF =
"TF["+TimeFrame+"]"+comm+": "+ m + " min " + s + " sec left to bar end;\n";
if (showTF_D1) comm1 =
"TF D1: "+ h1 + " h "+ (m1-(h1*60)) + " m " + s1 + " s; ";
if (showTF_H4) comm2 =
" TF H4: "+ h2 + " h "+ (m2-(h2*60)) + " m " + s2 + " s;\n";
if (showTF_H1) {comm3 =
"TF H1: " + (m3-(h3*60)) + " m " + s3 + " s; ";}
if (showTF_M30) {comm4 =
" TF M30: " + (m4-(h4*60)) + " m " + s4 + " s;\n";}
if (showTF_M15) {comm5=
"TF M15: "+ (m5-(h5*60)) + " m " + s5 + " s; ";}
if (showTF_M5) {comm6=
" TF M5: " + (m6-(h6*60)) + " m " + s6 + " s; ";}
if (showTF_M1) {comm7=
" TF M1: " + s7 + " s.\n";}
if (LastTick_Time) {comm8=
"Last Tick: "+TimeToStr(CurTime(),TIME_DATE|TIME_SECONDS)+"";}
// Comment( m + " minutes " + s + " seconds left to bar end");
Comment(commTF,comm, comm1,comm2,comm3, comm4, comm5,comm6,comm7,comm8);
ObjectDelete("time");
if(ObjectFind("time") != 0)
{
ObjectCreate("time", OBJ_TEXT, 0, Time[0], Close[0]+ 0.0005);
ObjectSetText("time", " <"+m+":"+s, 8, "Arial", ClockColor);
}
else
{
ObjectMove("time", 0, Time[0], Close[0]+0.0005);
}
return(0);
}
//+------------------------------------------------------------------+
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
---