Bid_Line_v2

Bid_Line_v2
Price Data Components
Series array that contains open time of each bar
0 Views
0 Downloads
0 Favorites
Bid_Line_v2
#property indicator_chart_window

extern string Line_Name     = "Price_Line_1";
extern double offset        = 0.000;
extern color  Line_Color    = DodgerBlue;
extern string SettingSplt1  = "=========================================";
extern int    Line_Style    = 0;
extern string StyleNumber   = "ª[0=Solid] [1=Dash] [2=Dot] [3=DashDot] ";
extern string SettingSplt2  = "=========================================";
extern string Line_Position = "Close";
extern string PositionType  = "ª[Ask] [Bid] [Close] [Open] [High] [Low]";
extern string SettingSplt3  = "=========================================";
extern color  Clock_Color   = Magenta;
extern bool   Clock_Disp    = true;
extern int    Clock_Xpos    = 6;

int init()
{
   SetIndexLabel(0,NULL);
   return(0);
}
int deinit()
{
   ObjectDelete(Line_Name);
   return(0);
}
int start()
{
   if(ObjectFind(Line_Name) == -1){
      ObjectCreate(Line_Name,OBJ_HLINE,0,0,LP(Line_Position));
      ObjectSet(Line_Name,OBJPROP_COLOR,Line_Color);
   }
   ObjectSet(Line_Name,OBJPROP_PRICE1,LP(Line_Position));
   ObjectSet(Line_Name, OBJPROP_STYLE, Line_Style);
   
   CD(Clock_Disp);
   return(0);
}

double LP(string Pt)
{
   if(Pt=="CLOSE"||Pt=="Close"||Pt=="close")return((offset+Close[0]));
   if(Pt=="ASK"||Pt=="Ask"||Pt=="ask")return((offset+Ask));
   if(Pt=="BID"||Pt=="Bid"||Pt=="bid")return((offset+Bid));
   if(Pt=="OPEN"||Pt=="Open"||Pt=="open")return((offset+Open[0]));
   if(Pt=="HIGH"||Pt=="High"||Pt=="high")return((offset+High[0]));
   if(Pt=="LOW"||Pt=="Low"||Pt=="low")return((offset+Low[0]));
   return((offset+Close[0]));
}

void CD(bool flg)
{
   if(flg)
   {
      double i = 0.0;
      int m,s,k;
      string Margin = "";
      
      m=Time[0]+Period()*60-CurTime();
      i=m/60.0;
      s=m%60;
      m=(m-m%60)/60;
      i=(m/Period()) * 100.0;
      ObjectDelete("time");
      
      if(ObjectFind("time") != 0) {
         for(int x=0; x<=(Clock_Xpos*2); x++) Margin = Margin + "  ";
         ObjectCreate("time", OBJ_TEXT, 0, Time[0], Close[0]);
         ObjectSetText("time", Margin+"<"+m+":"+s+"   /   "+Period() , 8, "Arial", Clock_Color);
      } else ObjectMove("time", 0, Time[0], Close[0]);
      
   } else if(ObjectFind("time") >= 0) ObjectDelete("time");

}

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 ---