论坛全局菜单下方 - TICKMILL 285X70论坛全局菜单下方 - ThinkMarkets285X70论坛全局菜单下方 - 荔枝返现285X70论坛全局菜单下方 -  icmarkets285X70
查看:5319回复:4
草龙
注册时间2004-12-17
[MT4-EA]RenkoLiveChart_v3.3 MT4EA
楼主发表于:2014-01-01 17:35只看该作者倒序浏览
1楼 电梯直达
电梯直达
[backcolor=rgb(245, 245, 245)]/ / | EA版本 [/backcolor]
[backcolor=rgb(245, 245, 245)]/ / | RenkoLiveChart_v3.3.mq4 [/backcolor]
[backcolor=rgb(245, 245, 245)]/ / |由“ E4 ”从Renko脚本启发( renko_live_scr.mq4 ) [/backcolor]
[backcolor=rgb(245, 245, 245)]/ / |版权2009 LastViking [/backcolor]
[backcolor=rgb(245, 245, 245)]/ / | [/backcolor]
[backcolor=rgb(245, 245, 245)]/ / | 2009年8月12日( LV ) : [/backcolor]
[backcolor=rgb(245, 245, 245)]/ / | - 我Renko图诚征音量,使我写我自己的脚本 [/backcolor]
[backcolor=rgb(245, 245, 245)]/ / | [/backcolor]
[backcolor=rgb(245, 245, 245)]/ / | 8月20日至21日2009( LV ) ( V1.1 - V1.3 ) : [/backcolor]
[backcolor=rgb(245, 245, 245)]/ / | - 第一次尝试在现场Renko砖形成(错误错误... ) [/backcolor]
[backcolor=rgb(245, 245, 245)]/ / | - 固定的问题在一些5位数的奇怪的符号名 [/backcolor]
[backcolor=rgb(245, 245, 245)]/ / |经纪人(信贷Tigertron ) [/backcolor]
[backcolor=rgb(245, 245, 245)]/ / | [/backcolor]
[backcolor=rgb(245, 245, 245)]/ / | 2009年8月24日( LV ) ( V1.4 ) : [/backcolor]
[backcolor=rgb(245, 245, 245)]/ / | - 拉手最高/最低价历史以合理的方式(前值为 [/backcolor]
[backcolor=rgb(245, 245, 245)]/ / |二手关闭) [/backcolor]
[backcolor=rgb(245, 245, 245)]/ / | [/backcolor]
[backcolor=rgb(245, 245, 245)]/ / | 2009年8月26日(楼G) ( v1.5/v1.6 ) : [/backcolor]
[backcolor=rgb(245, 245, 245)]/ / | - 更多科比固定“晚亮相” (现场Renko砖 [/backcolor]
[backcolor=rgb(245, 245, 245)]/ / |形成)的bug [/backcolor]
[backcolor=rgb(245, 245, 245)]/ / | [/backcolor]
[backcolor=rgb(245, 245, 245)]/ / | 2009年8月31日( LV ) ( V2.0 ) : [/backcolor]
[backcolor=rgb(245, 245, 245)]/ / | - 不是一个脚本了:) ,但是运行的指标 [/backcolor]
[backcolor=rgb(245, 245, 245)]/ / | - Naroved减用来使“迟到外观虫” MT4错误 [/backcolor]
[backcolor=rgb(245, 245, 245)]/ / |一点点接近(有做高/低间隙) [/backcolor]
[backcolor=rgb(245, 245, 245)]/ / | - 删除了,而...[/backcolor]
[backcolor=rgb(245, 245, 245)]睡眠()循环。 [/backcolor]
[backcolor=rgb(245, 245, 245)]Renko图现在打勾 [/backcolor]
[backcolor=rgb(245, 245, 245)]/ / |驱动: - MUSH更好的对系统资源的这种方式 [/backcolor]
[backcolor=rgb(245, 245, 245)]/ / | [/backcolor]
[backcolor=rgb(245, 245, 245)]/ / | 2009年9月3日( LV ) ( V2.1 ) : [/backcolor]
[backcolor=rgb(245, 245, 245)]/ / | - 固定,这样时间[ ]内保存renko的开放时间 [/backcolor]
[backcolor=rgb(245, 245, 245)]/ / |砖(接近使用前值为时间) [/backcolor]
[backcolor=rgb(245, 245, 245)]/ / | [/backcolor]
[backcolor=rgb(245, 245, 245)]/ / | 2009年9月16日(楼G) ( V3.0 ) : [/backcolor]
[backcolor=rgb(245, 245, 245)]/ / | - 添加可选的灯芯 [/backcolor]
[backcolor=rgb(245, 245, 245)]/ / | - 转换回EA [/backcolor]
[backcolor=rgb(245, 245, 245)]/ / | - 自动调整为5 ,并添加12月6日经纪公司 [/backcolor]
[backcolor=rgb(245, 245, 245)]/ / |输入RenkoBoxSize为“实际的”大小如[/backcolor]
[backcolor=rgb(245, 245, 245)]“ 10 ”为10点 [/backcolor]
[backcolor=rgb(245, 245, 245)]/ / | - 补偿“零比较补充说:”问题 [/backcolor]
[backcolor=rgb(245, 245, 245)]/ / | [/backcolor]
[backcolor=rgb(245, 245, 245)]/ / | OKT 05 2009( LV ) ( V3.1 ) : [/backcolor]
[backcolor=rgb(245, 245, 245)]/ / | - 固定与BoxOffset一个bug [/backcolor]
[backcolor=rgb(245, 245, 245)]/ / | - 自动调整为3和12月4日对日元 [/backcolor]
[backcolor=rgb(245, 245, 245)]/ / | - 删除了init()函数 [/backcolor]
[backcolor=rgb(245, 245, 245)]/ / | - 改回旧的风格Renko砖形成 [/backcolor]
[backcolor=rgb(245, 245, 245)]/ / | [/backcolor]
[backcolor=rgb(245, 245, 245)]/ / | OKT 13 2009( LV ) ( V3.2 ) : [/backcolor]
[backcolor=rgb(245, 245, 245)]/ / | - 新增“ EmulateOnLineChart ”选项(信贷Skipperxit /米莫) [/backcolor]
[backcolor=rgb(245, 245, 245)]/ / | [/backcolor]
[backcolor=rgb(245, 245, 245)]/ / + ----------------------------------------------- [/backcolor]
[backcolor=rgb(245, 245, 245)]---------------------------- + [/backcolor]
[backcolor=rgb(245, 245, 245)]#物业版权“ ” [/backcolor]
[backcolor=rgb(245, 245, 245)]/ / + ----------------------------------------------- [/backcolor]
[backcolor=rgb(245, 245, 245)]------------------- + [/backcolor]
[backcolor=rgb(245, 245, 245)]/ / |代码添加到orgininal副本 [/backcolor]
[backcolor=rgb(245, 245, 245)]/ / | 1 )大标签 [/backcolor]
[backcolor=rgb(245, 245, 245)]/ / |上面添加的代码清楚地标明起点和终点标志。 [/backcolor]
[backcolor=rgb(245, 245, 245)]/ / |除外代码插入可再生能源外,并无任何原代码,已经改变。 [/backcolor]
[backcolor=rgb(245, 245, 245)]/ / | 2012 File45 [/backcolor]
[backcolor=rgb(245, 245, 245)]/ / + ----------------------------------------------- [/backcolor]
[backcolor=rgb(245, 245, 245)]------------------- + [/backcolor]
[backcolor=rgb(245, 245, 245)]#包括 [/backcolor]
[backcolor=rgb(245, 245, 245)]#包括 [/backcolor]
[backcolor=rgb(245, 245, 245)]/ / + ----------------------------------------------- [/backcolor]
[backcolor=rgb(245, 245, 245)]------------------- + [/backcolor]
[backcolor=rgb(245, 245, 245)]#导入“ user32.dll中” [/backcolor]
[backcolor=rgb(245, 245, 245)]整型RegisterWindowMessageA (字符串lpString ) ;[/backcolor]
//+---------------------------------------------------------------------------+ //| EA VERSION //| RenkoLiveChart_v3.3.mq4 //| Inspired from Renko script by "e4" (renko_live_scr.mq4) //| Copyleft 2009 LastViking //| //| Aug 12 2009 (LV): //| - Wanted volume in my Renko chart so I wrote my own script //| //| Aug 20-21 2009 (LV) (v1.1 - v1.3): //| - First attempt at live Renko brick formation (bugs O bugs...) //| - Fixed problem with strange symbol names at some 5 digit //| brokers (credit to Tigertron) //| //| Aug 24 2009 (LV) (v1.4): //| - Handle High / Low in history in a reasonable way (prev. //| used Close) //| //| Aug 26 2009 (Lou G) (v1.5/v1.6): //| - Finaly fixing the "late appearance" (live Renko brick //| formation) bug //| //| Aug 31 2009 (LV) (v2.0): //| - Not a script anylonger, but run as indicator //| - Naroved down the MT4 bug that used to cause the "late appearance bug" //| a little closer (has to do with High / Low gaps) //| - Removed the while ... sleep() loop. Renko chart is now tick //| driven: -MUSH nicer to system resources this way //| //| Sep 03 2009 (LV) (v2.1): //| - Fixed so that Time holds the open time of the renko //| bricks (prev. used time of close) //| //| Sep 16 2009 (Lou G) (v3.0): //| - Optional wicks added //| - Conversion back to EA //| - Auto adjust for 5 and 6 dec brokers added //| enter RenkoBoxSize as "actual" size e.g. "10" for 10 pips //| - Compensation for "zero compare" problem added //| //| Okt 05 2009 (LV) (v3.1): //| - Fixed a bug related to BoxOffset //| - Auto adjust for 3 and 4 dec JPY pairs //| - Removed init() function //| - Changed back to old style Renko brick formation //| //| Okt 13 2009 (LV) (v3.2): //| - Added "EmulateOnLineChart" option (credit to Skipperxit/Mimmo) //| //+---------------------------------------------------------------------------+ #property copyright "" //+------------------------------------------------------------------+ //| Code added to orgininal copy //| 1) Large Labels //| The above added code is clearly marked with START and END labels. //| OTHER THAN CODE INSERTION RE ABOVE, NO ORIGINAL CODE HAS BEEN ALTERED. //| 2012 File45 //+------------------------------------------------------------------+ #include #include //+------------------------------------------------------------------+ #import "user32.dll" int RegisterWindowMessageA(string lpString); #import //+------------------------------------------------------------------+ extern int RenkoBoxSize = 15; extern int RenkoBoxOffset = 0; extern int RenkoTimeFrame = 2; // What time frame to use for the offline renko chart extern bool ShowWicks = false; extern bool EmulateOnLineChart = true; extern bool StrangeSymbolName = false; //+------------------------------------------------------------------+ //| START : LABEL DEFAULTS //+------------------------------------------------------------------+ extern string Large_Label_Options = "*** Large Font Support ***"; extern int Font_Size = 15; extern int Label_X_Distance = 20; extern int Label_Y_Distance = 20; extern int Label_Corner = 0; extern color Font_Color = DodgerBlue; extern string Font_Face = "Arial"; extern bool Wicks_Label = false; extern bool BoxOffset_Label = false; //+------------------------------------------------------------------+ //| END : LABEL DEFAULTS //+------------------------------------------------------------------+ //+------------------------------------------------------------------+ int HstHandle = -1, LastFPos = 0, MT4InternalMsg = 0; int Y_Adjust; string SymbolName; string Show_Wicks = ""; string RenkoSymbol; //+------------------------------------------------------------------+ void UpdateChartWindow() { static int hwnd = 0; if(hwnd == 0) { hwnd = WindowHandle(SymbolName, RenkoTimeFrame); if(hwnd != 0) Print("Chart window detected"); } if(EmulateOnLineChart && MT4InternalMsg == 0) MT4InternalMsg = RegisterWindowMessageA("MetaTrader4_Internal_Message"); if(hwnd != 0) if(PostMessageA(hwnd, WM_COMMAND, 0x822c, 0) == 0) hwnd = 0; if(hwnd != 0 && MT4InternalMsg != 0) PostMessageA(hwnd, MT4InternalMsg, 2, 1); return; } int init() { if (ShowWicks == false) { Show_Wicks = "off"; } else { Show_Wicks = "on"; } if (Wicks_Label == true) { Y_Adjust = 8; } else { Y_Adjust = 6; } } //+------------------------------------------------------------------+ int start() { //+------------------------------------------------------------------+ //| START : LARGE LABELS //+------------------------------------------------------------------+ int RBS_Y_Distance = Label_Y_Distance + Font_Size*2; int RTF_Y_Distance = Label_Y_Distance + Font_Size*4; int RWK_Y_Distance = Label_Y_Distance + Font_Size*6; int RBO_Y_Distance = Label_Y_Distance + Font_Size*Y_Adjust; string SYB=RenkoSymbol; ObjectCreate("SYB",OBJ_LABEL,0,0,0); ObjectSetText("SYB",Symbol(), Font_Size, Font_Face,Font_Color); ObjectSet("SYB",OBJPROP_CORNER,Label_Corner); ObjectSet("SYB",OBJPROP_XDISTANCE, Label_X_Distance); ObjectSet("SYB",OBJPROP_YDISTANCE, Label_Y_Distance); string RBS=RenkoBoxSize; ObjectCreate("RBS",OBJ_LABEL,0,0,0); ObjectSetText("RBS","Renko BS - " + RBS, Font_Size, Font_Face,Font_Color); ObjectSet("RBS",OBJPROP_CORNER,Label_Corner); ObjectSet("RBS",OBJPROP_XDISTANCE, Label_X_Distance); ObjectSet("RBS",OBJPROP_YDISTANCE, RBS_Y_Distance); string RTF=RenkoTimeFrame; ObjectCreate("RTF",OBJ_LABEL,0,0,0); ObjectSetText("RTF","Renko TF - M" + RTF, Font_Size,Font_Face,Font_Color); ObjectSet("RTF",OBJPROP_CORNER,Label_Corner); ObjectSet("RTF",OBJPROP_XDISTANCE, Label_X_Distance); ObjectSet("RTF",OBJPROP_YDISTANCE, RTF_Y_Distance); if (Wicks_Label == true) { string WIC=ShowWicks; ObjectCreate("WIC",OBJ_LABEL,0,0,0); ObjectSetText("WIC","Wicks - " + Show_Wicks, Font_Size,Font_Face,Font_Color); ObjectSet("WIC",OBJPROP_CORNER,Label_Corner); ObjectSet("WIC",OBJPROP_XDISTANCE, Label_X_Distance); ObjectSet("WIC",OBJPROP_YDISTANCE, RWK_Y_Distance); } if (BoxOffset_Label == true) { string RBO=RenkoBoxOffset; ObjectCreate("RBO",OBJ_LABEL,0,0,0); ObjectSetText("RBO","BoxOffset - " + RenkoBoxOffset, Font_Size,Font_Face,Font_Color); ObjectSet("RBO",OBJPROP_CORNER,Label_Corner); ObjectSet("RBO",OBJPROP_XDISTANCE, Label_X_Distance); ObjectSet("RBO",OBJPROP_YDISTANCE, RBO_Y_Distance); } //+------------------------------------------------------------------+ //| END : LARGE LABELS //+------------------------------------------------------------------+ static double BoxPoints, UpWick, DnWick; static double PrevLow, PrevHigh, PrevOpen, PrevClose, CurVolume, CurLow, CurHigh, CurOpen, CurClose; static datetime PrevTime; //+------------------------------------------------------------------+ // This is only executed ones, then the first tick arives. if(HstHandle < 0) { // Init // Error checking if(!IsConnected()) { Print("Waiting for connection..."); return(0); } if(!IsDllsAllowed()) { Print("Error: Dll calls must be allowed!"); return(-1); } if(MathAbs(RenkoBoxOffset) >= RenkoBoxSize) { Print("Error: |RenkoBoxOffset| should be less then RenkoBoxSize!"); return(-1); } switch(RenkoTimeFrame) { case 1: case 5: case 15: case 30: case 60: case 240: case 1440: case 10080: case 43200: case 0: Print("Error: Invald time frame used for offline renko chart (RenkoTimeFrame)!"); return(-1); } // int BoxSize = RenkoBoxSize; int BoxOffset = RenkoBoxOffset; if(Digits == 5 || (Digits == 3 && StringFind(Symbol(), "JPY") != -1)) { BoxSize = BoxSize*10; BoxOffset = BoxOffset*10; } if(Digits == 6 || (Digits == 4 && StringFind(Symbol(), "JPY") != -1)) { BoxSize = BoxSize*100; BoxOffset = BoxOffset*100; } //+------------------------------------------------------------------+ //| START : 1 DIGIT PRICING //+------------------------------------------------------------------+ if (Digits == 1) { BoxSize = BoxSize * 10; BoxOffset = BoxOffset * 10; } //+------------------------------------------------------------------+ //| END : 1 DIGIT PRICING //+------------------------------------------------------------------+ if(StrangeSymbolName) SymbolName = StringSubstr(Symbol(), 0, 6); else SymbolName = Symbol(); BoxPoints = NormalizeDouble(BoxSize*Point, Digits); PrevLow = NormalizeDouble(BoxOffset*Point + MathFloor(Close[Bars-1]/BoxPoints)*BoxPoints, Digits); DnWick = PrevLow; PrevHigh = PrevLow + BoxPoints; UpWick = PrevHigh; PrevOpen = PrevLow; PrevClose = PrevHigh; CurVolume = 1; PrevTime = Time[Bars-1]; // create / open hst file HstHandle = FileOpenHistory(SymbolName + RenkoTimeFrame + ".hst", FILE_BIN|FILE_WRITE); if(HstHandle < 0) { Print("Error: can\'t create / open history file: " + ErrorDescription(GetLastError()) + ": " + SymbolName + RenkoTimeFrame + ".hst"); return(-1); } // // write hst file header int HstUnused[13]; FileWriteInteger(HstHandle, 400, LONG_VALUE); // Version FileWriteString(HstHandle, "", 64); // Copyright FileWriteString(HstHandle, SymbolName, 12); // Symbol FileWriteInteger(HstHandle, RenkoTimeFrame, LONG_VALUE); // Period FileWriteInteger(HstHandle, Digits, LONG_VALUE); // Digits FileWriteInteger(HstHandle, 0, LONG_VALUE); // Time Sign FileWriteInteger(HstHandle, 0, LONG_VALUE); // Last Sync FileWriteArray(HstHandle, HstUnused, 0, 13); // Unused // // process historical data int i = Bars-2; //Print(Symbol() + " " + High + " " + Low + " " + Open + " " + Close); //--------------------------------------------------------------------------- while(i >= 0) { CurVolume = CurVolume + Volume; UpWick = MathMax(UpWick, High); DnWick = MathMin(DnWick, Low); // update low before high or the reverse depending on previous bar bool UpTrend = High+Low > High[i+1]+Low[i+1]; while(!UpTrend && (Low < PrevLow-BoxPoints || CompareDoubles(Low, PrevLow-BoxPoints))) { PrevHigh = PrevHigh - BoxPoints; PrevLow = PrevLow - BoxPoints; PrevOpen = PrevHigh; PrevClose = PrevLow; FileWriteInteger(HstHandle, PrevTime, LONG_VALUE); FileWriteDouble(HstHandle, PrevOpen, DOUBLE_VALUE); FileWriteDouble(HstHandle, PrevLow, DOUBLE_VALUE); if(ShowWicks && UpWick > PrevHigh) FileWriteDouble(HstHandle, UpWick, DOUBLE_VALUE); else FileWriteDouble(HstHandle, PrevHigh, DOUBLE_VALUE); FileWriteDouble(HstHandle, PrevClose, DOUBLE_VALUE); FileWriteDouble(HstHandle, CurVolume, DOUBLE_VALUE); UpWick = 0; DnWick = EMPTY_VALUE; CurVolume = 0; CurHigh = PrevLow; CurLow = PrevLow; if(PrevTime < Time) PrevTime = Time; else PrevTime++; } while(High > PrevHigh+BoxPoints || CompareDoubles(High, PrevHigh+BoxPoints)) { PrevHigh = PrevHigh + BoxPoints; PrevLow = PrevLow + BoxPoints; PrevOpen = PrevLow; PrevClose = PrevHigh; FileWriteInteger(HstHandle, PrevTime, LONG_VALUE); FileWriteDouble(HstHandle, PrevOpen, DOUBLE_VALUE); if(ShowWicks && DnWick < PrevLow) FileWriteDouble(HstHandle, DnWick, DOUBLE_VALUE); else FileWriteDouble(HstHandle, PrevLow, DOUBLE_VALUE); FileWriteDouble(HstHandle, PrevHigh, DOUBLE_VALUE); FileWriteDouble(HstHandle, PrevClose, DOUBLE_VALUE); FileWriteDouble(HstHandle, CurVolume, DOUBLE_VALUE); UpWick = 0; DnWick = EMPTY_VALUE; CurVolume = 0; CurHigh = PrevHigh; CurLow = PrevHigh; if(PrevTime < Time) PrevTime = Time; else PrevTime++; } while(UpTrend && (Low < PrevLow-BoxPoints || CompareDoubles(Low, PrevLow-BoxPoints))) { PrevHigh = PrevHigh - BoxPoints; PrevLow = PrevLow - BoxPoints; PrevOpen = PrevHigh; PrevClose = PrevLow; FileWriteInteger(HstHandle, PrevTime, LONG_VALUE); FileWriteDouble(HstHandle, PrevOpen, DOUBLE_VALUE); FileWriteDouble(HstHandle, PrevLow, DOUBLE_VALUE); if(ShowWicks && UpWick > PrevHigh) FileWriteDouble(HstHandle, UpWick, DOUBLE_VALUE); else FileWriteDouble(HstHandle, PrevHigh, DOUBLE_VALUE); FileWriteDouble(HstHandle, PrevClose, DOUBLE_VALUE); FileWriteDouble(HstHandle, CurVolume, DOUBLE_VALUE); UpWick = 0; DnWick = EMPTY_VALUE; CurVolume = 0; CurHigh = PrevLow; CurLow = PrevLow; if(PrevTime < Time) PrevTime = Time; else PrevTime++; } i--; } LastFPos = FileTell(HstHandle); // Remember Last pos in file // Comment("RenkoLiveChart(" + RenkoBoxSize + "): Open Offline ", SymbolName, ",M", RenkoTimeFrame, " to view chart"); if(Close[0] > MathMax(PrevClose, PrevOpen)) CurOpen = MathMax(PrevClose, PrevOpen); else if (Close[0] < MathMin(PrevClose, PrevOpen)) CurOpen = MathMin(PrevClose, PrevOpen); else CurOpen = Close[0]; CurClose = Close[0]; if(UpWick > PrevHigh) CurHigh = UpWick; if(DnWick < PrevLow) CurLow = DnWick; FileWriteInteger(HstHandle, PrevTime, LONG_VALUE); // Time FileWriteDouble(HstHandle, CurOpen, DOUBLE_VALUE); // Open FileWriteDouble(HstHandle, CurLow, DOUBLE_VALUE); // Low FileWriteDouble(HstHandle, CurHigh, DOUBLE_VALUE); // High FileWriteDouble(HstHandle, CurClose, DOUBLE_VALUE); // Close FileWriteDouble(HstHandle, CurVolume, DOUBLE_VALUE); // Volume FileFlush(HstHandle); UpdateChartWindow(); return(0); // End historical data / Init } //---------------------------------------------------------------------------- // HstHandle not < 0 so we always enter here after history done // Begin live data feed UpWick = MathMax(UpWick, Bid); DnWick = MathMin(DnWick, Bid); CurVolume++; FileSeek(HstHandle, LastFPos, SEEK_SET); //------------------------------------------------------------------------- // up box if(Bid > PrevHigh+BoxPoints || CompareDoubles(Bid, PrevHigh+BoxPoints)) { PrevHigh = PrevHigh + BoxPoints; PrevLow = PrevLow + BoxPoints; PrevOpen = PrevLow; PrevClose = PrevHigh; FileWriteInteger(HstHandle, PrevTime, LONG_VALUE); FileWriteDouble(HstHandle, PrevOpen, DOUBLE_VALUE); if (ShowWicks && DnWick < PrevLow) FileWriteDouble(HstHandle, DnWick, DOUBLE_VALUE); else FileWriteDouble(HstHandle, PrevLow, DOUBLE_VALUE); FileWriteDouble(HstHandle, PrevHigh, DOUBLE_VALUE); FileWriteDouble(HstHandle, PrevClose, DOUBLE_VALUE); FileWriteDouble(HstHandle, CurVolume, DOUBLE_VALUE); FileFlush(HstHandle); LastFPos = FileTell(HstHandle); // Remeber Last pos in file if(PrevTime < TimeCurrent()) PrevTime = TimeCurrent(); else PrevTime++; CurVolume = 0; CurHigh = PrevHigh; CurLow = PrevHigh; UpWick = 0; DnWick = EMPTY_VALUE; UpdateChartWindow(); } //------------------------------------------------------------------------- // down box else if(Bid < PrevLow-BoxPoints || CompareDoubles(Bid,PrevLow-BoxPoints)) { PrevHigh = PrevHigh - BoxPoints; PrevLow = PrevLow - BoxPoints; PrevOpen = PrevHigh; PrevClose = PrevLow; FileWriteInteger(HstHandle, PrevTime, LONG_VALUE); FileWriteDouble(HstHandle, PrevOpen, DOUBLE_VALUE); FileWriteDouble(HstHandle, PrevLow, DOUBLE_VALUE); if(ShowWicks && UpWick > PrevHigh) FileWriteDouble(HstHandle, UpWick, DOUBLE_VALUE); else FileWriteDouble(HstHandle, PrevHigh, DOUBLE_VALUE); FileWriteDouble(HstHandle, PrevClose, DOUBLE_VALUE); FileWriteDouble(HstHandle, CurVolume, DOUBLE_VALUE); FileFlush(HstHandle); LastFPos = FileTell(HstHandle); // Remeber Last pos in file if(PrevTime < TimeCurrent()) PrevTime = TimeCurrent(); else PrevTime++; CurVolume = 0; CurHigh = PrevLow; CurLow = PrevLow; UpWick = 0; DnWick = EMPTY_VALUE; UpdateChartWindow(); } //------------------------------------------------------------------------- // no box - high/low not hit else { if(Bid > CurHigh) CurHigh = Bid; if(Bid < CurLow) CurLow = Bid; /* if(PrevHigh <= Bid) CurOpen = PrevHigh; else if(PrevLow >= Bid) CurOpen = PrevLow; else CurOpen = Bid; */ CurOpen = PrevClose; CurClose = Bid; FileWriteInteger(HstHandle, PrevTime, LONG_VALUE); // Time FileWriteDouble(HstHandle, CurOpen, DOUBLE_VALUE); // Open FileWriteDouble(HstHandle, CurLow, DOUBLE_VALUE); // Low FileWriteDouble(HstHandle, CurHigh, DOUBLE_VALUE); // High FileWriteDouble(HstHandle, CurClose, DOUBLE_VALUE); // Close FileWriteDouble(HstHandle, CurVolume, DOUBLE_VALUE); // Volume FileFlush(HstHandle); UpdateChartWindow(); } return(0); } //+------------------------------------------------------------------+ int deinit() { if(HstHandle >= 0) { FileClose(HstHandle); HstHandle = -1; } Comment(""); ObjectDelete("SYB"); ObjectDelete("RBS"); ObjectDelete("RTF"); ObjectDelete("WIC"); ObjectDelete("RBO"); return(0); } //+------------------------------------------------------------------+
TK29帖子1楼右侧xm竖版广告90-240
个性签名

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

广告
TK30+TK31帖子一樓廣告
TK30+TK31帖子一樓廣告
warmwolf
注册时间2014-09-04
发表于:2015-08-21 03:19只看该作者
2楼
这个加载在不同的周期,有什么区别吗?
tmdabc
注册时间2014-10-01
Pzxzx
注册时间2017-08-06

本站免责声明:

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

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

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

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

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

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