本页面只读。您可以查看源文件,但不能更改它。如果您觉得这是系统错误,请联系管理员。
# MTF Fractals indicator ![](https://100w123.com/_extern/wiki/MT4/fractals.png) MTF_Fractal.mq4 <code cpp> //+------------------------------------------------------------------+ //| MTF Fractal.mq4 | //| Copyright ?2014, TrueTL | //| http://www.truetl.com | //+------------------------------------------------------------------+ #property copyright "Copyright ?2014, TrueTL" #property link "http://www.truetl.com" #property version "1.40" #property indicator_chart_window #property indicator_buffers 2 extern string Version_140 = "www.truetl.com"; extern int Fractal_Timeframe = 0; extern int Maxbar = 2000; extern color Up_Fractal_Color = Red; extern int Up_Fractal_Symbol = 108; extern color Down_Fractal_Color = Blue; extern int Down_Fractal_Symbol = 108; extern bool Extend_Line = true; extern bool Extend_Line_to_Background = true; extern bool Show_Validation_Candle = true; extern color Up_Fractal_Extend_Line_Color = Red; extern int Up_Fractal_Extend_Width = 0; extern int Up_Fractal_Extend_Style = 2; extern color Down_Fractal_Extend_Line_Color = Blue; extern int Down_Fractal_Extend_Width = 0; extern int Down_Fractal_Extend_Style = 2; double UpBuffer[], DoBuffer[], refchk, tempref, level; int barc; //+------------------------------------------------------------------+ //| INIT | //+------------------------------------------------------------------+ int init() { SetIndexBuffer(0,UpBuffer); SetIndexStyle(0,DRAW_ARROW, DRAW_ARROW, 0, Up_Fractal_Color); SetIndexArrow(0,Up_Fractal_Symbol); SetIndexBuffer(1,DoBuffer); SetIndexStyle(1,DRAW_ARROW, DRAW_ARROW, 0, Down_Fractal_Color); SetIndexArrow(1,Down_Fractal_Symbol); return(0); } //+------------------------------------------------------------------+ //| DEINIT | //+------------------------------------------------------------------+ int deinit() { for (int i = ObjectsTotal(); i >= 0; i--) { if (StringSubstr(ObjectName(i),0,12) == "MTF_Fractal_") { ObjectDelete(ObjectName(i)); } } return(0); } //+------------------------------------------------------------------+ //| START | //+------------------------------------------------------------------+ int start() { int i, c, dif; tempref = iHigh(Symbol(), Fractal_Timeframe, 1) + iHigh(Symbol(), Fractal_Timeframe, 51) + iHigh(Symbol(), Fractal_Timeframe, 101); if (barc != Bars || IndicatorCounted() < 0 || tempref != refchk) { barc = Bars; refchk = tempref; } else return(0); deinit(); if (Fractal_Timeframe <= Period()) Fractal_Timeframe = Period(); dif = Fractal_Timeframe/Period(); if (Maxbar > Bars) Maxbar = Bars-10; for(i = 0; i < Maxbar; i++) { if (iBarShift(NULL,Fractal_Timeframe,Time[i]) < 3) { UpBuffer[i] = 0; DoBuffer[i] = 0; continue; } UpBuffer[i] = iFractals(NULL,Fractal_Timeframe,1,iBarShift(NULL,Fractal_Timeframe,Time[i])); DoBuffer[i] = iFractals(NULL,Fractal_Timeframe,2,iBarShift(NULL,Fractal_Timeframe,Time[i])); } if (Extend_Line) { for(i = 0; i < Maxbar; i++) { if (UpBuffer[i] > 0) { level = UpBuffer[i]; for (c = i; c > 0; c--) { if ((Open[c] < level && Close[c] > level) || (Open[c] > level && Close[c] < level)) break; if (Open[c] <= level && Close[c] <= level && Open[c-1] >= level && Close[c-1] >= level) break; if (Open[c] >= level && Close[c] >= level && Open[c-1] <= level && Close[c-1] <= level) break; } DrawLine ("H", i, c, level, Extend_Line_to_Background, Up_Fractal_Extend_Line_Color, Up_Fractal_Extend_Width, Up_Fractal_Extend_Style); if (Show_Validation_Candle) UpBuffer[i-2*dif] = level; i += dif; } } for(i = 0; i < Maxbar; i++) { if (DoBuffer[i] > 0) { level = DoBuffer[i]; for (c = i; c > 0; c--) { if ((Open[c] < level && Close[c] > level) || (Open[c] > level && Close[c] < level)) break; if (Open[c] <= level && Close[c] <= level && Open[c-1] >= level && Close[c-1] >= level) break; if (Open[c] >= level && Close[c] >= level && Open[c-1] <= level && Close[c-1] <= level) break; } DrawLine ("L", i, c, level, Extend_Line_to_Background, Down_Fractal_Extend_Line_Color, Down_Fractal_Extend_Width, Down_Fractal_Extend_Style); if (Show_Validation_Candle) DoBuffer[i-2*dif] = level; i += dif; } } } return(0); } //+------------------------------------------------------------------+ //| DRAW LINE | //+------------------------------------------------------------------+ void DrawLine (string dir, int i, int c, double lev, bool back, color col, int width, int style) { ObjectCreate("MTF_Fractal_"+dir+i,OBJ_TREND,0,0,0,0,0); ObjectSet("MTF_Fractal_"+dir+i,OBJPROP_TIME1,iTime(Symbol(),Period(),i)); ObjectSet("MTF_Fractal_"+dir+i,OBJPROP_PRICE1,lev); ObjectSet("MTF_Fractal_"+dir+i,OBJPROP_TIME2,iTime(Symbol(),Period(),c)); ObjectSet("MTF_Fractal_"+dir+i,OBJPROP_PRICE2,lev); ObjectSet("MTF_Fractal_"+dir+i,OBJPROP_RAY,0); ObjectSet("MTF_Fractal_"+dir+i,OBJPROP_BACK,back); ObjectSet("MTF_Fractal_"+dir+i,OBJPROP_COLOR,col); ObjectSet("MTF_Fractal_"+dir+i,OBJPROP_WIDTH,width); ObjectSet("MTF_Fractal_"+dir+i,OBJPROP_STYLE,style); } </code>
您的足迹:
登录
文章
讨论
阅读
显示源文件
过去修订
搜索
导航
常用工具
TradingView Chart
龙虎榜
巨潮资讯
雪球选股器
可转债产品行情
回购产品行情
东方财富数据中心
SHIBOR
国债收益率
资金流向
新股申购:A 股
新股申购:美股
新股申购:港股
StockQ
分级基金
宏观数据・中国
GDP
CPI
/
PPI
存款
/
贷款利率
存准率
国债收益率
SHIBOR
东方财富数据中心
宏观数据・美国
历年 GDP
CPI(同比)
CPI(月环比)
核心 CPI(同比)
核心 CPI(月环比)
核心 CPI
失业率
国债收益率
利率、存准
美联储利率观测器
市场数据
市场
、
行业市盈率
行业股息率
大宗交易
资金流向
沪
、
深融资融券
沪深内部交易
新股申购
新基金发行
美股 IPO
StockQ
研报
迈博汇金
渐飞研报
股票报告网
实用工具
巨潮资讯
披露易
公告信息
汇率换算
电话会议速记 (英)
业绩发布时间 (中概)
美股业绩发布
财经日历
雪球访谈
Alexa
百度指数
解禁股查询
A/H/B 股对比
Investopedia
回购产品行情
可转债产品行情
货币基金产品行情
选股 / 数据引擎
雪球筛选器
东方财富选股器
新浪条件选股
中财网数据引擎
套利股
可转债
分级基金
FINVIZ (英)
晨星
谷歌选股器
i 问财
英为财情选股器
打印/导出
可打印版本
工具
反向链接
最近更改
媒体管理器
网站地图
永久链接
引用此文