Indicators Used
Miscellaneous
0
Views
0
Downloads
0
Favorites
Fractals_Adjustable_Lookback
//+------------------------------------------------------------------+
//| BasketStrengthGroups.mq4 |
//| Copyright © 2007, sjcoinc |
//| sjcoinc2000@yahoo.com |
//+------------------------------------------------------------------+
//smjones ff 2008 http://www.forexfactory.com/showpost.php?p=2384212&postcount=9
//mod. +-leavetrail
#property copyright "Copyright © 2007, sjcoinc"
#property link "sjcoinc2000@yahoo.com"
#property indicator_chart_window
#property indicator_buffers 2
extern color FractalColorUp = Magenta;
extern color FractalColorDn = DeepSkyBlue;
extern int FractalLookback = 3; //non repainting =3; repainting (mt4std) =2;
extern double ArrowOffset = 10;
extern bool leavetrail = false;
double upper[], lower[];
//+------------------------------------------------------------------+
//| Custom indicator initialization function |
//+------------------------------------------------------------------+
int init()
{
//---- indicators
SetIndexBuffer(0,upper);
SetIndexStyle(0,DRAW_ARROW,0,0, FractalColorUp);
SetIndexArrow(0,217);
SetIndexLabel(0,"Upper");
SetIndexBuffer(1,lower);
SetIndexStyle(1,DRAW_ARROW,0,0,FractalColorDn);
SetIndexArrow(1,218);
SetIndexLabel(1,"Lower");
SetIndexEmptyValue(0,EMPTY_VALUE);
SetIndexEmptyValue(1,EMPTY_VALUE);
//----
return(0);
}
//+----------------------------------------------------------------+
//| Custom indicator deinitialization function |
//+------------------------------------------------------------------+
int deinit()
{
//----
Comment(" ");
//----
return(0);
}
//+------------------------------------------------------------------+
//| Custom indicator iteration function |
//+------------------------------------------------------------------+
int start()
{
double up=0,down=0;
int limit;
int counted_bars=IndicatorCounted();
//---- last counted bar will be recounted
if(counted_bars>0) counted_bars--;
limit=Bars-counted_bars;
for(int i=0; i<limit; i++)
{
up = iFractals(Symbol(),0,MODE_UPPER,i+FractalLookback);
down = iFractals(Symbol(),0,MODE_LOWER,i+FractalLookback);
if ( up != 0 ) upper[i+FractalLookback] = up + ArrowOffset*Point;
else if (!leavetrail) upper[i+FractalLookback] = EMPTY_VALUE;
if ( down != 0 ) lower[i+FractalLookback] = down - ArrowOffset*Point;
else if (!leavetrail) lower[i+FractalLookback] = EMPTY_VALUE;
}
//----
//----
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
---