顺水外汇EA交易网MT4
标题:
希望高手们帮忙修改源码
[打印本页]
作者:
js0371
时间:
2018-1-11 16:31
标题:
希望高手们帮忙修改源码
以下是一个显示开盘到收盘波动范围的指标源码,由于我用的是北京时间的MT4软件,所以指标显示不够准确,图中的蓝色框只能显示早6点到晚23点,以后不能显示蓝色框,希望高手们帮忙修改源码,让蓝色框从早6点到次日5点。
[attach]21647[/attach]
[attach]21648[/attach]
[attach]21649[/attach]
//+------------------------------------------------------------------+
//| BreakOutPANCA-EAGLE.mq4 |
//| hapalkos |
//| 2007.11.20 |
//| ++ modified so that rectangles do not overlay |
//| ++ this makes color selection more versatile |
//| ++ code consolidated |
//+------------------------------------------------------------------+
#property copyright "hapalkos"
#property link ""
#property indicator_chart_window
extern int NumberOfDays = 50;
extern string periodBegin = "00:00";
extern string periodEnd = "05:30";
extern string BoxEnd = "23:00";
extern int BoxBreakOut_Offset = 10;
extern color BoxHLColor = MidnightBlue;
extern color BoxBreakOutColor = LimeGreen;
extern color BoxPeriodColor = OrangeRed;
//+------------------------------------------------------------------+
//| Custom indicator initialization function |
//+------------------------------------------------------------------+
void init() {
DeleteObjects();
}
//+------------------------------------------------------------------+
//| Custor indicator deinitialization function |
//+------------------------------------------------------------------+
void deinit() {
DeleteObjects();
return(0);
}
//+------------------------------------------------------------------+
//| Remove all Rectangles |
//+------------------------------------------------------------------+
void DeleteObjects() {
ObjectsDeleteAll(0,OBJ_RECTANGLE);
return(0);
}
//+------------------------------------------------------------------+
//| Custom indicator iteration function |
//+------------------------------------------------------------------+
void start() {
datetime dtTradeDate=TimeCurrent();
for (int i=0; i 5) dtTradeDate = decrementTradeDate(dtTradeDate);
}
}
//+------------------------------------------------------------------+
//| Create Rectangles |
//+------------------------------------------------------------------+
void DrawObjects(datetime dtTradeDate, string sObjName, string sTimeBegin, string sTimeEnd, string sTimeObjEnd, color cObjColor, int iOffSet, int iForm) {
datetime dtTimeBegin, dtTimeEnd, dtTimeObjEnd;
double dPriceHigh, dPriceLow;
int iBarBegin, iBarEnd;
dtTimeBegin = StrToTime(TimeToStr(dtTradeDate, TIME_DATE) + " " + sTimeBegin);
dtTimeEnd = StrToTime(TimeToStr(dtTradeDate, TIME_DATE) + " " + sTimeEnd);
dtTimeObjEnd = StrToTime(TimeToStr(dtTradeDate, TIME_DATE) + " " + sTimeObjEnd);
iBarBegin = iBarShift(NULL, 0, dtTimeBegin);
iBarEnd = iBarShift(NULL, 0, dtTimeEnd);
dPriceHigh = High[Highest(NULL, 0, MODE_HIGH, iBarBegin-iBarEnd, iBarEnd)];
dPriceLow = Low [Lowest (NULL, 0, MODE_LOW , iBarBegin-iBarEnd, iBarEnd)];
ObjectCreate(sObjName, OBJ_RECTANGLE, 0, 0, 0, 0, 0);
ObjectSet(sObjName, OBJPROP_TIME1 , dtTimeBegin);
ObjectSet(sObjName, OBJPROP_TIME2 , dtTimeObjEnd);
//---- High-Low Rectangle
if(iForm==1){
ObjectSet(sObjName, OBJPROP_PRICE1, dPriceHigh);
ObjectSet(sObjName, OBJPROP_PRICE2, dPriceLow);
ObjectSet(sObjName, OBJPROP_STYLE, STYLE_SOLID);
ObjectSet(sObjName, OBJPROP_COLOR, cObjColor);
ObjectSet(sObjName, OBJPROP_BACK, True);
}
//---- Upper Rectangle
if(iForm==2){
ObjectSet(sObjName, OBJPROP_PRICE1, dPriceHigh);
ObjectSet(sObjName, OBJPROP_PRICE2, dPriceHigh + iOffSet*Point);
ObjectSet(sObjName, OBJPROP_STYLE, STYLE_SOLID);
ObjectSet(sObjName, OBJPROP_COLOR, cObjColor);
ObjectSet(sObjName, OBJPROP_BACK, True);
}
//---- Lower Rectangle
if(iForm==3){
ObjectSet(sObjName, OBJPROP_PRICE1, dPriceLow - iOffSet*Point);
ObjectSet(sObjName, OBJPROP_PRICE2, dPriceLow);
ObjectSet(sObjName, OBJPROP_STYLE, STYLE_SOLID);
ObjectSet(sObjName, OBJPROP_COLOR, cObjColor);
ObjectSet(sObjName, OBJPROP_BACK, True);
}
//---- Period Rectangle
if(iForm==4){
ObjectSet(sObjName, OBJPROP_PRICE1, dPriceHigh + iOffSet*Point);
ObjectSet(sObjName, OBJPROP_PRICE2, dPriceLow - iOffSet*Point);
ObjectSet(sObjName, OBJPROP_STYLE, STYLE_SOLID);
ObjectSet(sObjName, OBJPROP_COLOR, cObjColor);
ObjectSet(sObjName, OBJPROP_WIDTH, 2);
ObjectSet(sObjName, OBJPROP_BACK, False);
}
string sObjDesc = StringConcatenate("High: ",dPriceHigh," Low: ", dPriceLow, " OffSet: ",iOffSet);
ObjectSetText(sObjName, sObjDesc,10,"Times New Roman",Black);
}
//+------------------------------------------------------------------+
//| Decrement Date to draw objects in the past |
//+------------------------------------------------------------------+
datetime decrementTradeDate (datetime dtTimeDate) {
int iTimeYear=TimeYear(dtTimeDate);
int iTimeMonth=TimeMonth(dtTimeDate);
int iTimeDay=TimeDay(dtTimeDate);
int iTimeHour=TimeHour(dtTimeDate);
int iTimeMinute=TimeMinute(dtTimeDate);
iTimeDay--;
if (iTimeDay==0) {
iTimeMonth--;
if (iTimeMonth==0) {
iTimeYear--;
iTimeMonth=12;
}
// Thirty days hath September...
if (iTimeMonth==4 || iTimeMonth==6 || iTimeMonth==9 || iTimeMonth==11) iTimeDay=30;
// ...all the rest have thirty-one...
if (iTimeMonth==1 || iTimeMonth==3 || iTimeMonth==5 || iTimeMonth==7 || iTimeMonth==8 || iTimeMonth==10 || iTimeMonth==12) iTimeDay=31;
// ...except...
if (iTimeMonth==2) if (MathMod(iTimeYear, 4)==0) iTimeDay=29; else iTimeDay=28;
}
return(StrToTime(iTimeYear + "." + iTimeMonth + "." + iTimeDay + " " + iTimeHour + ":" + iTimeMinute));
}
//+------------------------------------------------------------------+
作者:
jczu159
时间:
2018-1-11 16:46
你要人家幫你修改 還要收人家金幣?!
作者:
sun001002003
时间:
2018-1-11 17:00
这3个时间有用否?没用就去掉
extern string periodBegin = "00:00";
extern string periodEnd = "05:30";
extern string BoxEnd = "23:00";
也可以根据自己平台GMT时间+-一下
作者:
林雁
时间:
2018-1-11 17:51
没金币,买不起,等有钱人去玩吧。古德白!
作者:
yuanmingyuan
时间:
2018-1-11 18:55
把源码中时间修改成北京时间
作者:
rhinogreen
时间:
2018-1-11 19:35
看着太复杂了
作者:
wx_Zp4mxZsr
时间:
2018-1-11 20:18
谢谢分享
作者:
雨飞雪飘
时间:
2018-1-11 21:53
谢谢了
作者:
zx5zx
时间:
2018-1-11 22:14
获取投资智慧 分享投资快乐
作者:
allen144
时间:
2018-1-11 22:55
指标会超吗?我看交易,15分钟最合适吗?
欢迎光临 顺水外汇EA交易网MT4 (http://www.waterforex.com/)
Powered by Discuz! X3.2