//+------------------------------------------------------------------+
//| signal .mq4 |
//| Copyright ?2009, metaQuotes Software Corp. |
//| http://www.metaquotes.net |
//+------------------------------------------------------------------+
#property copyright Copyright ?2009, metaQuotes Software Corp.
#property link http://www.metaquotes.net
//---- indicator settings
#property indicator_chart_window
#property indicator_buffers 0
#property indicator_minimum 0
#property indicator_maximum 1
//---- indicator parameters
extern int win = 0;
extern int pricexoffset= 47 ;
extern int priceyoffset= 30 ;
extern int myFontSize = 14;
extern string noteTimeNY = 14:00 server time = 05:00 mst
extern string noteTimeAU = 23:00 server time = 14:00 mst
extern string noteTimeLD = 09:00 server time = 00:00 mst
extern string myHHMM = 13:00 // 05:00 am pst = 14:00 server time
extern string myMessage = NY
extern string Buy_Message = BUY SIGNAL
extern string Wait_Message = WAIT FOR SIGNAL
extern string Sell_Message = SELL SIGNAL
extern string Rdy_Message = READY TO ENTER
extern color Buy_color = Lime;
extern color Wait_color = Yellow;
extern color Sell_color = Red;
extern color Rdy_color = Aqua;
//---- indicator buffers
//---- buffers
string tMessage , oldmsg =
//+--------- TRO MODIFICATION ---------------------------------------+
string symbol, tChartPeriod, tShortName ;
int digits, period ;
datetime Trigger ;
int OldBars = -1 ;
color tColor = Yellow ;
color ClOpColor;
double H1_open, H1_close, open, close, diff, spread, DailyOpen ;
//+------------------------------------------------------------------+
int init()
{
period = Period() ;
// tChartPeriod = TimeframeToString(period) ;
symbol = Symbol() ;
digits = Digits ;
tShortName = tw + symbol + tChartPeriod ;
return(0);
}
int deinit()
{
ObjectDelete( TRAIN30
ObjectDelete( TRAIN29
ObjectDelete( TRAIN29B
ObjectDelete( TRAIN31
ObjectDelete( TRAIN32
ObjectDelete( TRAIN34
ObjectDelete( TRAIN30
ObjectDelete( TRAIN29
ObjectDelete( TRAIN29B
ObjectDelete( TRAIN31
ObjectDelete( TRAIN32
ObjectDelete( TRAIN34
}
//+------------------------------------------------------------------+
int start()
{
DoDailyOpen() ;
// open = iOpen(symbol,PERIOD_D1,0);
close = Close[0];
open = Open[0];
H1_open = iOpen(symbol,PERIOD_H1,0);
// H1_close = iClose(symbol,PERIOD_H1,0);
while(true)
{
if( close open close DailyOpen close H1_open ) { tMessage = Buy_Message ; ClOpColor = Buy_color ; break ; }
if( close open close DailyOpen close H1_open ) { tMessage = Sell_Message ; ClOpColor = Sell_color ; break ; }
tMessage = Wait_Message ; ClOpColor = Wait_color ;
break;
} // while
oldmsg = tMessage ;
//+------------------------------------------------------------------+
ObjectCreate( TRAIN31 , OBJ_LABEL, win, 0, 0);//HiLow LABEL
ObjectSetText( TRAIN31 ,tMessage, myFontSize , Segoe Print , ClOpColor );
ObjectSet( TRAIN31 , OBJPROP_CORNER, 0);
ObjectSet( TRAIN31 , OBJPROP_XDISTANCE, pricexoffset);
ObjectSet( TRAIN31 , OBJPROP_YDISTANCE, priceyoffset);
string note2 = Default Font Color
color twFontColor = DimGray;
string note3 = Font Size
int twFontSize = 8;
string note4 = Font Type
string twFontType = Verdana // Tahoma Courier
string RAN953 = ;
string tObjName03 = TROTW ;
ObjectCreate(tObjName03, OBJ_LABEL, 0, 0, 0);//HiLow LABEL
ObjectSetText(tObjName03, RAN953 , twFontSize , twFontType, twFontColor );
ObjectSet(tObjName03, OBJPROP_CORNER, 3);
ObjectSet(tObjName03, OBJPROP_XDISTANCE, 5 );
ObjectSet(tObjName03, OBJPROP_YDISTANCE, 10);
//+------------------------------------------------------------------+
WindowRedraw();
return(0);
}
//+------------------------------------------------------------------+
void DoDailyOpen()
{
int yy = TimeYear(Time[0]);
int mm = TimeMonth(Time[0]);
int dd = TimeDay(Time[0]);
string yymmddms = yy+ . +mm+ . +dd+ + myHHMM ;
datetime var1 = StrToTime(yymmddms);
datetime day=24*60*60;
datetime r= var1 ;
int cd=iBarShift(NULL,0,r,FALSE);
datetime r2=r-day;
if(TimeDayOfWeek(r2)==0) r2=r2-day-day;
int cd2=iBarShift(NULL,0,r2,FALSE);
if( var1 Time[0] ) { r = r2 ;cd = cd2 ;} // if date/time is greater than current date/time go back 1 day
DailyOpen = Open[cd] ;
}
//+------------------------------------------------------------------+
你看看是不是
汇友之家 发表于 2015-2-2 14:24
//+------------------------------------------------------------------+
//| ...
测试了 警告 not all control paths return a value 你.mq4 101 1
外汇交易有很大的风险性,本站所有资源均来自网络,请选择使用,如若出现亏损,本站不承担任何责任!