What is your problem?
I am sorry but my crystal ball has got a crack. :(
- The compiler told you what and where. There are no mind readers here.
- In MoveToBreakeven you filter by BUYSTOP/SELLSTOP. It makes no sense to have a zero SL. Once a pending order opens, however, it's type is BUY or SELL.
if(OrdersTotal()==0) { ticket1 = OrderSend(Symbol(),OP_BUYSTOP, LotSize, price, 3, stop, price+(TakeProfit*pips), NULL, MagicNumber, Blue); ticket2 = OrderSend(Symbol(),OP_SELLSTOP, LotSize, price, 3, stop, price1-(TakeProfit*pips), NULL, MagicNumber, Red); } if(ticket1<0 && ticket2<0) { print("Order sent FAILED with error: # ", GetLastError); }
Check your return codes (OrderModify) What are Function return values ? How do I use them ? - MQL4 forum and Common Errors in MQL4 Programs and How to Avoid Them - MQL4 Articles- If ticket1 fails, you loose GetLastError() by calling ticket2.
- GetLastError is a function not a variable. Either GetLastError() or _LastError.
- The compiler told you what and where. There are no mind readers here.
- In MoveToBreakeven you filter by BUYSTOP/SELLSTOP. It makes no sense to have a zero SL. Once a pending order opens, however, it's type is BUY or SELL.
- Check your return codes (OrderModify)What are Function return values ? How do I use them ? - MQL4 forum and Common Errors in MQL4 Programs and How to Avoid Them - MQL4 Articles
- If ticket1 fails, you loose GetLastError() by calling ticket2.
- GetLastError is a function not a variable. Either GetLastError() or _LastError.
1. MovToBreakeven line 63- function not defined.
2. AdjustTrail line 64- function not defined.
3. IsNewCandle line 66- function not defined.
4. OrderEntry line 91- function not defined.
5. OrderEntry line 93- function not defined.
I'm trying to open two positions at the same time, BUYSTOP & SELLSTOP when candle hits the top or lower band. These are the errors I'm getting, I was thinking because I opened a new EA cut out the template and pasted this current one I coded in it, maybe that's why I'm getting them errors
Sorry, yes the compiler said:
1. MovToBreakeven line 63- function not defined.
2. AdjustTrail line 64- function not defined.
3. IsNewCandle line 66- function not defined.
4. OrderEntry line 91- function not defined.
5. OrderEntry line 93- function not defined.
I'm trying to open two positions at the same time, BUYSTOP & SELLSTOP when candle hits the top or lower band. These are the errors I'm getting, I was thinking because I opened a new EA cut out the template and pasted this current one I coded in it, maybe that's why I'm getting them errors
Try this: move all the functions with their bodies right before OnInit() line 33.
Try this: move all the functions with their bodies right before OnInit() line 33.
@gooly: That is not the reason! The reason is because the whole thing is a jumble; with missing parenthesis, missing semicolons, missing variables, function declarations in place of function calls and several other problems.
@king_david599: The various problems reported by the compiler (total of 37 errors and 4 warnings), require an experienced coder to fix all of them. It is not just a one little thing. There are many syntax errors as well as logic problems. If you don't know how to fix the code, then you are going to have to hire someone to do it for you.
@gooly: That is not the reason! The reason is because the whole thing is a jumble; with missing parenthesis, missing semicolons, missing variables, function declarations in place of function calls and several other problems.
@king_david599: The various problems reported by the compiler (total of 37 errors and 4 warnings), require an experienced coder to fix all of them. It is not just a one little thing. There are many syntax errors as well as logic problems. If you don't know how to fix the code, then you are going to have to hire someone to do it for you.
- The file you provided results in 37 errors and 4 warnings like FMIC said.
- The first warning is
OrderModify(OrderTicket(),OrderOpenPrice(),OrderOpenPrice()+(PipsToLockIn*pips),OrderTakeProfit(),0,CLR_NONE); return value of 'OrderModify' should be checked c.mql4.com_bbfandvmacd.txt_bbfandvmacd.mq4 122 22
Check your return codes What are Function return values ? How do I use them ? - MQL4 forum and Common Errors in MQL4 Programs and How to Avoid Them - MQL4 Articles - The first error is
if(direction==0) { BuySellStop(double price, double stop, double price1) 'price' - unexpected token c.mql4.com_bbfandvmacd.txt_bbfandvmacd.mq4 183 24 ',' - unexpected token c.mql4.com_bbfandvmacd.txt_bbfandvmacd.mq4 183 29 'stop' - unexpected token c.mql4.com_bbfandvmacd.txt_bbfandvmacd.mq4 183 38 ',' - unexpected token c.mql4.com_bbfandvmacd.txt_bbfandvmacd.mq4 183 42 'price1' - unexpected token c.mql4.com_bbfandvmacd.txt_bbfandvmacd.mq4 183 51 ')' - unexpected token c.mql4.com_bbfandvmacd.txt_bbfandvmacd.mq4 183 57 ')' - semicolon expected c.mql4.com_bbfandvmacd.txt_bbfandvmacd.mq4 184 3 }
See https://docs.mql4.com/basis/function/parameterpass and note the difference between the FirstMethod definition vs the FirstMethod call in OnStart.

- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use