Indicators Used
Miscellaneous
0
Views
0
Downloads
0
Favorites
w35260
//+------------------------------------------------------------------+
//| w35260.mq4 |
//| IgorS |
//| igor.senych@gmail.com |
//+------------------------------------------------------------------+
#property copyright "IgorS"
#property link "igor.senych@gmail.com"
extern int p_fast = 21;
extern int t_fast = 3;
extern int pr_fast = 0;
extern int p_slow = 34;
extern int t_slow = 3;
extern int pr_slow = 0;
//---- indicator settings
#property indicator_separate_window
#property indicator_buffers 2
#property indicator_color1 Purple
#property indicator_color2 Red
#property indicator_width1 2
//---- indicator parameters
extern int Signal=9;
//---- indicator buffers
double sdlBuffer[];
double SignalBuffer[];
//+------------------------------------------------------------------+
//| Custom indicator initialization function |
//+------------------------------------------------------------------+
int init()
{
//---- drawing settings
SetIndexStyle(0,DRAW_HISTOGRAM);
SetIndexStyle(1,DRAW_LINE);
//---- indicator buffers mapping
SetIndexBuffer(0,sdlBuffer);
SetIndexBuffer(1,SignalBuffer);
//---- name for DataWindow and indicator subwindow label
IndicatorShortName("w35260");
SetIndexLabel(0,"sdl_CD");
SetIndexLabel(1,"Signal");
//---- initialization done
return(0);
}
//+------------------------------------------------------------------+
//| w35260 |
//+------------------------------------------------------------------+
int start()
{
int limit;
int counted_bars=IndicatorCounted();
//---- last counted bar will be recounted
if(counted_bars>0) counted_bars--;
limit=Bars-counted_bars;
//---- sdlcd counted in the 1-st buffer
for(int i=0; i<limit; i++)
sdlBuffer[i]=iCustom(Symbol(),0,"Slope_Direction_Line",p_fast,t_fast,pr_fast,2,i)-iCustom(Symbol(),0,"Slope_Direction_Line",p_slow,t_slow,pr_slow,2,i);
//---- signal line counted in the 2-nd buffer
for(i=0; i<limit; i++)
SignalBuffer[i]=iMAOnArray(sdlBuffer,Bars,Signal,0,MODE_SMA,i);
//---- done
return(0);
}
//+------------------------------------------------------------------+
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
---