-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathQueueTest.mq4
More file actions
56 lines (50 loc) · 1.8 KB
/
QueueTest.mq4
File metadata and controls
56 lines (50 loc) · 1.8 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
//+------------------------------------------------------------------+
//| QueueTest.mq4 |
//| Copyright 2014, MetaQuotes Software Corp. |
//| https://www.mql5.com |
//+------------------------------------------------------------------+
#property copyright "Copyright 2014, MetaQuotes Software Corp."
#property link "https://www.mql5.com"
#property version "1.00"
#property strict
#include "Trade.mqh"
#include "SymbolInfo.mqh"
#include "OrderInfo.mqh"
#include "OrderQueue.mqh"
#include <Arrays\List.mqh>
COrderQueue* queue;
CTrade* trade;
int ticks = 0;
//+------------------------------------------------------------------+
//| Expert initialization function |
//+------------------------------------------------------------------+
int OnInit()
{
queue = new COrderQueue();
trade = new CTrade();
trade.SetLogLevel(LOG_LEVEL_ERRORS);
return(INIT_SUCCEEDED);
}
//+------------------------------------------------------------------+
//| Expert tick function |
//+------------------------------------------------------------------+
void OnTick()
{
queue.Update();
ticks++;
Print("Íîâûé òèê: "+ticks);
Print("Êîëè÷åñòâî îðäåðîâ: "+queue.GetList().Total());
if (ticks % 3 == 0) {
trade.Buy(0.01, Ask, NULL, 0.0, 0.0);
}
}
//+------------------------------------------------------------------+
//| Expert deinitialization function |
//+------------------------------------------------------------------+
void OnDeinit(const int reason)
{
//---
delete queue;
delete trade;
}
//+------------------------------------------------------------------+