How to modify USDJPY orders from EURUSD chart?

 
if (OrderSymbol()=="USDJPY_" && OrderType()==OP_SELL && OrderProfit() < (OrderCommission()+OrderSwap()))
OrderModify(OrderTicket(),OrderOpenPrice(),Ask,0,0,clrNONE);

if (OrderSymbol()=="USDJPY_" && OrderType()==OP_BUY && OrderProfit() < (OrderCommission()+OrderSwap()))
OrderModify(OrderTicket(),OrderOpenPrice(),Bid,0,0,clrNONE);

Trying to run this from the EURUSD chart and it will not close the other currency pairs.

I can open an USDJPY order from EURUSD chart with

OrderSend("USDJPY_", OP_SELL,.01,Bid,0,0,0,NULL ,0,0,clrNONE);
Yet I can't close an USDJPY order from EURUSD chart. Tried Magic Numbers, did not work either.


How do you modify/close/put a stop loss on another currency pair from a different currency pair's chart?


Don't want to open 2 charts for something that can be done from 1. Can't find on the net.

Thanks in advanced.

 

Something else. For the OrderModify function. it sais online that:

bool  OrderModify(
   int        ticket,      // ticket
   double     price,       // price
   double     stoploss,    // stop loss
   double     takeprofit,  // take profit
   datetime   expiration,  // expiration
   color      arrow_color  // color
   );

Further down in the explanation, it sais that:

"

price

[in]  New open price of the pending order.

"

What do you do with the "price " and other values if you just want to leave them the same/ if you are not dealing with a pending order and would just like to leave the current price there? I'm trying to put a trailing stop so I just want to modify the StopLoss to current Ask if its a Sell.

Thanks a ton.

 

Pre defined variables like Bid and Ask only relate to the current chart (EURUSD). You can't use them if you're trading a different symbol (USDJPY).

Price won't have any effect when modifying a market order. Pass 0 or OrderOpenPrice().

The process is:

Select the order

Send OrderModify()

There is an example in the documentation for OrderModify

 
honest_knave:

Pre defined variables like Bid and Ask only relate to the current chart (EURUSD). You can't use them if you're trading a different symbol (USDJPY).

Price won't have any effect when modifying a market order. Pass 0 or OrderOpenPrice().

The process is:

Select the order

Send OrderModify()

There is an example in the documentation for OrderModify

Thanks for pointing that it also works like this inside the actual parameters.

Great progress


How do you have it collect the "current selected order's bid"  price when its not the the same chart and _Symbol wont do? Just throw marketinfo in there and a different one for every currency pair seems redundant if I can just have it extract last selected order's current bid.

 
nadiawicket:

Thanks  a lot.


How do you have it collect the "current selected order's bid"  price when its not the the same chart and _Symbol wont do? Just throw marketinfo in there and a different one for every currency pair seems redundant if I can just have it extract last selected order's current bid.


Yes, you need to retrieve the current Bid or Ask using MarketInfo (old style) or SymbolInfoDouble (new style)

MarketInfo("USDJPY",MODE_BID);

or

SymbolInfoDouble("USDJPY",SYMBOL_BID);
 
OK this will do, thanks a lot
Reason: