Here is the mt4 code for the “double starc”, one indicator with both sets of lines. You can change the colors if you like, but to keep it in the spirit of Tymen, they are pink here. .
//+------------------------------------------------------------------+
//| originally |
//|STARCBands.mq4 |
//| Copyright � 2005, [email protected] |
//| http://www.fxfisherman.com/ |
//| Updated by Husky to have 2 sets of bands for the Tymen Method |
//+------------------------------------------------------------------+
#property copyright "Copyright � 2005, [email protected]"
#property link "http://www.fxfisherman.com/"
#property indicator_chart_window
#property indicator_buffers 8
//---- indicator parameters
extern int MA_Period=6;
extern int ATR_Period=15;
extern double KATR=1;
extern double MKATR =0.45;
extern int Shift=1;
extern color UpperColor=Pink;
extern color MUpperColor=Pink;
extern color MiddleColor=Pink;
extern color MLowerColor=Pink;
extern color LowerColor=Pink;
//---- buffers
double MovingBuffer[];
double UpperBuffer[];
double LowerBuffer[];
double MUpperBuffer[];
double MLowerBuffer[];
//+------------------------------------------------------------------+
//| Custom indicator initialization function |
//+------------------------------------------------------------------+
int init()
{
//---- indicators
SetIndexStyle(0,DRAW_LINE,0,2,MiddleColor);
SetIndexBuffer(0,MovingBuffer);
SetIndexStyle(1,DRAW_LINE,0,2,UpperColor);
SetIndexBuffer(1,UpperBuffer);
SetIndexStyle(2,DRAW_LINE,0,2,LowerColor);
SetIndexBuffer(2,LowerBuffer);
SetIndexStyle(3,DRAW_LINE,0,1,MUpperColor);
SetIndexBuffer(3,MUpperBuffer);
SetIndexStyle(4,DRAW_LINE,0,1,MLowerColor);
SetIndexBuffer(4,MLowerBuffer);
//----
SetIndexDrawBegin(0,MA_Period+Shift);
SetIndexDrawBegin(1,ATR_Period+Shift);
SetIndexDrawBegin(2,ATR_Period+Shift);
SetIndexDrawBegin(3,ATR_Period+Shift);
SetIndexDrawBegin(4,ATR_Period+Shift);
//----
return(0);
}
//+------------------------------------------------------------------+
//| Bollinger Bands |
//+------------------------------------------------------------------+
int start()
{
int i,k,counted_bars=IndicatorCounted();
//----
if(Bars<=MA_Period) return(0);
//---- initial zero
if(counted_bars<1)
for(i=1;i<=MA_Period;i++)
{
MovingBuffer[Bars-i]=EMPTY_VALUE;
UpperBuffer[Bars-i]=EMPTY_VALUE;
LowerBuffer[Bars-i]=EMPTY_VALUE;
MUpperBuffer[Bars-i]=EMPTY_VALUE;
MLowerBuffer[Bars-i]=EMPTY_VALUE;
}
//----
int limit=Bars-counted_bars;
if(counted_bars>0) limit++;
for(i=0; i<limit; i++)
{
MovingBuffer[i] = iMA(NULL,0,MA_Period,Shift,MODE_EMA,PRICE_CLOSE,i);
UpperBuffer[i] = MovingBuffer[i] + (KATR * iATR(NULL,0,ATR_Period,i+Shift));
LowerBuffer[i] = MovingBuffer[i] - (KATR * iATR(NULL,0,ATR_Period,i+Shift));
MUpperBuffer[i] = MovingBuffer[i] + (MKATR * iATR(NULL,0,ATR_Period,i+Shift));
MLowerBuffer[i] = MovingBuffer[i] - (MKATR * iATR(NULL,0,ATR_Period,i+Shift));
}
//----
return(0);
}
//+----------scorpion@fxfisherman.com--------------------------------+