# OrderClose what im doing wrong? Beginner

193

```      {
double A;
bool res,resC;
if(OrdersTotal()>0)
A=OrderOpenTime();
int B=iHighest(NULL,0,MODE_HIGH,3,A);
if(B)
if(OP_SELL)
}```

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.

15589

 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);``` Read the documentation. How many arguments does OrderSelect() take?Read the documentation! What datatype does OrderOpenTime() return?READ THE DOCUMENTATION! What is the last argument of iHighest()? Is it a datetime?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?What does if(int) mean? learn to codeR 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()?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
193

```int start()
{
int val;
double A,B,index,select,pool;
bool res;
index=0;
select=SELECT_BY_POS;
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

193

```int start()
{
int val;
double A,B,index,select,pool;
bool res;
select=SELECT_BY_POS;
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
15589

 pieronetto: How do i call back to the opening candle, (NULL,0,MODE_HIGH,6,0), last 0 is allways current candle. Read the documentation - learn to code and Alphabetic Index of MQL4 Functions (600+) - MQL4 forumiBarShift - MQL4 Documentation