顺水外汇EA交易网MT4
标题:
来自外网的一个指标
[打印本页]
作者:
sdyc
时间:
2018-1-11 16:50
标题:
来自外网的一个指标
上次上传了一个指标,被取消了精华,心中甚是烦恼,这次指标 保证可以使用,信号明显,指标取消收费,并且公布主图全部源码:#property indicator_chart_window
#property indicator_buffers 4
#property indicator_color1 Red
#property indicator_color2 Red
#property indicator_color3 Blue
#property indicator_color4 Blue
#property indicator_width1 2
#property indicator_width2 2
#property indicator_width3 2
#property indicator_width4 2
//---- buffers
double ExtMapBuffer1[];
double ExtMapBuffer2[];
double ExtMapBuffer3[];
double ExtMapBuffer4[];
//int width;
extern int Rperiod = 15;
extern int LSMA_Period = 5;
extern int Shift_=0;
extern int TimeFrame = 0;
extern string note_TimeFrames = "M1;5,15,30,60H1;240H4;1440D1;10080W1;43200MN";
int Draw4HowLong;
int shift;
int i;
int j;
int loopbegin;
int length;
int lsma_length;
double lengthvar;
double tmp ;
double tmp2 ;
double wt[];
double sum[];
double lsma_sum[];
double lsma_ma[];
double middle[];
int c;
string IndicatorFileName;
//+------------------------------------------------------------------+
//| Custom indicator initialization function |
//+------------------------------------------------------------------+
int init()
{
//---- 7 additional buffers are used for counting.
IndicatorBuffers(7);
//---- drawing settings
SetIndexBuffer(0,ExtMapBuffer1);
SetIndexStyle(0,DRAW_LINE);
SetIndexBuffer(1,ExtMapBuffer2);
SetIndexStyle(1,DRAW_LINE);
SetIndexBuffer(2,ExtMapBuffer3);
SetIndexStyle(2,DRAW_LINE);
SetIndexBuffer(3,ExtMapBuffer4);
SetIndexStyle(3,DRAW_LINE);
if(TimeFrame==0) TimeFrame = Period();
//
SetIndexShift(0,Shift_*TimeFrame/Period());
SetIndexShift(1,Shift_*TimeFrame/Period());
SetIndexShift(2,Shift_*TimeFrame/Period());
SetIndexShift(3,Shift_*TimeFrame/Period());
SetIndexLabel(1,"TL("+Rperiod+"|"+LSMA_Period+")["+TimeFrame+"]");
SetIndexLabel(2,"TL("+Rperiod+"|"+LSMA_Period+")["+TimeFrame+"]");
SetIndexBuffer(4,sum);
SetIndexBuffer(5,wt);
SetIndexBuffer(6,lsma_ma);
IndicatorShortName("TriggL ("+Rperiod+"|"+LSMA_Period+")["+TimeFrame+"] ");
if (TimeFrame = 0; shift--) // MAIN For Loop
{
sum[1] = 0;
for(i = length; i >= 1 ; i--) //LSMA loop
{
lengthvar = length + 1; //lengthvar = 21
lengthvar /= 3; //lengthvar = 7
tmp = 0;
tmp = ( i - lengthvar)*Close[length-i+shift]; //tmp = 20 - 7 * close[20-i+shift]
sum[1]+=tmp;
}
wt[shift] = sum[1]*6/(length*(length+1));
j = shift;
lsma_ma[shift] = wt[j+1] + (wt[j]-wt[j+1])* 2/(lsma_length+1);
//========== COLOR CODING ===========================================
ExtMapBuffer1[shift] = wt[shift];
ExtMapBuffer2[shift] = lsma_ma[shift];
ExtMapBuffer3[shift] = wt[shift];
ExtMapBuffer4[shift] = lsma_ma[shift];
if (wt[shift] < lsma_ma[shift])
{
ExtMapBuffer4[shift] = EMPTY_VALUE;
ExtMapBuffer3[shift] = EMPTY_VALUE;
}
}
}
//+------------------------------------------------------------------+
欢迎光临 顺水外汇EA交易网MT4 (http://www.waterforex.com/)
Powered by Discuz! X3.2