Author: VadimVP
Miscellaneous
Implements a curve of type %1
0 Views
0 Downloads
0 Favorites
RoundPrice
//+------------------------------------------------------------------+
//|                                             ËèíèèÊðóãëîéÖåíû.mq4 |
//|                      Copyright © 2010, MetaQuotes Software Corp. |
//|                                        http://www.metaquotes.net |
//+------------------------------------------------------------------+
#property copyright "Copyright © 2010, MetaQuotes Software Corp."
#property link      "http://www.metaquotes.net"

//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
#property copyright "VadimVP"
#property link      "poluyan@fxmail.ru" 
#property indicator_chart_window
#property indicator_buffers 2
#property indicator_color1 White
#property indicator_color2 White


int Limit=10;
int d;
double buf_up[],buf_dn[],buf[];
//+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+
int init()
  {
   SetIndexBuffer(0,buf_up);
   SetIndexStyle(0,DRAW_LINE);
   SetIndexBuffer(1,buf_dn);
   SetIndexStyle(1,DRAW_LINE);
   SetIndexEmptyValue(0,EMPTY_VALUE);
   SetIndexEmptyValue(1,EMPTY_VALUE);

   return(0);
  }
//+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+
int start()
  {
   int i;
   int counted_bars=IndicatorCounted();
   if(counted_bars<0) return(-1);
   if(counted_bars>0) counted_bars--;
   int limit=Bars-counted_bars;
   if(counted_bars==0) limit--;

   ArrayResize(buf,ArraySize(buf_up));
   for(i=limit;i>=0;i--)
     {
      buf_up[i]=EMPTY_VALUE;
      buf_dn[i]=EMPTY_VALUE;
      buf[i]=EMPTY_VALUE;
     }
     
   if(Digits == 5)  d = Digits - 3;
   if(Digits == 4)  d = Digits - 2;
   for(i=limit;i>=0;i--) 
     {
      buf_up[i]=MathCeil(Ask*MathPow(10,d))/MathPow(10,d);
      buf_dn[i]=(MathCeil(Ask*MathPow(10,d)*(-1))*(-1))/MathPow(10,d);
     }
   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 ---