顺水外汇EA交易网MT4
标题:
求壓力牆/支撐牆指標
[打印本页]
作者:
quincyq2003
时间:
2018-1-11 13:11
标题:
求壓力牆/支撐牆指標
請問各位大大
是否有MT4 壓力牆/支撐牆的指標可以提供我參考參考呢?
作者:
wwwww4444
时间:
2018-1-11 14:27
#property indicator_chart_window
#property indicator_buffers 4
#property indicator_color1 Red
#property indicator_color2 Lime
#property indicator_color3 Brown
#property indicator_color4 Olive
#property indicator_width1 5
#property indicator_width2 5
double TrendUp[], TrendDown[],dn[],up[];
int changeOfTrend;
extern int Nbr_Periods = 10;
extern double Multiplier = 3.0;
//+------------------------------------------------------------------+
//| Custom indicator initialization function |
//+------------------------------------------------------------------+
int init()
{
//---- indicators
IndicatorBuffers(4);
SetIndexBuffer(0, TrendUp);
SetIndexStyle(0, DRAW_LINE, STYLE_SOLID, 5);
SetIndexLabel(0, "Trend Up");
SetIndexBuffer(1, TrendDown);
SetIndexStyle(1, DRAW_LINE, STYLE_SOLID, 5);
SetIndexLabel(1, "Trend Down");
SetIndexBuffer(2, dn);
SetIndexStyle(2, DRAW_LINE, STYLE_SOLID, 2);
SetIndexLabel(2, "Up");
SetIndexBuffer(3, up);
SetIndexStyle(3, DRAW_LINE, STYLE_SOLID, 2);
SetIndexLabel(3, "Dn");
//----
return(0);
}
//+------------------------------------------------------------------+
//| Custom indicator deinitialization function |
//+------------------------------------------------------------------+
int deinit()
{
//----
//----
return(0);
}
//+------------------------------------------------------------------+
//| Custom indicator iteration function |
//+------------------------------------------------------------------+
int start()
{
int limit, i, flag, flagh, trend[5000];
double medianPrice, atr;
int counted_bars = IndicatorCounted();
//---- check for possible errors
if(counted_bars 0) counted_bars--;
limit=Bars-counted_bars;
//Print(limit);
//----
for (i = Bars; i >= 0; i--) {
TrendUp[i] = EMPTY_VALUE;
TrendDown[i] = EMPTY_VALUE;
atr = iATR(NULL, 0, Nbr_Periods, i);
//Print("atr: "+atr[i]);
medianPrice = (High[i]+Low[i])/2;
//Print("medianPrice: "+medianPrice[i]);
up[i]=medianPrice+(Multiplier*atr);
//Print("up: "+up[i]);
dn[i]=medianPrice-(Multiplier*atr);
//Print("dn: "+dn[i]);
trend[i]=1;
if (Close[i]>up[i+1]) {
trend[i]=1;
if (trend[i+1] == -1) changeOfTrend = 1;
//Print("trend: "+trend[i]);
}
else if (Close[i]0) {
flag=1;
//Print("flag: "+flag);
}
else {
flag=0;
//Print("flagh: "+flag);
}
if (trend[i]>0 && trend[i+1]0 && dn[i]up[i+1])
up[i]=up[i+1];
if (flag==1)
up[i]=medianPrice+(Multiplier*atr);
if (flagh==1)
dn[i]=medianPrice-(Multiplier*atr);
//-- Draw the indicator
if (trend[i]==1) {
TrendUp[i]=dn[i];
if (changeOfTrend == 1) {
TrendUp[i+1] = TrendDown[i+1];
changeOfTrend = 0;
}
}
else if (trend[i]==-1) {
TrendDown[i]=up[i];
if (changeOfTrend == 1) {
TrendDown[i+1] = TrendUp[i+1];
changeOfTrend = 0;
}
}
}
WindowRedraw();
//----
return(0);
}
//+------------------------------------------------------------------+
作者:
zhouzhiyuan89
时间:
2018-1-11 15:13
谢谢分享
作者:
sp520
时间:
2018-1-11 16:27
谢谢分享
作者:
moor169
时间:
2018-1-11 17:26
谢谢分享
欢迎光临 顺水外汇EA交易网MT4 (http://waterforex.com/)
Powered by Discuz! X3.2