|
控制当前下单次数
- //+------------------------------------------------------------------+
- //| 六百.mq4 |
- //| Copyright 2016, MetaQuotes Software Corp. |
- //| https://www.mql5.com |
- //+------------------------------------------------------------------+
- #property copyright "Copyright 2016, MetaQuotes Software Corp."
- #property link "https://www.mql5.com"
- #property version "1.00"
- #property strict
- int ticket4;
- //+------------------------------------------------------------------+
- //| Expert initialization function |
- //+------------------------------------------------------------------+
- int OnInit()
- {
- //---
- //---
- return(INIT_SUCCEEDED);
- }
- //+------------------------------------------------------------------+
- //| Expert deinitialization function |
- //+------------------------------------------------------------------+
- void OnDeinit(const int reason)
- {
- //---
-
- }
- //+------------------------------------------------------------------+
- //| Expert tick function |
- //+------------------------------------------------------------------+
- void OnTick()
- {
-
- for (int i=1; i<=22; i++) { //启动ea自动下空单22个,一直循环到110个结束
- if(OrdersTotal()>=110)//当单子大于111个的时候,终结下单。即允许下单110个。
- {
- Print("TakeProfit less than 1000");
- return;
- }
-
- ticket4=OrderSend(Symbol(),OP_SELL,20,Bid,0,0,"",0,CLR_NONE); }
- }
- //+------------------------------------------------------------------+
复制代码 来源: EA代码探索之路一 下单循环 |
|