Why the Warning, empty controlled statement found? - page 2

 
milad najjari: anyone can help me why i have warning "empty controlled statement found" ?
   Button(0,"Button",0,50,150,200,250);
    if(ObjectGetInteger(0,"Button",OBJPROP_STATE,true));

What part of

honest_knave: Lose the ; at the end of it.

was unclear?

 
whroeder1:

What part of

was unclear?

sorry i forget it , your right ......thanks.
 

Can anyone help me with this. I am a newbie.  Getting  Return value of 'OrderSend' should be checked.  And the order will not load in MT4.

//+------------------------------------------------------------------+

//|                                                           NewTest.mq4 |
//|                                                       FxChampion.net |
//|                                   https://www.FxChampion.net |
//+------------------------------------------------------------------+
#property copyright "FxChampion"
#property link      "https://www.FxChampion.net"
#property version   "1.00"
#property strict

#include <IncludeData.mqh>
//+------------------------------------------------------------------+
//| Script program start function                                    |
//+------------------------------------------------------------------+
void OnStart()
  {
//---
    
    {
          OrderSend(NULL,OP_BUYLIMIT,0.01,Ask,10,1.11815,1.12153);
    }
  }
//+------------------------------------------------------------------+

 
Jr Morales #: Getting  Return value of 'OrderSend' should be checked.  And the order will not load in MT4.
  1. Don't Hijack other threads for your off-topic post. Next time, make your own, new, thread.

  2. Please edit your (original) post and use the CODE button (Alt-S)! (For large amounts of code, attach it.)
              General rules and best pratices of the Forum. - General - MQL5 programming forum (2019)
              Messages Editor

  3.          OrderSend(NULL,OP_BUYLIMIT,0.01,Ask,10,1.11815,1.12153); 

    Check your return codes, and report your errors (including market prices and your variables). Don't look at GLE/LE unless you have an error. Don't just silence the compiler (MT5/MT4+strict), it is trying to help you.
              What are Function return values ? How do I use them ? - MQL4 programming forum (2012)
              Common Errors in MQL4 Programs and How to Avoid Them - MQL4 Articles (2014)

  4. Be careful with NULL.

    1. On MT4, you can use NULL in place of _Symbol only in those calls that the documentation specially says you can. iHigh does, iCustom does, MarketInfo does not, OrderSend does not.
    2. Don't use NULL (except for pointers where you explicitly check for it.) Use _Symbol and _Period, that is minimalist as possible and more efficient.
    3. Zero is the same as PERIOD_CURRENT which means _Period. Don't hard code numbers.
    4. MT4: No need for a function call with iHigh(NULL,0,s) just use the predefined arrays, i.e. High[].
    5. Cloud Protector Bug? - MQL4 programming forum (2020.07.25)
Reason: