how can i resolve this question ?

 

I want to get the GBPUSD's ASK and BID in my EA excuting in usdcad

I learn to program as follows :

TotalOrder = HistoryTotal( ) ;
for ( i = 0 ; i < TotalOrder ; i ++ )
{
if ( ! OrderSelect ( i , SELECT_BY_POS , MODE_HISTORY) ) { Print ( " ----OrderSelect failed ") ; break ; }
if ( TypeSymbol != OrderSymbol () ) continue ; // here TypeSymbol = GBPUSD
}

for ( i = TimeTry ; i > 0 ; i -- )
{
tickets = OrderSend ( TypeSymbol , OP_BUY , 0.1 , Ask , 3 , Ask - StopLoss * _Point ,
Ask + Profit * _Point , "Strategy First. .. " , MagicNumber , 0 , Blue ) ;
if ( tickets < 0 )
{
int error ;
error = GetLastError ( ) ;
Alert ( "Trading comes to error " , error , ". .." ) ;
}
else break ;
}

But the result is that Ask is equal to USDCAD's Ask ;

So , first how can i get another symbol 's parameters in usdcad or something else ?

Second I think that all parameters is GBPUSD'S after I selected GBPUSD by OrderSelect() , what's wrong with my idea

Last , please forgive my poor english .

 

use MarketInfo(...)

double bid =MarketInfo("EURUSD",MODE_BID);
double ask =MarketInfo("EURUSD",MODE_ASK);

 

Ok , I have tried .

it can get ask successfully , but its SendOrder failed .

I think Asynchronous may be the reason for it .

so what can I do to Send an GBPUSD 's Order when my EA excuting in the enviroment of USDCAD ?

thank you very much .

 

SendOrder failed .?

error code or log in log window?

 

en , now I used the method to send an Order of buylimit or selllimit .

But a new problem has appeared :

I try to open a file from the enviroment of VC to write some imformation , and open the file to Read this information in my EA's enviroment .

My codes is as follows :

In VC enviroment :

do{
file = ::CreateFile (
"D:\\ODL MetaTrader 4\\ODL MetaTrader 4\\experts\\files\\qfl\\TradingCode. txt" ,
// pointer to name of the file
GENERIC_READ | GENERIC_WRITE , // access (read-write) mode

FILE_SHARE_READ , // share mode
NULL , // pointer to security attributes
OPEN_EXISTING , // how to create
FILE_ATTRIBUTE_NORMAL , // file attributes
NULL // handle to file with attributes to copy
);
pCAaDlg->MessageBox("Open file TradingCode.txt ...") ;
}while (file == INVALID_HANDLE_VALUE) ;
pCAaDlg->MessageBox("Finish TradingCode.txt ...") ;

In EA's enviroment :

int handle = FileOpen ( file_str , FILE_BIN | FILE_READ | FILE_WRITE ) ;

But I found that I can't open this file or I will die in the do-while loop in sometimes .

please forgive my poor english .

 

you can use VC, I think you can debug them,

so first try openate file not at same time in two enviroment,

if all OK, next try share file operating.

Reason: