[ARCHIVE!] Any rookie question, so as not to clutter up the forum. Professionals, don't pass by. Can't go anywhere without you - 4. - page 213

 

I want to write test results (transactions) to a file after testing

I put the tofile () function in the deinit() block (it writes after the work is finished)

but the function itself

// Запись профитов в файл
void toFile( )
{
int handle=FileOpen("OrdersReport.csv",FILE_WRITE|FILE_CSV,"\t");
  if(handle<0) return(0);
  // запишем заголовок в файл
  FileWrite(handle,"#","проф");
 
  int total=OrdersTotal();
  // записываем в файл только закрытые ордера
  for(int pos=0;pos<total-1;pos++)
    {
     //FileSeek(handle, 0, SEEK_END);
     if(OrderSelect(pos,SELECT_BY_POS, MODE_HISTORY)==false) continue;
     FileWrite(handle,OrderTicket(),OrderProfit());
    }
  FileClose(handle);
  return;
does not work, it records only the header
 
So can you tell me which function returns the current price?
 
olis:
So can you tell me which function returns the current price?
Pazlo?
 

That's something! I'm not that clever, and I wouldn't have guessed it in Russian either.
 
YOUNGA:

I want to write test results (transactions) to a file after testing

I put the tofile () function in the deinit() block (it writes after the work is finished)

but the function itself

does not work, it writes only the header

int total=OrdersTotal();             //заменить на int total=OrdersHistoryTotal(); как-то так 
  // записываем в файл только закрытые ордера
 

It's just a "Bid" for an open order. Right? It shows me the real price. Or is this going to be a problem later on?
 
olis:

It is simply "Bid" for an open order. Right? It shows me the current price. Or is there a problem with it later?

It is not the Bid for the "open order", but the Bid for the chart on which the EA is running.

How do you think the current price is different from the "real" price?

You can use MarketInfo() to retrieve the current price for any symbol. It's either Ask or Bid.

 
artmedia70:

It's not the Bid for "open order", it's the Bid for the chart the EA is running on.

And how do you think the current price is different from the "real" price ?

I got you confused, sorry, I just didn't mean it that way.

You can use MarketInfo() to retrieve the current price for any symbol. What is Ask, what is Bid?

Thanks, I'll see when I'm older ))

 
r772ra:


Thanks - I'll keep chewing on the code
 

Hi guys, I haven't been here for a long time (1.5 years) please refresh my memory a bit.

The thing is that with EAs the orders were placed with t/p and s/l, now I want to do without them, just under some conditions close the necessary

orders.

here is the code


int clos(int mn)
{ int k=OrdersTotal();
for(int a=0;a<=k;a++)
{ if(OrderSelect(a,SELECT_BY_POS,MODE_TRADES))
{ if(OrderMagicNumber()==mn)
{ if(OrderType()==OP_BUY || OrderType()==OP_SELL)


int n=OrderTicket();

double l=OrderLots();

OrderClose(n,l,Ask,5,0);

}}}

return(0);

}


I don't close any order, I passed all of them, what's wrong?

Reason: