SWINGMAN_HILO_ACTIVATOR

//+------------------------------------------------------------------+
//|
SwingMan HiLo Activator2.mq4 |
//|
SwingMan |
//|
soc607@t-online.de |
//+------------------------------------------------------------------+
#property copyright "SwingMan"
#property link
"soc607@t-online.de"
#property indicator_chart_window
//---- indicator settings
#property indicator_buffers 2
#property indicator_color1 Red
#property indicator_color2 Green
//---- input parameters ---------------------------------------------extern int Period_HiLo = 10;
//-------------------------------------------------------------------//---- indicator buffers
double BufferHighs[];
double BufferLows[];
//-- Arrays
double dHighs[],dLows[];
//-- variables
int iTrend;
//+------------------------------------------------------------------+
//| Custom indicator initialization function
|
//+------------------------------------------------------------------+
int init()
{
//-- Arrays
ArraySetAsSeries(dHighs,true);
ArraySetAsSeries(dLows,true);
//---- indicator buffers mapping
SetIndexBuffer(0,BufferHighs);
SetIndexBuffer(1,BufferLows);
//---- drawing settings
SetIndexStyle(0,DRAW_LINE,0,1);
SetIndexStyle(1,DRAW_LINE,0,1);

// Highs
// Lows

IndicatorDigits(Digits);
SetIndexDrawBegin(0,Period_HiLo);
SetIndexDrawBegin(1,Period_HiLo);
Page 1

i). //-. } Page 2 . if(Bars<=10) return(0). i). Period_HiLo. //-iTrend = 0. MODE_SMA. i <=limit-1. 0. 0. int limit = Bars . else if (Close[i] < dLows[i]) iTrend = -1. PRICE_HIGH. Comment("SwingMan HiLoActivator2 (" + Period_HiLo +") "). ArrayResize(dHighs.counted_bars. ArrayResize(dLows. //---for (int i = 0. i--) { BufferHighs[i] = EMPTY_VALUE.name for DataWindow and indicator subwindow label IndicatorShortName("SwingMan HiLoActivator2").first trend if (iTrend == 0) { if (Close[i] > dHighs[i]) iTrend = 1. 0. SetIndexLabel(0. if (counted_bars<0) return(-1). } //+------------------------------------------------------------------+ //| Custom indicator iteration function | //+------------------------------------------------------------------+ int start() { int counted_bars=IndicatorCounted()."Lows"). MODE_SMA. PRICE_LOW.SWINGMAN_HILO_ACTIVATOR //---. } //+------------------------------------------------------------------+ //| Custom indicator deinitialization function | //+------------------------------------------------------------------+ int deinit() { return(0).Bars). dLows[i] = iMA(NULL. i >=0.Bars). Period_HiLo. 0. BufferLows[i] = EMPTY_VALUE. SetIndexLabel(1."Highs"). } for (i=limit-Period_HiLo. return(0). if (counted_bars>0) counted_bars--. i++) { dHighs[i] = iMA(NULL.

} } } //---return(0). } } else //-. } else { BufferHighs[i] = dHighs[i].up trend if (iTrend == 1) { if (Close[i] < dLows[i]) { BufferHighs[i] = dHighs[i]. } else { BufferLows[i] = dLows[i]. iTrend = 1. iTrend = -1.down trend if (iTrend == -1) { if (Close[i] > dHighs[i]) { BufferLows[i] = dLows[i]. } //+------------------------------------------------------------------+ Page 3 .SWINGMAN_HILO_ACTIVATOR //-.

Sign up to vote on this title
UsefulNot useful