Price Data Components
Series array that contains close prices for each bar
0 Views
0 Downloads
0 Favorites
Last_Price
//+------------------------------------------------------------------+
//|                                                   Last_Price.mq4 |
//|                                                   Ex5            |
//|                                                                  |
//+------------------------------------------------------------------+
 

extern string simbol="CLG0#I";  // Ñèìâîë ñî çíàêîì #
extern color  Color_Ask=Red;
extern color  Color_Bid=PowderBlue;
extern bool  comment=true;

#property indicator_chart_window
 //----
 int deinit()
  {
   ObjectDelete("Line_Ask");
   ObjectDelete("Line_Bid");
   return(0);
  }
 //----
 
int start()
  {
   int    counted_bars=IndicatorCounted();
//----


   double ask=MarketInfo(simbol,MODE_ASK);
   double bid=iClose(simbol,0,0);
   
   ObjectCreate("Line_Ask",OBJ_HLINE,0,0,0);              //Ãîðèçîíòàëüíàÿ ëèíèÿ
   ObjectSet("Line_Ask",OBJPROP_COLOR,Color_Ask);
   ObjectMove("Line_Ask",0,ask,ask); 
   
   ObjectCreate("Line_Bid",OBJ_HLINE,0,0,0);              //Ãîðèçîíòàëüíàÿ ëèíèÿ
   ObjectSet("Line_Bid",OBJPROP_COLOR,Color_Bid);
   ObjectMove("Line_Bid",0,bid,bid); 
   
   if(comment==true) Comment(simbol,"  Ask:",ask,"  Bid:",bid,"  Ñïðåä:",(ask-bid)/Point);
   RefreshRates();
   
//----
   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 ---