void CheckForMaTrade()
{
double UpArrow = ObjectFind(0,"Up Arrow");
double DownArrow = ObjectFind(0,"Down Arrow");
double currentbar = iOpen(NULL,0,0);
double previoustbar = iClose(NULL,0,1);
if (OrdersTotal()== 0){
if (previoustbar+DownArrow && currentbar==UpArrow+DownArrow){
OrderSend(Symbol(),OP_BUY,LotSize,Ask,3,(Ask - (StopLoss * pips)),(Ask +(TakeProfit * pips)),NULL,MagicNumber,0,clrGreen);
}
if (previoustbar+UpArrow && currentbar==UpArrow+DownArrow){
OrderSend(Symbol(),OP_SELL,LotSize,Bid,3,(Bid + (StopLoss * pips)),(Bid -(TakeProfit * pips)),NULL,MagicNumber,0,clrBlue);
}
}
}
- Somebody please help, my EA doesn't open multiple orders at once
- help me please [solved]
- An advisor that would follow the rate on a five-minute chart with conditions after launch:
- When you post code please use the CODE button (Alt-S)!
(For large amounts of code,
attach it.)
Please edit
your post.
General rules and best pratices of the Forum. - General - MQL5 programming forum if (OrdersTotal()== 0){
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 forumif (previoustbar+DownArrow
False is zero, non-zero is true. When will that ever be false?&& currentbar==UpArrow+DownArrow){
Doubles are rarely equal.
The == operand. - MQL4 and MetaTrader 4 - MQL4 programming forumOrderSend(Symbol(),OP_BUY,LotSize,Ask,3,(Ask - (StopLoss * pips)),(Ask +(TakeProfit * pips)),NULL,MagicNumber,0,clrGreen);
Check your return codes for errors, report them and you would know why.
What are Function return values ? How do I use them ? - MQL4 and MetaTrader 4 - MQL4 programming forum
Common Errors in MQL4 Programs and How to Avoid Them - MQL4 Articles
Only those functions that return a value (e.g. iClose, MarketInfo, etc.) must you call ResetLastError before in order to check after.
You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register