0 Views
0 Downloads
0 Favorites
ind Spread
ÿþ#property copyright "Copyright © 2021, https://cmillion.ru"

#property link      "ea@cmillion.ru"

#property version "1.0"

#property strict



#property indicator_chart_window

#property indicator_buffers 0

#property indicator_plots   0



sinput int font_size = 15;

sinput color clr = clrRed;



//+------------------------------------------------------------------+

void LabelCreate(const long              chart_ID=0,               // ID 3@0D8:0 

                 const string            name="Label",             // 8<O <5B:8 

                 const int               sub_window=0,             // =><5@ ?>4>:=0 

                 const int               x=0,                      // :>>@48=0B0 ?> >A8 X 

                 const int               y=0,                      // :>>@48=0B0 ?> >A8 Y 

                 const ENUM_BASE_CORNER  corner=CORNER_LEFT_UPPER, // C3>; 3@0D8:0 4;O ?@82O7:8 

                 const string            text="Label",             // B5:AB 

                 const string            font="Arial",             // H@8DB 

                 const int               fontsize=10,             // @07<5@ H@8DB0 

                 const color             clr1=clrBlack,             // F25B 

                 const double            angle=0.0,                // =0:;>= B5:AB0 

                 const ENUM_ANCHOR_POINT anchor=ANCHOR_CENTER,// A?>A>1 ?@82O7:8 

                 const bool              back=false,               // =0 704=5< ?;0=5 

                 const bool              selection=true,          // 2K45;8BL 4;O ?5@5<5I5=89 

                 const bool              hidden=true,              // A:@KB 2 A?8A:5 >1J5:B>2 

                const long             z_order=0,

                const string           podskazka="")                // ?@8>@8B5B =0 =060B85 <KHLN 

  { 

   ResetLastError(); 

   if(ObjectFind(chart_ID,name)==-1) 

   { 

      if(!ObjectCreate(chart_ID,name,OBJ_LABEL,sub_window,0,0)) 

      { 

         return; 

      } 

   } 

   ObjectSetInteger(chart_ID,name,OBJPROP_XDISTANCE,x); 

   ObjectSetInteger(chart_ID,name,OBJPROP_YDISTANCE,y); 

   ObjectSetInteger(chart_ID,name,OBJPROP_CORNER,corner); 

   ObjectSetString(chart_ID,name,OBJPROP_TEXT,text); 

   ObjectSetString(chart_ID,name,OBJPROP_FONT,font); 

   ObjectSetInteger(chart_ID,name,OBJPROP_FONTSIZE,fontsize); 

   ObjectSetDouble(chart_ID,name,OBJPROP_ANGLE,angle); 

   ObjectSetInteger(chart_ID,name,OBJPROP_ANCHOR,anchor); 

   ObjectSetInteger(chart_ID,name,OBJPROP_COLOR,clr1); 

   ObjectSetInteger(chart_ID,name,OBJPROP_BACK,back); 

   ObjectSetInteger(chart_ID,name,OBJPROP_SELECTABLE,selection); 

   ObjectSetInteger(chart_ID,name,OBJPROP_SELECTED,selection); 

   ObjectSetInteger(chart_ID,name,OBJPROP_HIDDEN,hidden); 

   ObjectSetInteger(chart_ID,name,OBJPROP_ZORDER,z_order); 

   ObjectSetString(chart_ID,name,OBJPROP_TOOLTIP,podskazka);

  } 

//+------------------------------------------------------------------+

void OnInit()

  {

   LabelCreate(0,"Spread",0,150,30,CORNER_LEFT_UPPER,"Spread","Arial",font_size,clr);

  }

//+------------------------------------------------------------------+

void OnDeinit(const int reason)

{

   ObjectDelete(0,"Spread");

}

//+------------------------------------------------------------------+

int OnCalculate(const int rates_total,

                const int prev_calculated,

                const datetime &time[],

                const double &open[],

                const double &high[],

                const double &low[],

                const double &close[],

                const long &tick_volume[],

                const long &volume[],

                const int &spread[])

  {

   ObjectSetString(0,"Spread",OBJPROP_TEXT,StringConcatenate("Spread = ",SymbolInfoInteger(_Symbol,SYMBOL_SPREAD))); 



   return(rates_total);

  }

//+------------------------------------------------------------------+

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