ATR_SL_CHANEL

Author: Kalenzo
ATR_SL_CHANEL
Indicators Used
Indicator of the average true range
Miscellaneous
Implements a curve of type %1
0 Views
0 Downloads
0 Favorites
ATR_SL_CHANEL
//+------------------------------------------------------------------+
//|                                                ATR_SL_CHANEL.mq4 |
//|                                                          Kalenzo |
//|                                                  simone@konto.pl |
//+------------------------------------------------------------------+
#property copyright "Kalenzo"
#property link      "simone@konto.pl"

#property indicator_chart_window
#property indicator_buffers 2
#property indicator_color1 Red
#property indicator_color2 Green
double up[],dn[];
extern int ATR_FACTOR = 3;
//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int init()
  {
//---- indicators
    SetIndexStyle(0,DRAW_LINE,0,1);
    SetIndexBuffer(0,up);
    SetIndexStyle(1,DRAW_LINE,0,1);
    SetIndexBuffer(1,dn);
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| Custor indicator deinitialization function                       |
//+------------------------------------------------------------------+
int deinit()
  {
//---- 
   
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| Custom indicator iteration function                              |
//+------------------------------------------------------------------+
int start()
  {
   
//---- 
   int limit;
   int counted_bars=IndicatorCounted();
   if(counted_bars<0) counted_bars=0;
   if(counted_bars>0) counted_bars--;
   limit=Bars-counted_bars;
   
   for(int i=0;i<limit;i++)
   {
      dn[i] = High[Highest(Symbol(),0,MODE_HIGH,10,i)] - (ATR_FACTOR*iATR(Symbol(),0,10,i));
      up[i] = Low[Lowest(Symbol(),0,MODE_LOW,10,i)] + (ATR_FACTOR*iATR(Symbol(),0,10,i));
   }
//----
   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 ---