[ARCHIVE] Any rookie question, so as not to clutter up the forum. Professionals, don't pass by. Nowhere without you - 3. - page 177
You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
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])
Thank you. Your information is interesting but difficult for me so far.
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
It is better to determine the bar number or the highest value.
Both. Thank you for your reply!
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.
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?