amando:
Hello,
i want to make a script which give me few data from the Hour chart back
the problem is, i always get an error
the high value i get the right data back
For he low value i get the wrong candle index. if i decrease the count to as example 10, i get an error back
I apologize for taking this too long for you to get the answer, that's because I don't understand what exactly you trying to do here - or maybe I'm too lazy to try to understand it ;D
So I create small script to find the highest bar since the market is open
Pay attention to ArrayMaximum (and ArrayMinimum), it will treat the array as standard conventional array even if we using timeseries array.
Below is the code, hope this help.
//+------------------------------------------------------------------+ //| find the highest bar since market is open.mq5 | //| Copyright 26 Jan 2013, phi.nuts | //| https://www.mql5.com/en/forum/10193#comment_414969 | //+------------------------------------------------------------------+ #property copyright "Copyright 26 Jan 2013, phi.nuts " #property link "https://www.mql5.com/en/forum/10193#comment_414969" #property version "1.00" //+------------------------------------------------------------------+ void OnStart() { // the highest bar since market open double high_price []; datetime time_period_d1 []; int highest_bar, copied_high; //--- what time market is open if (CopyTime (_Symbol, PERIOD_D1, 0, 1, time_period_d1) > 0) //--- when the market open { Print("1. market open at ", TimeToString (time_period_d1[0],TIME_DATE|TIME_SECONDS)); copied_high = CopyHigh(_Symbol, _Period, TimeCurrent(), time_period_d1[0], high_price);//--- copying high price if (copied_high > 0) { Print ("2. number of data of high price is ", copied_high); highest_bar = ArrayMaximum(high_price, 0, WHOLE_ARRAY); //--- find the highest if (highest_bar != -1) { Print("3. the highest price is ",high_price [highest_bar] ," at bar ",copied_high - highest_bar - 1); } } } return; } //+------------------------------------------------------------------+

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
Hello,
i want to make a script which give me few data from the Hour chart back
the problem is, i always get an error