Open Trade in Different Symbol - page 2

 
Pantelis Papaisidorou:

I assumed so too.. But I don't know what correctly means.

I send the same code for the same symbol, it opens trade. Same code for different symbol, not working. So code is technically right, not improperly coded.

The EA I mentioned definitely found a work around it. That doesn't make my standard method wrong rather than the way it worked a great work around. 


So do you have any idea what this code might be?

Correctly means that the code will do what is intended. Your code doesn't, so it is improperly coded.

There is no great work around, there is just correct coding.

You have been given the answers by both myself and William. Admittedly, those answers will require that you think, but that is the only way that you will improve your coding ability.

 
Keith Watford:

Yes, take note of what you have been told and don't just dismiss it!

You don't think that it is broken, but it most definitely is.

Think about what values are being used when you have the EA on a EURUSD chart and you want to open a trade with EURJPY.

The clues were the highlights in my earlier post.

The clues are not the problem unfortunately. I run it in 25 different combinations. It's not like TP and SL values are faulty in some cases. Call this way bad to open trades all you want... It works and in this case as well... The problem here is MQL4 not letting me open trades in different pairs from the one that the EA runs.

 
Pantelis Papaisidorou:

The clues are not the problem unfortunately. I run it in 25 different combinations. It's not like TP and SL values are faulty in some cases. Call this way bad to open trades all you want... It works and in this case as well... The problem here is MQL4 not letting me open trades in different pairs from the one that the EA runs.

The problem is not that MQL4 will not allow you to open trades with a different symbol. The problem is that you have not correctly coded it to open trades with a different symbol.

You post in the forum to ask for help and then completely ignore the replies and insist that there is nothing wrong with your code and that it works well. It doesn't work well because it doesn't do what you want it to do.

Please read the replies carefully and correct your code.

Keith Watford:

Please give as much information as possible when you encounter problems.
Your EA should be giving an error report.

In this case most likely "Invalid price".

 TicketA = OrderSend(SymbolA,OP_SELL,LotSize,Bid,Slippage,Bid+StopLoss*Point,Bid-TakeProfit*Point,EAComment,OrderTicket(),0,clrDarkRed);

Why are you trying to open trades with one symbol using the Bid/Ask and point value of the chart symbol??


Keith Watford:

Think about what values are being used when you have the EA on a EURUSD chart and you want to open a trade with EURJPY.

The clues were the highlights in my earlier post.

William Roeder:
I recommend: Do not trade multiple currencies in one EA.
  1. You can't use any {MT4: predefined variables, MT5: predefined variables,}
Predefined Variables - MQL4 Reference
Predefined Variables - MQL4 Reference
  • docs.mql4.com
For each executable mql4-program a set of predefined variables is supported, which reflect the state of the current price chart by the moment a mql4-program (Expert Advisor, script or custom indicator) is started. Values of predefined variables are set by the...
Reason: