I am new. Please help.

 

Hi...

I am very new in this area. I just tried writing small programs. But I can not change the current instrument (currency pair). It always set to the last used if I use symbol().

Example:

OrderSend(Symbol(),OP_BUYLIMIT,Lots,Ask-10*Point,3,Bid-StopLoss_Buy*Point,Ask+TakeProfit_Buy*Point,"Order coba2",16384,0,CLR_NONE);

Let say the current symbol is "EURUSD".

If I change Symbol() with variable Instrument="GBPUSD", but all other variables (Ask, Point, Bid, etc) are still containing EURUSD's information.

OrderSend(Instrument,OP_BUYLIMIT,Lots,Ask-10*Point,3,Bid-StopLoss_Buy*Point,Ask+TakeProfit_Buy*Point,"Order coba2",16384,0,CLR_NONE);

Please tell me how to switch all variables to GBPUSD.

Thanks.

 
Please check function MarketInfo(), you can get all other variables by this function.
 
brother3th wrote >>
Please check function MarketInfo(), you can get all other variables by this function.

Thanks. So you mean there is no other way to change the symbol() to other instrument other than the last used?

 

HK

As the Brother said - work the MarketInfo function

double gbp_bid   = MarketInfo("GBPUSD",MODE_BID);
double gbp_ask   = MarketInfo("GBPUSD",MODE_ASK);

You are not changing the Symbol() - that is fixed based on the chart the EA is on

You can order any pair, any time if you read the necessary by MarketInfo

Good Luck

-BB-

 
BarrowBoy wrote >>

HK

As the Brother said - work the MarketInfo function

You are not changing the Symbol() - that is fixed based on the chart the EA is on

You can order any pair, any time if you read the necessary by MarketInfo

Good Luck

-BB-

Thanks BB. Now I got it. It only works with charts. So any pairs we are going to order, then we only needs to activate the desired instrument's chart. Right.