symbolinfo_v1

Author: Copyright 2013, papaklass.
0 Views
0 Downloads
0 Favorites
symbolinfo_v1
//+----------------------------------------------------------------------------+
//|                                                             SymbolInfo.mq4 |
//|                                                 Copyright 2013, papaklass. |
//|                                     http://www.mql4.com/ru/users/papaklass |
//-----------------------------------------------------------------------------+
#property copyright "Copyright 2013, papaklass."
#property link      "http://www.mql4.com/ru/users/papaklass"

#property indicator_chart_window

#define amountParam  8
#define sizeText    10

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

extern color                textColor = clrNavy;
extern ENUM_BASE_CORNER     corner    = CORNER_RIGHT_LOWER;
//-----------------------------------------------------------------------------+

string   info[amountParam];
int      constA[amountParam] = { 24, 23, 16, 32, 19, 18, 1, 2 };
int      dgt;
//-----------------------------------------------------------------------------+

int init(){
   
   dgt = Digits;
   info[0] = "  LotStep";
   info[1] = "   MinLot";
   info[2] = "TickValue";
   info[3] = "   Margin";
   info[4] = "SwapShort";
   info[5] = " SwapLong";
   info[6] = " DailyMin";
   info[7] = " DailyMax";
   
   return(0);
}//----------------------------------------------------------------------------+

int deinit(){

   for( int i = 0; i < amountParam; i++ ){
      ObjectDelete(info[i]);
   }

   return(0);
}//----------------------------------------------------------------------------+

int start(){

   //ñîçäàäèì îáúåêòû
   for(int i = 0; i < amountParam; i++ ){
      ObjectCreate( info[i], OBJ_LABEL, 0, 0, 0, 0 );
      ObjectSet( info[i], OBJPROP_CORNER, corner );
      ObjectSet( info[i], OBJPROP_YDISTANCE, (i+1)*14);
      ObjectSet( info[i], OBJPROP_XDISTANCE, 30);
   }
   //âûâåäåì èíôîðìàöèþ îá èíñòðóìåíòå íà ãðàôèê:
   //   - swapLong
   //   - swapShort
   //   - margin
   //   - tickValue
   //   - minLot
   //   - lotStep
   for(int j = 0; j < amountParam; j++ ){
      ObjectSetText( info[j], info[j] + "   " +
                     DblToString( MarketInfo( Symbol(), constA[j] ), dgt, 10 ),
                     sizeText, "Tahoma", textColor
                    ); 
   }

   return(0);
}//----------------------------------------------------------------------------+

string DblToString( double value, int dgtS, int bits ){

   string str;
   int lenght;
   
   str = DoubleToStr( value, dgtS );
   lenght = StringLen( str );
   
   if( lenght < bits ){
      for( int i = bits - lenght; i >= 0; i-- ){
         str = " " + str;
      }
   }

   return( str );
}//----------------------------------------------------------------------------+

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