Internal bar strength

Author: forex.optimist@gmail.com
Internal bar strength
Indicators Used
Moving average indicator
Miscellaneous
Implements a curve of type %1
0 Views
0 Downloads
0 Favorites
Internal bar strength
//+------------------------------------------------------------------+
//|                    Written by forex.optimist@gmail.com           |
//+------------------------------------------------------------------+
#property copyright "forex.optimist@gmail.com"
#property link      "forex.optimist@gmail.com"

#property indicator_separate_window
#property indicator_buffers 1
#property indicator_color1 Red
#property indicator_width1 2
#property indicator_level1 40
#property indicator_level2 60
#property indicator_maximum 100
#property indicator_minimum 0
//---- buffers
double B1[];
double B2[];
extern int period=5;

//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int init()
  {
//---- indicators
   IndicatorBuffers(2);
   IndicatorShortName("Internal bar strength");
   SetIndexStyle(0,DRAW_LINE);
   SetIndexBuffer(0,B1);
   SetIndexLabel(0, "Internal bar strength"); 
   SetIndexBuffer(1,B2);
   ArraySetAsSeries(B2,false);
//----
   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) return(-1);
     if(counted_bars>0) counted_bars-=10;
     limit=Bars-counted_bars;
     for(int i=limit; i>=0; i--)
       {
       if (High[i] != Low[i])
         B2[i]=((Close[i]-Low[i]) / (High[i]-Low[i]));
       else
         B2[i] = B2[i+1];
       
       }
     for(i=limit; i>=0; i--)
       {
         B1[i] = iMAOnArray(B2,WHOLE_ARRAY,period,0,MODE_SMA,i)*100.0;
       }
  //----
    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 ---