论坛全局菜单下方 - TICKMILL 285X70论坛全局菜单下方 - ThinkMarkets285X70论坛全局菜单下方 - 荔枝返现285X70论坛全局菜单下方 -  icmarkets285X70
帖子
作者
回复/查看
最后发表
2011-10-12 03:51
88
15659
2018-02-27 08:25
2011-04-30 12:29
2664
145798
2023-11-27 06:55
2011-05-03 15:13
2005-05-30 02:11
73
22994
2016-12-07 11:27
原帖由 游龙 于 2007-2-5 21:42 发表 楼主的MACD指标与价位高低变化不同步:')
试试这个? //+------------------------------------------------------------------+ //| MACD.mq4 | //| Copyright ?2005, David W. Thomas | //| mailto:[email protected] | //+------------------------------------------------------------------+ // This is the correct computation and display of MACD. #property copyright "Copyright ?2005, David W. Thomas" #property link "mailto:[email protected]" #property indicator_separate_window #property indicator_buffers 3 #property indicator_color1 Blue #property indicator_color2 Red #property indicator_color3 Green //---- input parameters extern int FastMAPeriod=12; extern int SlowMAPeriod=26; extern int SignalMAPeriod=9; //---- buffers double MACDLineBuffer; double SignalLineBuffer; double HistogramBuffer; //---- variables double alpha = 0; double alpha_1 = 0; //+------------------------------------------------------------------+ //| Custom indicator initialization function | //+------------------------------------------------------------------+ int init() { IndicatorDigits(MarketInfo(Symbol(),MODE_DIGITS)+1); //---- indicators SetIndexStyle(0,DRAW_LINE); SetIndexBuffer(0,MACDLineBuffer); SetIndexDrawBegin(0,SlowMAPeriod); SetIndexStyle(1,DRAW_LINE,STYLE_DOT); SetIndexBuffer(1,SignalLineBuffer); SetIndexDrawBegin(1,SlowMAPeriod+SignalMAPeriod); SetIndexStyle(2,DRAW_HISTOGRAM); SetIndexBuffer(2,HistogramBuffer); SetIndexDrawBegin(2,SlowMAPeriod+SignalMAPeriod); //---- name for DataWindow and indicator subwindow label IndicatorShortName("MACD("+FastMAPeriod+","+SlowMAPeriod+","+SignalMAPeriod+")"); SetIndexLabel(0,"MACD"); SetIndexLabel(1,"Signal"); //---- alpha = 2.0 / (SignalMAPeriod + 1.0); alpha_1 = 1.0 - alpha; //---- return(0); } //+------------------------------------------------------------------+ //| Custor indicator deinitialization function | //+------------------------------------------------------------------+ int deinit() { //---- //---- return(0); } //+------------------------------------------------------------------+ //| Custom indicator iteration function | //+------------------------------------------------------------------+ int start() { int limit; int counted_bars = IndicatorCounted(); //---- check for possible errors if (counted_bars<0) return(-1); //---- last counted bar will be recounted if (counted_bars>0) counted_bars--; limit = Bars - counted_bars; for(int i=limit; i>=0; i--) { MACDLineBuffer = iMA(NULL,0,FastMAPeriod,0,MODE_EMA,PRICE_CLOSE,i) - iMA(NULL,0,SlowMAPeriod,0,MODE_EMA,PRICE_CLOSE,i); SignalLineBuffer = alpha*MACDLineBuffer + alpha_1*SignalLineBuffer[i+1]; HistogramBuffer = MACDLineBuffer - SignalLineBuffer; } //---- return(0); } //+------------------------------------------------------------------+
2007-02-06 20:50
2005-05-07 20:43
35
6951
2017-06-17 03:43
主图的一个指标的MT4的版本 BrainTrend2StopLine 就是线的那个 //+------------------------------------------------------------------+ //| BrainTrend2StopLine.mq4 | //| | //| | //+------------------------------------------------------------------+ #property copyright "Copyright ?2005, MetaQuotes Software Corp." #property indicator_chart_window #property indicator_buffers 2 #property indicator_color1 Blue #property indicator_color2 Red //---- input parameters extern int NumBars=500; extern int EnableAlerts=0; //---- buffers double ExtMapBuffer1; double ExtMapBuffer2; double spread; //+------------------------------------------------------------------+ //| Custom indicator initialization function | //+------------------------------------------------------------------+ int init() { //---- indicators SetIndexStyle(0,DRAW_LINE); SetIndexBuffer(0,ExtMapBuffer1); SetIndexEmptyValue(0,0.0); SetIndexStyle(1,DRAW_LINE); SetIndexBuffer(1,ExtMapBuffer2); SetIndexEmptyValue(1,0.0); spread=MarketInfo(Symbol(),MODE_SPREAD)*Point; //---- return(0); } //+------------------------------------------------------------------+ //| Custor indicator deinitialization function | //+------------------------------------------------------------------+ int deinit() { //---- //---- return(0); } //+------------------------------------------------------------------+ //| Custom indicator iteration function | //+------------------------------------------------------------------+ int start() { int counted_bars=IndicatorCounted(); int artp=7; double cecf=0.7; int satb=2000; int Shift=0; bool river=True; double Emaxtra=0; double widcha=0; double TR=0; double Values[100]; int glava=0; double ATR=0; int J=0; double Weight=0; double r=0; double r1=0; int p=0; int Curr=0; double Range1=0; double s=2; double f=10; double value3=0; double h11=0; double h12=0; double h13=0; double const=0; double orig=0; double st=0; double h2=0; double h1=0; double h10=0; double sxs=0; double sms=0; double temp=0; double h5=0; double r1s=0; double r2s=0; double r3s=0; double r4s=0; double pt=0; double pts=0; double r2=0; double r3=0; double r4=0; double tt=0; if (Bars < NumBars) satb = Bars; else satb = NumBars; if (Close[satb - 2] > Close[satb - 1]) river = True; else river = False; Emaxtra = Close[satb - 2]; for (Shift = satb - 3; Shift>=0; Shift--) { TR = spread + High[Shift] - Low[Shift]; if (MathAbs(spread + High[Shift] - Close[Shift + 1]) > TR) TR = MathAbs(spread + High[Shift] - Close[Shift + 1]); if (MathAbs(Low[Shift] - Close[Shift + 1]) > TR) TR = MathAbs(Low[Shift] - Close[Shift + 1]); if (Shift == satb - 3) { for (J = 0; J<=artp - 1; J++) { Values[J] = TR; } } Values[glava] = TR; ATR = 0; Weight = artp; Curr = glava; for (J = 0; J<=artp - 1; J++) { ATR += Values[Curr] * Weight; Weight -= 1; Curr -= 1; if (Curr == -1) Curr = artp - 1; } ATR = 2.0 * ATR / (artp * (artp + 1.0)); glava += 1; if (glava == artp) glava = 0; widcha = cecf * ATR; if (river && Low[Shift] < Emaxtra - widcha) { river = False; Emaxtra = spread + High[Shift]; } if (!river && spread + High[Shift] > Emaxtra + widcha) { river = True; Emaxtra = Low[Shift]; } if (river && Low[Shift] > Emaxtra) { Emaxtra = Low[Shift]; } if (!river && spread + High[Shift] < Emaxtra) { Emaxtra = spread + High[Shift]; } Range1 = iATR(NULL,0,10,Shift)+spread/10.0; if (river) { if (Low[Shift] - Range1 * s < r && r != 0) r1 = r; else r1 = Low[Shift] - Range1 * s / 3.0; if (p == 2) r1 = Low[Shift] - Range1 * s / 3.0; ExtMapBuffer1[Shift]=r1; ExtMapBuffer2[Shift]=0; r = r1; p = 1; } else { if (spread + High[Shift] + Range1 * s > r && r != 0) r1 = r; else r1 = spread + High[Shift] + Range1 * s / 3.0; if (p == 1) r1 = spread + High[Shift] + Range1 * s / 3.0; ExtMapBuffer1[Shift]=0; ExtMapBuffer2[Shift]=r1; r = r1; p = 2; } } }
2006-10-12 15:21
2005-06-21 12:10
13
4526
2018-07-28 23:48
2006-06-22 04:48
2005-08-04 08:03
40
11398
2017-01-06 03:13
2005-09-28 09:01
2005-06-14 07:55
31
14511
2018-09-02 11:35
mt3的 /*[[ Name := Three Line Break Separate Window := No First Color := Blue First Draw Type := Histogram First Symbol := 159 Use Second Data := Yes Second Color := Red Second Draw Type := Histogram Second Symbol := 159 ]]*/ Vars: CurrentBar(0), CurrentTrend (0), TotalBars (0), Value1 (0), Value2 (0); Vars: LowestBox (0), HighestBox (0); Arrays: BoxHigh[3] (-1000), BoxLow[3] (1000); TotalBars = Bars; CurrentBar = TotalBars-1; If (Close[CurrentBar] < Open[CurrentBar]) Then { CurrentTrend = -1; BoxHigh[2] = Open[CurrentBar]; BoxLow[2] = Close[CurrentBar]; Value1 = Low[CurrentBar]; Value2 = High[CurrentBar]; } Else { CurrentTrend = 1; BoxHigh[2] = Close[CurrentBar]; BoxLow[2] = Open[CurrentBar]; Value1 = High[CurrentBar]; Value2 = Low[CurrentBar]; }; SetIndexValue(CurrentBar, Value1); SetIndexValue2(CurrentBar, Value2); SetLoopCount(0); For CurrentBar = TotalBars-2 Downto 0 Begin Value1 = 0; Value2 = 0; LowestBox = Min(Min(BoxLow[2], BoxLow[1]), BoxLow[0]); HighestBox = Max(Max(BoxHigh[2], BoxHigh[1]), BoxHigh[0]); If (((CurrentTrend > 0) And (Close[CurrentBar] < LowestBox)) Or (CurrentTrend < 0) And (Close[CurrentBar] < BoxLow[2])) Then { Value1 = Low[CurrentBar]; Value2 = High[CurrentBar]; BoxLow[0] = BoxLow[1]; BoxHigh[0] = BoxHigh[1]; BoxLow[1] = BoxLow[2]; BoxHigh[1] = BoxHigh[2]; BoxHigh[2] = BoxLow[2]; BoxLow[2] = Close[CurrentBar]; CurrentTrend = -1; } Else If (((CurrentTrend < 0) And (Close[CurrentBar] > HighestBox)) Or (CurrentTrend > 0) And (Close[CurrentBar] > BoxHigh[2])) Then { Value1 = High[CurrentBar]; Value2 = Low[CurrentBar]; BoxLow[0] = BoxLow[1]; BoxHigh[0] = BoxHigh[1]; BoxLow[1] = BoxLow[2]; BoxHigh[1] = BoxHigh[2]; BoxLow[2] = BoxHigh[2]; BoxHigh[2] = Close[CurrentBar]; CurrentTrend = 1; }; SetIndexValue(CurrentBar, Value1); SetIndexValue2(CurrentBar, Value2); End;
2005-07-08 11:05

本站免责声明:

1、本站所有广告及宣传信息均与韬客无关,如需投资请依法自行决定是否投资、斟酌资金安全及交易亏损风险;

2、韬客是独立的、仅为投资者提供交流的平台,网友发布信息不代表韬客的观点与意思表示,所有因网友发布的信息而造成的任何法律后果、风险与责任,均与韬客无关;

3、金融交易存在极高法律风险,未必适合所有投资者,请不要轻信任何高额投资收益的诱导而贸然投资;投资保证金交易导致的损失可能超过您投入的资金和预期。请您考虑自身的投资经验及风险承担能力,进行合法、理性投资;

4、所有投资者的交易帐户应仅限本人使用,不应交由第三方操作,对于任何接受第三方喊单、操盘、理财等操作的投资和交易,由此导致的任何风险、亏损及责任由投资者个人自行承担;

5、韬客不隶属于任何券商平台,亦不受任何第三方控制,韬客不邀约客户投资任何保证金交易,不接触亦不涉及投资者的任何资金及账户信息,不代理任何交易操盘行为,不向客户推荐任何券商平台,亦不存在其他任何推荐行为。投资者应自行选择券商平台,券商平台的任何行为均与韬客无关。投资者注册及使用韬客即表示其接受和认可上述声明,并自行承担法律风险。

版权所有:韬客外汇论坛 www.talkfx.com 联络我们:[email protected]