Indicators Used
Miscellaneous
0
Views
0
Downloads
0
Favorites
w35260_Colored
//+------------------------------------------------------------------+
//| 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;
extern int Signal=5;
//---- indicator settings
#property indicator_separate_window
#property indicator_buffers 4
#property indicator_color1 Black
#property indicator_color2 Purple
#property indicator_color3 DarkOrange
#property indicator_color4 Red
#property indicator_width2 2
#property indicator_width3 2
//---- indicator buffers
double ExtBuffer0[];
double ExtBuffer1[];
double ExtBuffer2[];
double ExtBuffer3[];
//+------------------------------------------------------------------+
//| Custom indicator initialization function |
//+------------------------------------------------------------------+
int init()
{
//---- drawing settings
SetIndexStyle(0,DRAW_NONE);
SetIndexStyle(1,DRAW_HISTOGRAM);
SetIndexStyle(2,DRAW_HISTOGRAM);
SetIndexStyle(3,DRAW_LINE);
IndicatorDigits(Digits+1);
//---- 4 indicator buffers mapping
SetIndexBuffer(0,ExtBuffer0);
SetIndexBuffer(1,ExtBuffer1);
SetIndexBuffer(2,ExtBuffer2);
SetIndexBuffer(3,ExtBuffer3);
//---- name for DataWindow and indicator subwindow label
IndicatorShortName("w35260");
SetIndexLabel(1,"sdo");
SetIndexLabel(2,"sdo");
SetIndexLabel(3,"Signal");
//---- initialization done
return(0);
}
//+------------------------------------------------------------------+
//| Awesome Oscillator |
//+------------------------------------------------------------------+
int start()
{
int limit;
int counted_bars=IndicatorCounted();
double prev,current;
//---- last counted bar will be recounted
if(counted_bars>0) counted_bars--;
limit=Bars-counted_bars;
//---- macd
for(int i=0; i<limit; i++)
ExtBuffer0[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);
//---- dispatch values between 2 buffers
bool up=true;
for(i=limit-1; i>=0; i--)
{
current=ExtBuffer0[i];
prev=ExtBuffer0[i+1];
if(current>prev) up=true;
if(current<prev) up=false;
if(!up)
{
ExtBuffer2[i]=current;
ExtBuffer1[i]=0.0;
}
else
{
ExtBuffer1[i]=current;
ExtBuffer2[i]=0.0;
}
}
//---- signal line
for(i=0; i<limit; i++)
ExtBuffer3[i]=iMAOnArray(ExtBuffer0,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
---