function not defined error

Back to topics list To post a new topic, please log in or register
avatar
12
king_david599 2016.06.26 02:07
 
I must admit I copied and pasted it!
Attached files:
  bbfandvmacd.txt  (8.30 KB)
avatar
2017
gooly 2016.06.26 09:19 #
 

What is your problem?

I am sorry but my crystal ball has got a crack. :(

avatar
12995
WHRoeder 2016.06.26 14:44 #
 
  1. The compiler told you what and where. There are no mind readers here.
  2. 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.
  3.      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
  4. If ticket1 fails, you loose GetLastError() by calling ticket2.
  5. GetLastError is a function not a variable. Either GetLastError() or _LastError.
avatar
12
king_david599 2016.06.26 21:42 #
 
WHRoeder:
  1. The compiler told you what and where. There are no mind readers here.
  2. 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.
  3. 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
  4. If ticket1 fails, you loose GetLastError() by calling ticket2.
  5. GetLastError is a function not a variable. Either GetLastError() or _LastError.
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

avatar
2017
gooly 2016.06.26 22:49 #
 
king_david599:
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.


avatar
1211
FMIC 2016.06.26 23:40 #
 
gooly:

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.

avatar
12
king_david599 2016.06.27 00:04 #
 
FMIC:

@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.

@FMIC, my compiler only shoed me 4 errors, the errors I posted earlier on! Can you please give me pointers as to solve a few errors for me! I'll be grateful

avatar
12995
WHRoeder 2016.06.28 14:04 #
 
  1. The file you provided results in 37 errors and 4 warnings like FMIC said.
  2. 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
  3. 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
      }
    
  4. See https://docs.mql4.com/basis/function/parameterpass and note the difference between the FirstMethod definition vs the FirstMethod call in OnStart.
Back to topics list  

To add comments, please log in or register