Price Data Components
Indicators Used
Miscellaneous
0
Views
0
Downloads
0
Favorites
TP_SAR_Colored_Arrows
//+------------------------------------------------------------------+
//| TP_SAR_Colored_Arrows.mq4 |
//| Ron Mauldin |
//| http://fx41.com |
//+------------------------------------------------------------------+
#property copyright "Ron Mauldin"
#property link "http://fx41.com"
#property indicator_color1 Red
#property indicator_color2 Chartreuse
#property indicator_chart_window
#property indicator_buffers 2
#property indicator_width1 2
#property indicator_width2 2
double sarUp[],sarDn[];//buffers
double SAR_Step = 0.04;
double SAR_Maximum = 0.5;
int SAR_Precision = 7;
//+------------------------------------------------------------------+
//| Custom indicator initialization function |
//+------------------------------------------------------------------+
int init(){
//---- indicators
SetIndexStyle(0,DRAW_ARROW);
SetIndexStyle(1,DRAW_ARROW);
SetIndexBuffer(0,sarDn);
SetIndexBuffer(1,sarUp);
SetIndexArrow(0,226);
SetIndexArrow(1,225);
IndicatorShortName("SAR Colored Arrows");
SetIndexLabel(0,"SAR Down Channel");
SetIndexLabel(1,"SAR Up Channel");
SetIndexDrawBegin(0,2);
SetIndexDrawBegin(1,2);
//----
return(0);
}
//+------------------------------------------------------------------+
//| Custor indicator deinitialization function |
//+------------------------------------------------------------------+
int deinit(){return(0);}
//+------------------------------------------------------------------+
//| Custom indicator iteration function |
//+------------------------------------------------------------------+
int start(){
int counted_bars = IndicatorCounted();
if(counted_bars<0) counted_bars=0;
if(counted_bars>0) counted_bars--;
int limit = (Bars - 1 - counted_bars);
for(int bar = limit; bar >= 0; bar--){
double sar = NormalizeDouble(iSAR(Symbol(),0,SAR_Step,SAR_Maximum,bar),SAR_Precision);
if(sar >= iHigh(Symbol(),0,bar)){
sarUp[bar] = 0;
sarDn[bar] = sar;
}else{
sarUp[bar] = sar;
sarDn[bar] = 0;
}
}
//----
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
---