论坛全局菜单下方 - TICKMILL 285X70论坛全局菜单下方 - ThinkMarkets285X70论坛全局菜单下方 - 荔枝返现285X70论坛全局菜单下方 -  icmarkets285X70
查看:713回复:0
草龙
注册时间2004-12-17
[MT4指标]BrainTrend2-all-in-one第二版
楼主发表于:2014-02-11 08:52只看该作者倒序浏览
1楼 电梯直达
电梯直达
主图指标 mt4指标类型:趋势指标 是否能用在mt4手机版上:否 是否含有未来函数:无 该指标包括3原BrainTrend2指标,因为我懒2申请 他们都一一在图表上: BrainTrend2Stop,BrainTrend2StopLine,BrainTrend2Sig 注:BrainTrend2指标不包括,因为我们使用BrainTrend1指标趋势方向 它可以优化过程中使用了与定制的外部变量 此外,我改名为变量,简化 //+------------------------------------------------------------------+ //| BrainTrend2-all-in-one.mq4 | //| www.forex-tsd.com | //| Nick Bilak | //| Modified by Serge [email protected]| //+------------------------------------------------------------------+ /* Serge: This indicator includes 3 original BrainTrend2 indicators as I am 2 lazy to apply them all one by one on a chart: BrainTrend2Stop, BrainTrend2StopLine, BrainTrend2Sig Note: BrainTrend2 indicator is not included as we use BrainTrend1 indicator for trend direction It has customisable external variables that can be played with during optimisation Also I renamed variables, simplified & logically re-arranged the codes of the original indicators to make them more understandable (I mean for myself :-) */ #property copyright "Copyright ? 2005, MetaQuotes Software Corp." #property link "www.forex-tsd.com" #property indicator_chart_window #property indicator_buffers 6 #property indicator_color1 Red #property indicator_color2 Blue #property indicator_color3 Red #property indicator_color4 Blue #property indicator_color5 Red #property indicator_color6 Blue //---- input parameters extern int NumBars=0; //If 0, all indicator will be drawn on the whole chart (from 1st bar) extern bool spread_eq_0=false; //if true, we will use spread=0 in all our calculations, if false we will use spread from the broker //---- buffers double sell_stop_dot_buf; //Sell stop dots, aka BrainTrend2Stop double buy_stop_dot_buf; //Buy stop dots double sell_stop_line_buf; //Sell stop line, aka BrainTrend2StopLine double buy_stop_line_buf; //Buy stop line double sell_signal_buf; //Sell signal dots, aka BrainTrend2Sig double buy_signal_buf; //Buy signal dots double spread; //+------------------------------------------------------------------+ //| Custom indicator initialization function | //+------------------------------------------------------------------+ int init() { SetIndexStyle(0,DRAW_ARROW); SetIndexArrow(0,115); SetIndexBuffer(0,sell_stop_dot_buf); SetIndexLabel(0,"sell_stop_dot"); SetIndexEmptyValue(0, EMPTY_VALUE); SetIndexStyle(1,DRAW_ARROW); SetIndexArrow(1,115); SetIndexBuffer(1,buy_stop_dot_buf); SetIndexLabel(1,"buy_stop_dot"); SetIndexEmptyValue(1, EMPTY_VALUE); SetIndexStyle(2,DRAW_LINE); SetIndexBuffer(2,sell_stop_line_buf); SetIndexLabel(2,"sell_stop_line"); SetIndexEmptyValue(2, EMPTY_VALUE); SetIndexStyle(3,DRAW_LINE); SetIndexBuffer(3,buy_stop_line_buf); SetIndexLabel(3,"buy_stop_line"); SetIndexEmptyValue(3, EMPTY_VALUE); SetIndexStyle(4,DRAW_ARROW); SetIndexArrow(4,234); SetIndexBuffer(4,sell_signal_buf); SetIndexLabel(4,"sell_signal"); SetIndexEmptyValue(4, EMPTY_VALUE); SetIndexStyle(5,DRAW_ARROW); SetIndexArrow(5,233); SetIndexBuffer(5,buy_signal_buf); SetIndexLabel(5,"buy_signal"); SetIndexEmptyValue(5, EMPTY_VALUE); if (spread_eq_0 == false) spread=MarketInfo(Symbol(),MODE_SPREAD)*Point; else spread=0; } int start() { double true_range; int artp=7; bool river=True; double Emaxtra=0; double Values[100]; double ATR=0; int glava=0; double Weight=0; int Curr=0; double widcha=0; double cecf=0.7; double Range1=0; double r=0; double r1=0; int p=0; double s=2; if (NumBars == 0) NumBars = Bars; else NumBars = MathMin(Bars,NumBars); if (Close[NumBars - 2] > Close[NumBars - 1]) river = True; else river = False; Emaxtra = Close[NumBars - 2]; true_range = MathMax(spread + High[NumBars-3] - Low[NumBars-3], MathMax(MathAbs(spread+High[NumBars-3]-Close[NumBars-2]), MathAbs(spread+High[NumBars-3]-Close[NumBars-3]))); for (int i = 0; i <= artp-1; i++) Values = true_range; for (int shift=NumBars-3; shift>=0; shift--) { true_range = MathMax(spread + High[shift] - Low[shift], MathMax(MathAbs(spread+High[shift]-Close[shift+1]),MathAbs(spread+High[shift]-Close[shift+1]))); Values[glava] = true_range; ATR = 0; Weight = artp; // 7 Curr = glava; // 0 for (i = 0; i<=artp-1; i++) { 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; //cecf = 0.7 if (river && Low[shift] < Emaxtra - widcha) { river = False; Emaxtra = spread + High[shift]; } if (river && Low[shift] > Emaxtra) { Emaxtra = Low[shift]; } if (!river && spread + High[shift] > Emaxtra + widcha) { river = True; 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; buy_signal_buf[shift]=r1; } buy_stop_dot_buf[shift]=r1; buy_stop_line_buf[shift]=r1; 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; sell_signal_buf[shift]=r1; } sell_stop_dot_buf[shift]=r1; sell_stop_line_buf[shift]=r1; r = r1; p = 2; } } }BrainTrend2_all_in_one.jpgBrainTrend2_all_in_one.jpg
TK29帖子1楼右侧xm竖版广告90-240
个性签名

阅尽天下指标
搬砖开始,始于2014

广告
TK30+TK31帖子一樓廣告
TK30+TK31帖子一樓廣告

本站免责声明:

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

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

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

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

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

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