OrderClose what im doing wrong? Beginner

 
      {
      double A;
      bool res,resC;
      if(OrdersTotal()>0)
      res=OrderSelect(SELECT_BY_POS,MODE_TRADES);
      A=OrderOpenTime();
      int B=iHighest(NULL,0,MODE_HIGH,3,A);
      if(B)
      if(OP_SELL)
      resC=OrderClose(NULL,0.01,Ask,3,clrRed);
      }

Hi there!

I'm trying to get the highest 3  from the Opening, i'm guessing i'm totaly of track here?

Thanks for any help. 

 
pieronetto: i'm guessing i'm totaly of totally off track here?
res=OrderSelect(SELECT_BY_POS,MODE_TRADES);

double A=OrderOpenTime();

int B=iHighest(NULL,0,MODE_HIGH,3,A);

if(B)

resC=OrderClose(NULL,0.01,Ask,3,clrRed);
  1. Read the documentation. How many arguments does OrderSelect() take?
  2. Read the documentation! What datatype does OrderOpenTime() return?
  3. READ THE DOCUMENTATION! What is the last argument of iHighest()? Is it a datetime?
  4. R E A D   T H E   D O C U M E N T A T I O N ! What does iHighest() return? Is it a int?
  5. What does if(int) mean? learn to code
  6. R E A D  T H E   F ' i n g   D O C U M E N T A T I O N ! What is the first argument of OrderClose()?
  7. Check your return codes (OrderSelect) 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
 
int start()
{
      int val;
      double A,B,index,select,pool;
      bool res;
      index=0;
      select=SELECT_BY_POS;
      pool=MODE_TRADES;
      res=OrderSelect(index,select,pool);
      A=OrderOpenPrice();
      B=OrderOpenTime();
      val=iHighest(NULL,0,MODE_HIGH,6,0);
      
      Comment("Open Time  ",B,"\n",
              "Highest    ",val,"\n",
              "Open Price ",A);
return(0);
}

Hi again! 

Thanks WHroeder for you response, i guess you had a good laugh about it, that's ok, still learning.

I been reading and playing a bit with the code and that what i have for now to learn how it works.

Question is? How do i call back to the opening candle, (NULL,0,MODE_HIGH,6,0), last 0 is allways current candle.

Thanks and have fun with my stupidity. Joking lol

 
int start()
{
      int val;
      double A,B,index,select,pool;
      bool res;
      select=SELECT_BY_POS;
      pool=MODE_TRADES;
      res=OrderSelect(index,select,pool);
      A=OrderOpenPrice();
      B=OrderOpenTime();
      val=iHighest(NULL,0,MODE_HIGH,6,0);
      
      Comment("Open Time  ",B,"\n",
              "Highest    ",val,"\n",
              "Open Price ",A);
return(0);
}
there was an index=0 in there does not belong there
 
pieronetto: How do i call back to the opening candle, (NULL,0,MODE_HIGH,6,0), last 0 is allways current candle.
  1. Read the documentation - learn to code and Alphabetic Index of MQL4 Functions (600+) - MQL4 forum
  2. iBarShift - MQL4 Documentation
Reason: