论坛全局菜单下方 - TICKMILL 285X70论坛全局菜单下方 - ThinkMarkets285X70论坛全局菜单下方 - 荔枝返现285X70论坛全局菜单下方 -  icmarkets285X70
查看:1081回复:0
草龙
注册时间2004-12-17
[MT4指标]斐波那契阻力支撑
楼主发表于:2014-07-06 22:08只看该作者倒序浏览
1楼 电梯直达
电梯直达
主图指标 斐波那契阻力支撑 mt4指标类型:趋势指标 是否能用在mt4手机版上:否 是否含有未来函数:无 /*+------------------------------------------------------------------+ | FileName: Camarilla_AlertwFibs.mq4 | Author: Copyright ? 2005, Fermin Da Costa Gomez | Version : 01 (Inital code) | | Modified by MrPip to add H5, L5, Fibonacci and alerts | +------------------------------------------------------------------+*/ #property copyright \"Copyright ? 2005, Fermin Da Costa Gomez\" #property link \"http://forex.viahetweb.nl\" #property indicator_chart_window #property indicator_buffers 7 #property indicator_color1 Yellow #property indicator_color2 LawnGreen #property indicator_color3 LawnGreen #property indicator_color4 LawnGreen #property indicator_color5 OrangeRed #property indicator_color6 OrangeRed #property indicator_color7 OrangeRed #property indicator_width1 1 #property indicator_width2 3 #property indicator_width3 1 #property indicator_width4 1 #property indicator_width5 3 #property indicator_width6 1 #property indicator_width7 1 #property indicator_style1 1 // STYLE_DASH //---- input parameters extern bool Alerts = true; extern int GMT_Offset = 0; extern int PipDistance = 20; extern color FontColor = White; extern int fontsize = 8; extern bool Fibs = true; extern color FibColor = Sienna; extern bool Pivot = true; extern color PivotColor = Yellow; extern int PivotWidth = 1; //---- buffers double PBuffer; double H5Buffer; double H4Buffer; double H3Buffer; double L3Buffer; double L4Buffer; double L5Buffer; string sL3=\"L3\", sL4=\"L4\", sL5=\"L5\"; string sH3=\"H3\", sH4=\"H4\", sH5=\"H5\"; double P, H3, H4, H5; double L3, L4, L5; double LastHigh,LastLow,x; bool firstL3=true, firstL4=true; double DifBelowL3,DifAboveL3,DifBelowL4,DifAboveL4,PipsLimit; bool firstH3=true, firstH4=true; double DifBelowH3,DifAboveH3,DifBelowH4,DifAboveH4; double D1=0.091667; double D2=0.183333; double D3=0.2750; double D4=0.55; // Fib variables double yesterday_high=0; double yesterday_low=0; double yesterday_close=0; double r3=0; double r2=0; double r1=0; double p=0; double s1=0; double s2=0; double s3=0; double R; //+------------------------------------------------------------------+ //| Custor indicator deinitialization function | //+------------------------------------------------------------------+ int deinit() { //---- TODO: add your code here // ObjectDelete(\"Pivot\"); DeleteCamLabels(); if (Fibs) DeleteFibLabels(); if (Pivot) DeletePivotLabels(); //---- return(0); } //+------------------------------------------------------------------+ //| Custom indicator initialization function | //+------------------------------------------------------------------+ int init() { string short_name; //---- indicator line SetIndexStyle(0,DRAW_LINE, STYLE_DASH, PivotWidth); SetIndexStyle(1,DRAW_LINE); SetIndexStyle(2,DRAW_LINE); SetIndexStyle(3,DRAW_LINE); SetIndexBuffer(0, PBuffer); SetIndexBuffer(1, H3Buffer); SetIndexBuffer(2, H4Buffer); SetIndexBuffer(3, H5Buffer); SetIndexStyle(4,DRAW_LINE); SetIndexStyle(5,DRAW_LINE); SetIndexStyle(6,DRAW_LINE); SetIndexBuffer(4, L3Buffer); SetIndexBuffer(5, L4Buffer); SetIndexBuffer(6, L5Buffer); //---- name for DataWindow and indicator subwindow label short_name=\"Camarilla levels\"; IndicatorShortName(short_name); SetIndexLabel(0, short_name); //---- SetIndexDrawBegin(0,1); //---- r2=0;r1=0;p=0;s1=0;s2=0;s3=0;r3=0; //---- return(0); } int DeleteCamLabels() { ObjectDelete(\"L3\"); ObjectDelete(\"L4\"); ObjectDelete(\"L5\"); ObjectDelete(\"H3\"); ObjectDelete(\"H4\"); ObjectDelete(\"H5\"); } int CreateCamLabels() { ObjectCreate(\"L3\", OBJ_TEXT, 0, 0, 0); ObjectSetText(\"L3\", \"L3 Long \" + DoubleToStr(L3,4),fontsize,\"Arial\", FontColor); ObjectCreate(\"L4\", OBJ_TEXT, 0, 0, 0); ObjectSetText(\"L4\", \"L4 Short BreakOut \"+ DoubleToStr(L4,4),fontsize,\"Arial\", FontColor); ObjectCreate(\"L5\", OBJ_TEXT, 0, 0, 0); ObjectSetText(\"L5\", \"L5 SB Target \"+ DoubleToStr(L5,4),fontsize,\"Arial\", FontColor); ObjectCreate(\"H3\", OBJ_TEXT, 0, 0, 0); ObjectSetText(\"H3\", \"H3 Short \"+ DoubleToStr(H3,4),fontsize,\"Arial\", FontColor); ObjectCreate(\"H4\", OBJ_TEXT, 0, 0, 0); ObjectSetText(\"H4\", \"H4 Long BreakOut \"+ DoubleToStr(H4,4),fontsize,\"Arial\", FontColor); ObjectCreate(\"H5\", OBJ_TEXT, 0, 0, 0); ObjectSetText(\"H5\", \"H5 LB Target \"+ DoubleToStr(H5,4),fontsize,\"Arial\", FontColor); } int DeletePivotLabels() { ObjectDelete(\"P Label\"); // ObjectDelete(\"P Line\"); } int CreatePivotLabels() { ObjectCreate(\"P label\", OBJ_TEXT, 0, 0, 0); ObjectSetText(\"P label\", \"Pivot \" + DoubleToStr(P,4), fontsize, \"Arial\", FontColor); // ObjectCreate(\"P line\", OBJ_HLINE, 0, 0, 0); // ObjectSet(\"P line\", OBJPROP_STYLE, STYLE_DASHDOTDOT); // ObjectSet(\"P line\", OBJPROP_COLOR, PivotColor); } int DeleteFibLabels() { ObjectDelete(\"S1 Label\"); ObjectDelete(\"S1 Line\"); ObjectDelete(\"S2 Label\"); ObjectDelete(\"S2 Line\"); ObjectDelete(\"S3 Label\"); ObjectDelete(\"S3 Line\"); ObjectDelete(\"R1 Label\"); ObjectDelete(\"R1 Line\"); ObjectDelete(\"R2 Label\"); ObjectDelete(\"R2 Line\"); ObjectDelete(\"R3 Label\"); ObjectDelete(\"R3 Line\"); } int CreateFibLabels() { ObjectCreate(\"R1 label\", OBJ_TEXT, 0, 0, 0); ObjectSetText(\"R1 label\", \"Fib R1\", fontsize, \"Arial\", FontColor); ObjectCreate(\"R2 label\", OBJ_TEXT, 0, 0, 0); ObjectSetText(\"R2 label\", \"Fib R2\", fontsize, \"Arial\", FontColor); ObjectCreate(\"R3 label\", OBJ_TEXT, 0, 0, 0); ObjectSetText(\"R3 label\", \"Fib R3\", fontsize, \"Arial\", FontColor); ObjectCreate(\"S1 label\", OBJ_TEXT, 0, 0, 0); ObjectSetText(\"S1 label\", \"Fib S1\", fontsize, \"Arial\", FontColor); ObjectCreate(\"S2 label\", OBJ_TEXT, 0, 0, 0); ObjectSetText(\"S2 label\", \"Fib S2\", fontsize, \"Arial\", FontColor); ObjectCreate(\"S3 label\", OBJ_TEXT, 0, 0, 0); ObjectSetText(\"S3 label\", \"Fib S3\", fontsize, \"Arial\", FontColor); //---- Set lines on chart window ObjectCreate(\"S1 line\", OBJ_HLINE, 0, 0, 0); ObjectSet(\"S1 line\", OBJPROP_STYLE, STYLE_DASHDOTDOT); ObjectSet(\"S1 line\", OBJPROP_COLOR, FibColor); ObjectCreate(\"S2 line\", OBJ_HLINE, 0, 0, 0); ObjectSet(\"S2 line\", OBJPROP_STYLE, STYLE_DASHDOTDOT); ObjectSet(\"S2 line\", OBJPROP_COLOR, FibColor); ObjectCreate(\"S3 line\", OBJ_HLINE, 0, 0, 0); ObjectSet(\"S3 line\", OBJPROP_STYLE, STYLE_DASHDOTDOT); ObjectSet(\"S3 line\", OBJPROP_COLOR, FibColor); ObjectCreate(\"R1 line\", OBJ_HLINE, 0, 0, 0); ObjectSet(\"R1 line\", OBJPROP_STYLE, STYLE_DASHDOTDOT); ObjectSet(\"R1 line\", OBJPROP_COLOR, FibColor); ObjectCreate(\"R2 line\", OBJ_HLINE, 0, 0, 0); ObjectSet(\"R2 line\", OBJPROP_STYLE, STYLE_DASHDOTDOT); ObjectSet(\"R2 line\", OBJPROP_COLOR, FibColor); ObjectCreate(\"R3 line\", OBJ_HLINE, 0, 0, 0); ObjectSet(\"R3 line\", OBJPROP_STYLE, STYLE_DASHDOTDOT); ObjectSet(\"R3 line\", OBJPROP_COLOR, FibColor); } int CalculateFibs() { // Calculate Fib if (Fibs || Pivot) { yesterday_high=iHigh(NULL,PERIOD_D1,1); yesterday_low=iLow(NULL,PERIOD_D1,1); yesterday_close=iClose(NULL,PERIOD_D1,1); R = yesterday_high - yesterday_low;//range p = (yesterday_high + yesterday_low + yesterday_close)/3;// Standard Pivot r1 = p + (R * 0.38); r2 = p + (R * 0.62); r3 = p + (R * 0.99); s1 = p - (R * 0.38); s2 = p - (R * 0.62); s3 = p - (R * 0.99); if (Fibs) { ObjectMove(\"R1 label\", 0, Time[20], r1); ObjectMove(\"R2 label\", 0, Time[20], r2); ObjectMove(\"R3 label\", 0, Time[20], r3); ObjectMove(\"S1 label\", 0, Time[20], s1); ObjectMove(\"S2 label\", 0, Time[20], s2); ObjectMove(\"S3 label\", 0, Time[20], s3); //---- Set lines on chart window ObjectMove(\"S1 line\", 0, Time[40], s1); ObjectMove(\"S2 line\", 0, Time[40], s2); ObjectMove(\"S3 line\", 0, Time[40], s3); ObjectMove(\"R1 line\", 0, Time[40], r1); ObjectMove(\"R2 line\", 0, Time[40], r2); ObjectMove(\"R3 line\", 0, Time[40], r3); } // if (Pivot) ObjectMove(\"P label\", 0, Time[20], p); } } int DoAlerts() { DifAboveH3 = Close[0] - H3; DifBelowH3 = H3 - Close[0]; DifAboveH4 = Close[0] - H4; DifBelowH4 = H4 - Close[0]; DifAboveL3 = Close[0] - L3; DifBelowL3 = L3 - Close[0]; DifAboveL4 = Close[0] - L4; DifBelowL4 = L4 - Close[0]; PipsLimit = PipDistance*Point; if (DifAboveH3 > PipsLimit && DifBelowH3 > PipsLimit) firstH3 = true; if (DifAboveH3 <= PipsLimit && DifAboveH3 > 0) { if (firstH3) { Alert(\"Above Cam H3 Line by \",DifAboveH3,\" for \", Symbol(),\"-\",Period()); PlaySound(\"alert.wav\"); firstH3=false; } } if (DifBelowH3 <= PipsLimit && DifBelowH3 > 0) { if (firstH3) { Alert(\"Below Cam H3 Line by \",DifBelowH3, \" for \", Symbol(),\"-\",Period()); PlaySound(\"alert.wav\"); firstH3=false; } } if (DifAboveH4 > PipsLimit && DifBelowH4 > PipsLimit) firstH4 = true; if (DifAboveH4 <= PipsLimit && DifAboveH4 > 0) { if (firstH4) { Alert(\"Above Cam H4 Line by \",DifAboveH4, \" for \", Symbol(),\"-\",Period()); PlaySound(\"timeout.wav\"); firstH4 = false; } } if (DifBelowH4 <= PipsLimit && DifBelowH4 > 0) { if (firstH4) { Alert(\"Below Cam H4 Line by \",DifBelowH4, \" for \", Symbol(),\"-\",Period()); PlaySound(\"timeout.wav\"); firstH4 = false; } } if (DifAboveL3 > PipsLimit && DifBelowL3 > PipsLimit) firstL3 = true; if (DifAboveL3 <= PipsLimit && DifAboveL3 > 0) { if (firstL3) { Alert(\"Above Cam L3 Line by \",DifAboveL3,\" for \", Symbol(),\"-\",Period()); PlaySound(\"alert.wav\"); firstL3=false; } } if (DifBelowL3 <= PipsLimit && DifBelowL3 > 0) { if (firstL3) { Alert(\"Below Cam L3 Line by \",DifBelowL3, \" for \", Symbol(),\"-\",Period()); PlaySound(\"alert.wav\"); firstL3=false; } } if (DifAboveL4 > PipsLimit && DifBelowL4 > PipsLimit) firstL4 = true; if (DifAboveL4 <= PipsLimit && DifAboveL4 > 0) { if (firstL4) { Alert(\"Above Cam L4 Line by \",DifAboveL4, \" for \", Symbol(),\"-\",Period()); PlaySound(\"timeout.wav\"); firstL4 = false; } } if (DifBelowL4 <= PipsLimit && DifBelowL4 > 0) { if (firstL4) { Alert(\"Below Cam L4 Line by \",DifBelowL4, \" for \", Symbol(),\"-\",Period()); PlaySound(\"timeout.wav\"); firstL4 = false; } } } //+------------------------------------------------------------------+ //| Custom indicator iteration function | //+------------------------------------------------------------------+ int start() { int counted_bars=IndicatorCounted(); double offset_seconds = GMT_Offset * 3600; int limit, i; datetime LastMoveTime; //---- indicator calculation if (counted_bars==0) { x=Period(); if (x>240) return(-1); CreateCamLabels(); if (Fibs) CreateFibLabels(); } if(counted_bars<0) return(-1); //---- last counted bar will be recounted // if(counted_bars>0) counted_bars--; limit=(Bars-counted_bars)-1; for (i=limit; i>=0;i--) { if (High[i+1]>LastHigh) LastHigh=High[i+1]; if (Low[i+1] LastMoveTime+60) { ObjectMove(\"L3\", 0, CurTime(), L3); ObjectMove(\"L4\", 0, CurTime(), L4); ObjectMove(\"L5\", 0, CurTime(), L5); ObjectMove(\"H3\", 0, CurTime(), H3); ObjectMove(\"H4\", 0, CurTime(), H4); ObjectMove(\"H5\", 0, CurTime(), H5); LastMoveTime = CurTime(); } // Now check for Alert if (Alerts) DoAlerts(); //---- return(0); } //+------------------------------------------------------------------+
TK29帖子1楼右侧xm竖版广告90-240
个性签名

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

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

本站免责声明:

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

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

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

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

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

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