- //+------------------------------------------------------------------+
- //| 整点开仓.mq4 |
- //| 自律自由 |
- //| QQ:XXXXXX |
- //+------------------------------------------------------------------+
- #property copyright "自律自由"
- #property link "QQ:XXXXXX"
- #define MYMAGIC 20110510
- extern int myhour=3; //北京时间、整点。
- extern double N=1.4; //价位
- extern double mylot=0.1; //开仓手数
- extern double myprofit=30; //止盈点数
- extern double mystop=0; //止损点数,要大于5才生效。
- int mytick;
- double mypoint,myslip;
- //+------------------------------------------------------------------+
- //| expert initialization function |
- //+------------------------------------------------------------------+
- int init()
- {
- if(MarketInfo("EURUSD",MODE_DIGITS)==5){mypoint=10*Point;myslip=40;}
- else {mypoint=Point;myslip=4;}
- mytick=0;
- if MarketInfo("eruusd",MODE_DIGITS)
- return(0);
- }
- //+------------------------------------------------------------------+
- //| expert start function |
- //+------------------------------------------------------------------+
- int start()
- {
- if(mytick>0) return(0);
- else
- {
- if(TimeHour(TimeLocal())==myhour && TimeMinute(TimeLocal())<=1)
- {
- if(Close[0]>N)
- {
- if(mystop<=5) mytick=OrderSend(Symbol(),OP_BUY,mylot,Ask,myslip,0,Ask+myprofit*mypoint,"",MYMAGIC,0,Red);
- else mytick=OrderSend(Symbol(),OP_BUY,mylot,Ask,myslip,Ask-mystop*mypoint,Ask+myprofit*mypoint,"",MYMAGIC,0,Red);
- return(0);
- }
- else if(Close[0]
- {
- if(mystop<=5) mytick=OrderSend(Symbol(),OP_SELL,mylot,Bid,myslip,0,Bid-myprofit*mypoint,"",MYMAGIC,0,Green);
- else mytick=OrderSend(Symbol(),OP_SELL,mylot,Bid,myslip,Bid+mystop*mypoint,Bid-myprofit*mypoint,"",MYMAGIC,0,Green);
- return(0);
- }
- }
- }
- return(0);
- }
- //+------------------------------------------------------------------+
|