[ARCHIVE] Any rookie question, so as not to clutter up the forum. Professionals, don't pass by. Nowhere without you - 3. - page 177

 

Question1 - In the search and order check function, write

if(TimeCurrent()-OrderOpenTime()>18*3600)OrderClose(...);

Question 2 - this is how you wrote the code

if(Close[0]>Close[1]&&Close[0]>Close[2]&&Close[1]>Close[2])

 
Roll:
2. double ObjectGetValueByShift( string name, int shift)
Thank you. Just perfect what I wanted.
artmedia70:

Thank you. Your information is interesting but difficult for me so far.
 
NaVolne:


Here's how to set this time condition, eh???


Go through the open orders, if the difference between OpenOrderTime and the current one is more than 18 hours (60*60*18 seconds) close it.

https://docs.mql4.com/ru/trading/OrderOpenTime

https://docs.mql4.com/ru/dateandtime/TimeCurrent

 
Thank you very much for your prompt replies. I will give it a try now.
 
DhP:

Thanks for the finished code!
 
splxgf:

It is better to determine the bar number or the highest value.


Both. Thank you for your reply!
 
Roll:

MetaEditor --> MQL4 Reference --> Access to timeseries --> iHighest:

Example: double val;
//calculation of maximal price value on 20 consecutive bars
// from index 4 to index 23 inclusive on the current chart
val=High[iHighest(NULL,0,MODE_HIGH,20,4)];

Thank you, that's it. I don't really understand why index 4 to index 23 inclusive on the current chart, when the calculation is for 20 bars.

Now all that's left is to find out which bar is REALLY at that price.

 
How much traffic per day does MT4 consume? And does it affect the number of instruments included (currency pairs, CFDs)?
 
001:

Thank you, that's just what I needed. But I don't really understand why index 4 to index 23 on the current chart, when the calculation is for 20 bars.

Now all that's left is to find which bar with that price.

Well there is a link to the description in the documentation, all you have to do is click on the link and read it. Starting with 4 bars at 23 bars.... is to go through 20 bars, which is what is stated in the parameters. You have to search through 20 bars starting from the fourth bar. With the given line of code you can get both bar number and price.

Price: val=High[iHighest(NULL,0,MODE_HIGH,20,4)];

Bar number: val=iHighest(NULL,0,MODE_HIGH,20,4);

 

How can I make an indicator (no matter which one) draw its lines only during the last N candles (N - indicator parameter), and everything before that - just erase from the chart?