- //+------------------------------------------------------------------+
- //| 超级5M Scalper.mq4 |
- //| |
- //|
- //+------------------------------------------------------------------+
- #property copyright "从mpfx借来的一些code"
- #property link ""
- #include <stdlib.mqh>
- extern double Lots = 0.01;
- extern double TakeProfit = 10;
- extern double Stoploss = 17;
- extern double TrailingStop = 9;
- extern double Slippage = 2;
- extern double risk = 5.0;
- extern double Pips = 16;
- extern double Perc = 5;
- double Points;
- //int color arrow_color=CLR_NONE;
- int init ()
- {
- Points = MarketInfo (Symbol(), MODE_POINT);
- //----
- return(0);
- }
- //+------------------------------------------------------------------+
- //| |
- //+------------------------------------------------------------------+
- int deinit()
- {
- return(0);
- }
- //+------------------------------------------------------------------+
- //+------------------------------------------------------------------+
- //| expert start function |
- //+------------------------------------------------------------------+
- int start()
- {
- double Levv=0;
- int cnt=0, total;
- if(Bars<100)
- {
- Print("bars less than 100");
- return(0);
- }
- if(OrdersTotal()<1)
- {
- if(AccountFreeMargin()<(1000*Lots))
- {
- Print("没钱了");
- return(0);
- }
- Levv= (MathCeil(AccountEquity() * risk / 10000)/10);
- // (BUY)
- if (Close[1]>Close[2]&&Close[2]>Close[3])
- {
- OrderSend(Symbol(),OP_BUY,Levv,Bid,Slippage,Bid-Stoploss*Points,Ask+TakeProfit*Points,0,0,Red);
- return(0);
- }
- // (SELL)
- if (Close[1]<Close[2]&&Close[2]>Close[3])
- {
- OrderSend(Symbol(),OP_SELL,Levv,Ask,Slippage,Ask+Stoploss*Points,Bid-TakeProfit*Points,0,0,Red);
- return(0);
- }
- }
- total=OrdersTotal();
- for(cnt=0;cnt<OrdersTotal();cnt++)
- {
- OrderSelect(cnt, SELECT_BY_POS, MODE_TRADES);
- if(OrderType()<=OP_SELL && OrderSymbol()==Symbol())
- {
- if(OrderType()==OP_BUY)
- {
- //if((OrderOpenTime() - (CurTime() >= 300))|| (AccountProfit() >20))
- if((CurTime() - (OrderOpenTime() >= 300)) || (AccountProfit() >20))
- {
- OrderClose(OrderTicket(),OrderLots(),Ask,0,Violet);
- return(0);
- }
- }
- }
- }
- total=OrdersTotal();
- for(cnt=0;cnt<OrdersTotal();cnt++)
- {
- OrderSelect(cnt, SELECT_BY_POS, MODE_TRADES);
- if(OrderType()<=OP_BUY && OrderSymbol()==Symbol())
- {
- if(OrderType()==OP_SELL)
- {
- //if ((OrderOpenTime() - (CurTime() >= 300))|| (AccountProfit() >20))//1 Day//
- if((CurTime() - (OrderOpenTime() >= 300)) || (AccountProfit() >20))
- {
- OrderClose(OrderTicket(),OrderLots(),Bid,0,Violet);
- return(0);
- }
- }
- }
- }
- }
复制代码 编译能通过的。但是你要改一下就能用了无论哪个品种和时间段都能用的。一上手就动作。漫无方向。
大趋势大动作小趋势小动作,把数据优化一下可以 做你的grail
|