Indicators Used
Miscellaneous
0
Views
0
Downloads
0
Favorites
ForsesMomentum
//+------------------------------------------------------------------+
//| ForsesMomentum.mq4 |
//| Cheshir |
//| inst.rabot@gmail.com |
//+------------------------------------------------------------------+
#property copyright "Cheshir"
#property link "inst.rabot@gmail.com"
#property indicator_separate_window
#property indicator_buffers 4
#property indicator_color1 LawnGreen
#property indicator_color2 Tomato
#property indicator_color3 DeepSkyBlue
// Ðåçóëüòèðóþùèé èíäèêàòîð...
#property indicator_color4 White
#property indicator_level1 0.01
#property indicator_level2 -0.01
#property indicator_levelwidth 1
#property indicator_levelcolor Red
#property indicator_levelstyle STYLE_DOT
//--- buffers
double ExtMapBuffer1[];
double ExtMapBuffer2[];
double ExtMapBuffer3[];
double ExtMapBuffer4[];
//---- extern
extern int barsToProcess=100;
//+------------------------------------------------------------------+
//| Custom indicator initialization function |
//+------------------------------------------------------------------+
double bar0 = 0;
double bar1 = 0;
int init()
{
//---- indicators
SetIndexStyle(0,DRAW_HISTOGRAM);
SetIndexBuffer(0,ExtMapBuffer1);
SetIndexStyle(1,DRAW_HISTOGRAM);
SetIndexBuffer(1,ExtMapBuffer2);
SetIndexStyle(2,DRAW_HISTOGRAM);
SetIndexBuffer(2,ExtMapBuffer3);
SetIndexStyle(3,DRAW_LINE,EMPTY,2);
SetIndexBuffer(3,ExtMapBuffer4);
//----
return(0);
}
//+------------------------------------------------------------------+
//| Custom indicator deinitialization function |
//+------------------------------------------------------------------+
int deinit()
{
//----
//----
return(0);
}
//+------------------------------------------------------------------+
//| Custom indicator iteration function |
//+------------------------------------------------------------------+
int start()
{
int counted_bars=IndicatorCounted(),
limit;
if(counted_bars>0)
counted_bars--;
limit=Bars-counted_bars;
// if(limit>barsToProcess)
// limit=barsToProcess;
//----
for(int i=0;i<limit;i++) // Èòàê, çäåñü ìû ïðîáåãàåì ïî áóôåðó, è çàäàåì çíà÷åíèÿ äëÿ ðèñîâàíèÿ...
{
ExtMapBuffer1[i]= getForse(i, 50); // Âûâåäåì, ñèëû äëÿ ïåðèîäà 50
ExtMapBuffer2[i]= getForse(i, 14, false); // è òàê æå ñèëû äëÿ 14...
ExtMapBuffer3[i]= getForse(i, 3, false);
ExtMapBuffer4[i] = ExtMapBuffer1[i] + ExtMapBuffer2[i] + ExtMapBuffer3[i];
}
//----
return(0);
}
//+------------------------------------------------------------------+
double getForse(int candle, int period, bool SMMA=true)
{
if(SMMA){
bar0 = iMA(Symbol(),0,period,0,MODE_SMMA,0,candle);
bar1 = iMA(Symbol(),0,period,0,MODE_SMMA,0,candle+1);
}
if(!SMMA){
bar0 = iMA(Symbol(),0,period,0,MODE_SMA,0,candle);
bar1 = iMA(Symbol(),0,period,0,MODE_SMA,0,candle+1);
}
return((bar0 - bar1)*period*3);
}
Comments
Markdown Formatting Guide
# H1
## H2
### H3
**bold text**
*italicized text*
[title](https://www.example.com)

`code`
```
code block
```
> blockquote
- Item 1
- Item 2
1. First item
2. Second item
---