problem with array (two-dimensional)
Hi,
I've an array with 6 coloumns and 50 rows.
The coloumns include:
trade_arr[x][0]=OrderTicket();
trade_arr[x][1]=OrderStopLoss();
trade_arr[x][2]=OrderTakeProfit();
trade_arr[x][3]=OrderSymbol();
trade_arr[x][4]=OrderOpenPrice();
Now I wanna do this:
If EA starts,all available trades should be written to the Array. Every tick is checked if there are new available trades. They should be added to the array, if yes.
Problem: The EA does not work. The alert new commerce comes at each tick
for each open position.
I described string trade_arr[50][6]; as global variable,but it seems that the array is deleted after each tick.
Could be nice if There's somebody out there to check that...
Thanks,
Swen
Code:
Quote:
Originally Posted by ;
string trade_arr[50][6];
// ------------------------------------------------------------------
//| expert initialization function |
// ------------------------------------------------------------------
int init()
//--
//--
return(0);
// ------------------------------------------------------------------
//| expert start work |
// ------------------------------------------------------------------
int start()
int trade_nr;
int total=OrdersTotal();
bool trade_exist=false;
for(int pos=0;poslt;total;pos )
if(OrderSelect(pos,SELECT_BY_POS)==true)
int trade_ticket=OrderTicket();
for(int c=0 ; clt;= 49;c )
int trade_arr_int=StrToInteger(trade_arr[c][0]);
if (trade_ticket==trade_arr_int)
Alert(Trade exist);
trade_exist=true;
if (trade_arr[c][0]==0)
int next_nr=c;
Alert(next c ),next_nr);
if (trade_exist==false)
Alert(New transaction);
trade_arr[next_nr][0]=OrderTicket();
trade_arr[next_nr][1]=OrderStopLoss();
trade_arr[next_nr][2]=OrderTakeProfit();
trade_arr[next_nr][3]=OrderSymbol();
trade_arr[next_nr][4]=OrderOpenPrice();
trade_exist=false;
return(0);
// ------------------------------------------------------------------