b-clock_spread

Author: Copyright � 2005, Nick Bilak
b-clock_spread
Price Data Components
Series array that contains open time of each bar
0 Views
0 Downloads
0 Favorites
b-clock_spread
//+------------------------------------------------------------------+
//|                                                      b-clock.mq4 |
//|                                     Core time code by Nick Bilak |
//|        http://metatrader.50webs.com/         beluck[at]gmail.com |
//|            custom font size color and spread modified by tembox  | 
//+------------------------------------------------------------------+

#property copyright "Copyright © 2005, Nick Bilak"
#property link      "http://metatrader.50webs.com/"

#property indicator_chart_window

extern string FontName   = "Trebuchet MS";
extern int    FontSize   = 12;
extern color  FontColor  = Aqua;
extern bool   ShowSpread = True;
extern int    Distance   = 10;


//---- buffers
double s1[];
//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int init()
  {
    return(0);   
  }
  
int deinit()
  {
    ObjectDelete("time");   
    return(0);   
  }
  
  
//+------------------------------------------------------------------+
//| Custom indicator iteration function                              |
//+------------------------------------------------------------------+
int start()
  {
	 double i;
    int m, s, k, h;
    string ss;

   m = Time[0]+Period()*60-CurTime();
   i = m /60.0;
   s = m % 60;
   m = (m - m % 60) / 60;
   h = i / 60;
   k = m -(h*60);
    
   // Comment( h + " hours " + k + " minutes " + s + " seconds left to bar end");
    ObjectDelete("time");   
//----
    if(ObjectFind("time") != 0)
      { 
        if (Period()<=60) { ss = "< " + DoubleToStr(k,0) + ":" + DoubleToStr(s,0); }
        else { ss = "< " + DoubleToStr(h,0) + ":"+ DoubleToStr(k,0) + ":" + DoubleToStr(s,0); }
        
        if (ShowSpread) 
            { ss = ss +" ("+(Ask-Bid)/Point+")"; }
        
        ObjectCreate("time", OBJ_TEXT, 0, Time[0]+(Distance* PeriodSeconds(PERIOD_CURRENT)), (High[0]+Close[0])/2 ); 
        ObjectSetText("time", ss, FontSize, FontName, FontColor);
      }
    else
      {
        ObjectMove("time", 0, Time[0]+(Distance* PeriodSeconds(PERIOD_CURRENT)), (High[0]+Close[0])/2);
      }
    return(0);
  }
//+------------------------------------------------------------------+


Comments

Markdown supported. Formatting help

Markdown Formatting Guide

Element Markdown Syntax
Heading # H1
## H2
### H3
Bold **bold text**
Italic *italicized text*
Link [title](https://www.example.com)
Image ![alt text](image.jpg)
Code `code`
Code Block ```
code block
```
Quote > blockquote
Unordered List - Item 1
- Item 2
Ordered List 1. First item
2. Second item
Horizontal Rule ---