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".
Why are you trying to open trades with one symbol using the Bid/Ask and point value of the chart symbol??
TicketA = OrderSend(SymbolA,OP_SELL,LotSize,Bid,Slippage,Bid+StopLoss*Point,Bid-TakeProfit*Point,EAComment,OrderTicket(),0,clrDarkRed);
Ι will. Thanks for the info and sorry. Editing the original post to add error.
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??
It's really how I learnt it. I am a big fan of "don't fix what's not broken" so... Invalid price is not the case. The error is different and with 10000 points in both, TP and SL.... It is surely not [Invalid S/L or T/P]. As with the same TP/SL, it opens the symbol it runs to.
Any solution to this?
It's really how I learnt it. I am a big fan of "don't fix what's not broken" so... Invalid price is not the case. The error is different and with 10000 points in both, TP and SL.... It is surely not [Invalid S/L or T/P]. As with the same TP/SL, it opens the symbol it runs to.
Any solution to this?
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.
TicketA = OrderSend(SymbolA,OP_SELL,LotSize,Bid,Slippage,Bid+StopLoss*Point,Bid-TakeProfit*Point,EAComment,OrderTicket(),0,clrDarkRed);
The clues were the highlights in my earlier post.
- You can't use any {MT4: predefined variables, MT5: predefined variables,}
- Must poll (not OnTick, unless you use specific indicators)
The Implementation of a Multi-currency Mode in MetaTrader 5 - MQL5 Articles 18 February 2011 - and usually other problems, e.g. A problem with iBarShift - MQL4 programming forum - Page 2
- You must handle History {MT4:4066/4073 errors: Download history in MQL4 EA - MQL4 programming forum, MT5: Timeseries and Indicators Access / Data Access - Reference on algorithmic/automated trading language for MetaTrader 5.}
- Code it to trade the chart pair only. Look at the others if you must. Don't assume that Time[i] == iTime(otherPair, TF, i) always use iBarShift.
- Then put it on other charts to trade the other pairs. Done.
I recommend: Do not trade multiple currencies in one EA.
- You can't use any {MT4: predefined variables, MT5: predefined variables,}
- Must poll (not OnTick, unless you use specific indicators)
The Implementation of a Multi-currency Mode in MetaTrader 5 - MQL5 Articles 18 February 2011 - and usually other problems, e.g. A problem with iBarShift - MQL4 programming forum - Page 2
- You must handle History {MT4:4066/4073 errors: Download history in MQL4 EA - MQL4 programming forum, MT5: Timeseries and Indicators Access / Data Access - Reference on algorithmic/automated trading language for MetaTrader 5.}
- Code it to trade the chart pair only. Look at the others if you must. Don't assume that Time[i] == iTime(otherPair, TF, i) always use iBarShift.
- Then put it on other charts to trade the other pairs. Done.
So basically you do not have a solution... You have a suggestion no to do so... That is not really helping.
Also <name removed> ... is actually doing that (opening in multiple pairs) and it runs on MT4... So... somehow it is possible.
Of course it is possible, but only if it is coded correctly.
Of course it is possible, but only if it is coded correctly.
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?
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Hello guys...
So I want to open trades depending on multiple criteria with my EA... Doesn't really matter TBH...
The problem is that EAs run in one window. So naturally, I'd like for an EA to open assess conditions and open all the trades within one chart. Everything's fine except...
Broker won't allow an EA that runs in a chart open a trade on a different one.... It is surely that. I eliminated any other case.
Inputs:
input double LotSize = 0.01;
input int Slippage = 10;
input double StopLoss = 1000.0;
input double TakeProfit = 1000.0;
input const string SymbolA = "EURUSD";
input const string SymbolB = "GBPUSD";
The commands I use (I have them copy-pasted from another EA that works just fine so I am certain they work as well, plus I used extreme TP/SL to surpass any restrictions that brokers might have) :
TicketA = OrderSend(SymbolA,OP_SELL,LotSize,Bid,Slippage,Bid+StopLoss*Point,Bid-TakeProfit*Point,EAComment,OrderTicket(),0,clrDarkRed);
Sleep(1000);
TicketB = OrderSend(SymbolB,OP_BUY,LotSize,Ask,Slippage,Ask-StopLoss*Point,Ask+TakeProfit*Point,EAComment,OrderTicket(),0,clrDarkBlue);
Error (EURUSD one opens normal as the EA runs in the EURUSD chart):
2020.12.18 01:01:45.318 '22644076': order buy market 0.01 GBPUSD sl: 1.21670 tp: 1.23670
2020.12.18 01:01:45.528 '22644076': order buy 0.01 GBPUSD opening at market sl: 1.21670 tp: 1.23670 failed [Invalid S/L or T/P]
Any suggestion how can I fix/bypass this?
Thanks in advance!