bah12ram:
What have you tried ?how to put a function inside start() that detect when OrdersTotal() change.
Thanks in Advance.
Alain Verleyen:
What have you tried ?
What have you tried ?
thanks. I want run it in an EA or indicator.
{
//---
int handle=FileOpen("OrdersReport.csv",FILE_WRITE|FILE_CSV,"\t");
if(handle<0) return;
// write header
FileWrite(handle,"Ticket","open price","open time");
int total=OrdersTotal();
// write open orders
for(int pos=0;pos<total;pos++)
{
if(OrderSelect(pos,SELECT_BY_POS)==false) continue;
FileWrite(handle,OrderTicket(),OrderOpenPrice(),OrderOpenTime());
FileClose(handle);
if(OrderSelect(2, SELECT_BY_TICKET)==true)
OrderPrint();
else
Print("OrderSelect failed error code is",GetLastError());
}
bah12ram:
{
//---
int handle=FileOpen("OrdersReport.csv",FILE_WRITE|FILE_CSV,"\t");
if(handle<0) return;
// write header
FileWrite(handle,"Ticket","open price","open time");
int total=OrdersTotal();
// write open orders
for(int pos=0;pos<total;pos++)
{
if(OrderSelect(pos,SELECT_BY_POS)==false) continue;
thanks. I want run it in an EA or indicator.
{
//---
int handle=FileOpen("OrdersReport.csv",FILE_WRITE|FILE_CSV,"\t");
if(handle<0) return;
// write header
FileWrite(handle,"Ticket","open price","open time");
int total=OrdersTotal();
// write open orders
for(int pos=0;pos<total;pos++)
{
if(OrderSelect(pos,SELECT_BY_POS)==false) continue;
FileWrite(handle,OrderTicket(),OrderOpenPrice(),OrderOpenTime());
FileClose(handle);
if(OrderSelect(2, SELECT_BY_TICKET)==true)
OrderPrint();
else
Print("OrderSelect failed error code is",GetLastError());
}
int orders=OrdersTotal(); //+------------------------------------------------------------------+ //| Expert tick function | //+------------------------------------------------------------------+ void OnTick() { //--- if(orders!=OrderTotal()) { orders=OrdersTotal(); Alert(orders); } } //+------------------------------------------------------------------+
int orders =-1; void start() { //--- int handle=FileOpen("OrdersReport.csv",FILE_WRITE|FILE_CSV,"\t"); if(handle<0) return; if(OrdersTotal()== orders) return; orders=OrdersTotal(); // write header FileWrite(handle,"Ticket","open price","open time"); int total=OrdersTotal(); // write open orders for(int pos=0;pos<total;pos++) { if(OrderSelect(pos,SELECT_BY_POS)) FileWrite(handle,OrderTicket(),OrderOpenPrice(),OrderOpenTime()); } FileClose(handle); } //+------------------------------------------------------------------+
You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
how to put a function inside start() that detect when OrdersTotal() change.
Thanks in Advance.