Trinity-Impulse

Author: Copyright � 2010, basisforex@gmail.com
Trinity-Impulse
Indicators Used
Commodity channel indexForce index
Miscellaneous
Implements a curve of type %1
0 Views
0 Downloads
0 Favorites
Trinity-Impulse
/*------------------------------------------------------------------+
 |                                            Trinity-Impulse.mq4   |
 |                                           basisforex@gmail.com   |
 +------------------------------------------------------------------*/ 
#property copyright "Copyright © 2010, basisforex@gmail.com"
//----
#property indicator_separate_window
//----
#property indicator_buffers 1
#property indicator_color1 Blue
//----
extern int nPeriod = 5;
extern int nLevel  = 34;
//----
double c[];
double f[];
double iCF[];
//+------------------------------------------------------------------+
int init()
 {
   string short_name;
   IndicatorBuffers(3);
   SetIndexStyle(0, DRAW_LINE);
   SetIndexBuffer(0, iCF);
   SetIndexBuffer(1, c);
   SetIndexBuffer(2, f);
   short_name = "Trinity-Impulse("+nPeriod+")";
   IndicatorShortName(short_name);
   SetIndexLabel(0, short_name);
   SetIndexDrawBegin(0, nPeriod);
   return(0);
 }
//+------------------------------------------------------------------+
int start()
 {
   int counted_bars = IndicatorCounted();
   int j;
   j = Bars - nPeriod - 1;
   if(counted_bars >= nPeriod) j = Bars - counted_bars - 1;
   while(j >= 0)
    {      
       c[j] = iCCI(NULL, 0, nPeriod, PRICE_WEIGHTED, j);     
       f[j] = iForce(NULL, 0, nPeriod, MODE_LWMA, PRICE_WEIGHTED, j);
       //----- 
       if(c[j] * f[j] >= nLevel)
        {
          if(c[j] > 0 &&  f[j] > 0)
           {
             iCF[j] = 1;
           }
          if(c[j] < 0 &&  f[j] < 0)
           {
             iCF[j] = -1;
           }
        }           
       else iCF[j] = 0;
       j--;
    }
   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 ---