[MQL4] How to submit a trade based on a price change in another chart?

 

Guys I am new to MQL4 and I need help with the following, please:

1. Say an order has been opened in the USDCHF chart, I would like to be able to close it and take profit when a price change occurs, for example, in the GBPUSD chart and place an order there. How do I take profit: Do I use OrderModify or do I adjust the take profit for the order? 

2. The code for my bot will be in the OnTick() function of the USDCHF chart. How do I actually send an order in the GBPUSD chart.

3. How do I make sure that (or check if) the market in the GBPUSD is not closed.


Thanks in advance...

 
  1. Why did you post your MT4 question in the Root / MT5 EA section instead of the MQL4 section, (bottom of the Root page?)
              General rules and best pratices of the Forum. - General - MQL5 programming forum
    Next time post in the correct place. The moderators will likely move this thread there soon.

  2. If you want to close the order, close it, don't modify it. Why do you want to when something on another chart changes?
  3. Do not trade multiple currencies in one EA.

  4. Using OrdersTotal directly and/or no Magic number filtering on your OrderSelect loop means your code is incompatible with every EA (including itself on other charts and manual trading.)
              Symbol Doesn't equal Ordersymbol when another currency is added to another seperate chart . - MQL4 and MetaTrader 4 - MQL4 programming forum

 

Thank you whroeder1 for the response.


1. Indeed I will make sure to use the correct platform in future...

2. Regarding closing of order with OrderClose: Does OrderClose take into account the position of the order? That is, will OrderClose add the profit of the closed order to the account total or will it just cancel the order?  If that is not the case, how to add the current profit of the order to the account total when closing the order?

3. I want to close the order in the current chart because, according to my bot, the price in the other chart is performing better than the price in the current chart. I will use the same currency for all the trades in the EA by performing some currency conversions if the other chart is in a different currency. 

4. I don't have knowledge of polling, please elaborate...

5. As for the rest of your comments, I will have a look at the accompanying links and try to incorporate that info into our discussion.

 

Regards!

What do you know about a coin called TRADER? They told me not to lose the opportunity to invest in it, in terms of security it is highly recommended and it is also free of taxes; this while the TRADERS do not convert it to Fiat currency, exemption from the profit tax for stock or speculative operations, and dividends. It only has 200 Million coins to mine, insurance for half of the other year and this amount will be exhausted.

Forecast and levels for Dax Index
Forecast and levels for Dax Index
  • 2017.09.18
  • www.mql5.com
Dax Index January-March 2017 Forecast: flat within bullish with key resistance at 11,649 W1 price is located above Ichimoku cloud in the bullish ar...
Reason: