[MT4指标]Accelerator_4cM_mtf
ACC 上涨下跌双色粗细的设置mt4软件
//+------------------------------------------------------------------+
//| Accelerator_4c_mtf|
//| Copyright 2005, MetaQuotes Software Corp. |
//| mtf 2007_ForexTSD keris ki |
//+------------------------------------------------------------------+
#property copyright "Copyright 2005, MetaQuotes Software Corp."
#property link "http://www.metaquotes.net/"
//---- indicator settings
#property indicator_separate_window
#property indicator_buffers 5
#property indicator_color1 CLR_NONE
#property indicator_color2 LimeGreen
#property indicator_color3 Red
#property indicator_color4 Lime
#property indicator_color5 Red
//----
#property indicator_width3 2
#property indicator_width4 2
//----
extern int TimeFrame=30;
extern int MA1_Period =7;
extern int MA2_Period =14;
extern int MA3_Period =3;
extern int MA_Mode=MODE_SMA;
extern int MA_Price= PRICE_MEDIAN;
extern int SigLineShift =0;
extern int MaxBarsToCount =15000;
//----
extern string TimeFrames="M1;5,15,30,60H1;240H4;1440D1;10080W1;43200MN|0-CurrentTF";
extern string note_MA_Method_Price="SMA0 EMA1 SMMA2 LWMA3||0O,1C 2H3L,4Md 5Tp 6WghC: Md(HL/2)4,Tp(HLC/3)5,Wgh(HLCC/4)6";
extern string defaults="5,34,5; SMA,PRICE_MEDIAN";
//---- indicator buffers
double ExtBuffer0;
double ExtBuffer1;
double ExtBuffer2;
double ExtBuffer3;
double ExtBuffer4;
double ExtBuffer11;
double ExtBuffer21;
double ExtBuffer5;
//+------------------------------------------------------------------+
//| Custom indicator initialization function |
//+------------------------------------------------------------------+
int init()
{
//---- 2 additional buffers are used for counting.
IndicatorBuffers(8);
//---- drawing settings
SetIndexStyle(0,DRAW_LINE);
SetIndexShift(0,SigLineShift);
SetIndexStyle(1,DRAW_HISTOGRAM);
SetIndexStyle(2,DRAW_HISTOGRAM);
SetIndexStyle(3,DRAW_HISTOGRAM);
SetIndexStyle(4,DRAW_HISTOGRAM);
//
IndicatorDigits(Digits+2);
SetIndexDrawBegin(0,38);
SetIndexDrawBegin(1,38);
SetIndexDrawBegin(2,38);
SetIndexDrawBegin(3,38);
SetIndexDrawBegin(4,38);
SetIndexDrawBegin(5,38);
SetIndexDrawBegin(6,38);
//---- 4 indicator buffers mapping
SetIndexBuffer(0,ExtBuffer0);
SetIndexBuffer(1,ExtBuffer1);
SetIndexBuffer(2,ExtBuffer2);
SetIndexBuffer(3,ExtBuffer11);
SetIndexBuffer(4,ExtBuffer21);
SetIndexBuffer(5,ExtBuffer3);
SetIndexBuffer(6,ExtBuffer4);
SetIndexBuffer(7,ExtBuffer5);
//---- name for DataWindow and indicator subwindow label
SetIndexLabel(0,NULL);
SetIndexLabel(1,NULL);
SetIndexLabel(2,NULL);
SetIndexLabel(3,NULL);
SetIndexLabel(4,NULL);
SetIndexLabel(5,NULL);
SetIndexLabel(6,NULL);
//----
switch(TimeFrame)
{
case 1: string TimeFrameStr="M1"; break;
case 5 : TimeFrameStr="M5"; break;
case 15 : TimeFrameStr="M15"; break;
case 30 : TimeFrameStr="M30"; break;
case 60 : TimeFrameStr="H1"; break;
case 240 : TimeFrameStr="H4"; break;
case 1440 : TimeFrameStr="D1"; break;
case 10080 : TimeFrameStr="W1"; break;
case 43200 : TimeFrameStr="MN1"; break;
default : TimeFrameStr ="TF 0";
}
IndicatorShortName("ACC ["+TimeFrameStr+"]");
//----
if (TimeFrame=0; i--)
{
current=ExtBuffer3-ExtBuffer4;
prev=ExtBuffer3[i+1]-ExtBuffer4[i+1];
//----
if(current>prev) up=true;
if(current0)
{
ExtBuffer1 =current;
ExtBuffer11=0.0;
ExtBuffer2 =0.0;
ExtBuffer21=0.0;
}
else
{
ExtBuffer21=current;
ExtBuffer1 =0.0;
ExtBuffer2 =0.0;
ExtBuffer11=0.0;
}
}
else
{
if (current>0)
{
ExtBuffer11=current;
ExtBuffer2 =0.0;
ExtBuffer1 =0.0;
ExtBuffer21=0.0;
}
else
{
ExtBuffer2 =current;
ExtBuffer11=0.0;
ExtBuffer1 =0.0;
ExtBuffer21=0.0;
}
}
ExtBuffer0=current;
}
//---- done
return(0);
}
//+------------------------------------------------------------------+
Accelerator_4cM_mtf.jpg
