I managed to do it as I want I have something in code , it repeats the order type , listing them all as Buy Limit:
#property copyright "test"
#property link "https://www.mql5.com"
#property version "1.00"
#property strict
//+------------------------------------------------------------------+
//| Script program start function |
//+------------------------------------------------------------------+
void OnStart()
{
//---
int handle=FileOpen("107.csv",FILE_WRITE|FILE_CSV,"\t");
if(handle<0) return;
// write header
// FileWrite(handle,"#","open price","symbol","lots");
FileWrite(handle, " , " ,"open price", " , " ,"symbol", " , " ,"lots", " , " ,"Type");
int total=OrdersTotal();
// write open orders
for(int pos=0;pos<total;pos++)
{
if(OrderSelect(pos,SELECT_BY_POS)==false) continue;
ENUM_ORDER_TYPE type=ORDER_TYPE_BUY_LIMIT; ORDER_TYPE_SELL_LIMIT; ORDER_TYPE_BUY_STOP; ORDER_TYPE_SELL_STOP; OrderType();
FileWrite(handle," , ", OrderOpenPrice()," , " , OrderSymbol()," , " , OrderLots()," , ", EnumToString(type));
}
FileClose(handle);
if(OrderSelect(2, SELECT_BY_TICKET)==true)
OrderPrint();
else
Print("OrderSelect failed error code is",GetLastError());
}
//+------------------------------------------------------------------+
open price | symbol | lots | Type |
85.018 | CADJPY | 0.05 | ORDER_TYPE_BUY_LIMIT |
83.90000000000001 | CADJPY | 0.05 | ORDER_TYPE_BUY_LIMIT |
86 | CADJPY | 0.05 | ORDER_TYPE_BUY_LIMIT |
87 | CADJPY | 0.05 | ORDER_TYPE_BUY_LIMIT |
82 | CADJPY | 0.05 | ORDER_TYPE_BUY_LIMIT |
111.835 | CHFJPY | 0.05 | ORDER_TYPE_BUY_LIMIT |
1.7252 | EURNZD | 0.05 | ORDER_TYPE_BUY_LIMIT |
0.7101 | AUDCHF | 0.05 | ORDER_TYPE_BUY_LIMIT |
- www.mql5.com
Also it is not the solution but I can browse them all , I will filter for now by excel , but I still need to select only the specified order types:
#property copyright "test"
#property link "https://www.mql5.com"
#property version "1.00"
#property strict
//+------------------------------------------------------------------+
//| Script program start function |
//+------------------------------------------------------------------+
void OnStart()
{
//---
int handle=FileOpen("200.csv",FILE_WRITE|FILE_CSV,"\t");
if(handle<0) return;
// write header
FileWrite(handle, " , " ,"open price", " , " ,"symbol", " , " ,"lots", " , " ,"Type");
int total=OrdersTotal();
// write open orders
for(int pos=0;pos<total;pos++)
{
if(OrderSelect(pos,SELECT_BY_POS)==false) continue;
ENUM_ORDER_TYPE type=OrderType();
FileWrite(handle," , ", OrderOpenPrice()," , " , OrderSymbol()," , " , OrderLots()," , ", EnumToString(type));
}
FileClose(handle);
if(OrderSelect(2, SELECT_BY_TICKET)==true)
OrderPrint();
else
Print("OrderSelect failed error code is",GetLastError());
}
//+------------------------------------------------------------------+
- www.mql5.com
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Hi,,
I found below code , it does what I want, the problem it dumps all orders types , I just need the pending orders:
I believe my problem in this line:
---> ENUM_ORDER_TYPE type=(ENUM_ORDER_TYPE) OrderType();
I need to put only below Identifiers :
================================
#property copyright "test"
#property link "https://www.mql5.com"
#property version "1.00"
#property strict
//+------------------------------------------------------------------+
//| Script program start function |
//+------------------------------------------------------------------+
void OnStart()
{
//---
int handle=FileOpen("OrdersReport.csv",FILE_WRITE|FILE_CSV,"\t");
if(handle<0) return;
// write header
FileWrite(handle,"#","open price","open time","symbol","lots");
int total=OrdersTotal();
// write open orders
for(int pos=0;pos<total;pos++)
{
if(OrderSelect(pos,SELECT_BY_POS)==false) continue;
ENUM_ORDER_TYPE type=(ENUM_ORDER_TYPE) OrderType();
FileWrite(handle,OrderTicket(),OrderOpenPrice(),OrderOpenTime(),OrderSymbol(),OrderLots(),EnumToString(type));
}
FileClose(handle);
if(OrderSelect(2, SELECT_BY_TICKET)==true)
OrderPrint();
else
Print("OrderSelect failed error code is",GetLastError());
}
//+------------------------------------------------------------------+