Download MetaTrader 5
To add comments, please log in or register
Are you accustomed to using the standard library? MQL5 has one!
APeng
359
APeng 2014.12.09 12:27 
Hello !

string time = "2014.11.10 22:10"; 
iBarShift(Symbol(),Period(),StrToTime(time),true)

does not find the bar. But I can see the bar on the chart. The bar before the searched one ("2014.11.10 22:09") and the bar after it ("2014.11.10 22:11") is found without any problems. 

And

TimeToStr(iTime(Symbol(),Period(),29545)

is 0.

As the bar is clearly visble on the chart I wonder what I am doing wrong.

Thank you very much for any hints!

Carl Schreiber
5957
Carl Schreiber 2014.12.09 12:30  

1) To convert a string-date you can use:

datetime tme = D'2014.11.10 22:10'; 

2) On a 15 min chart you don't get 22:10 precisely - remove the true?

APeng
359
APeng 2014.12.09 12:46  
gooly:

1) To convert a string-date you can use:

2) On a 15 min chart you don't get 22:10 precisely - remove the true?

Thanks for the quickk answer. I am using a M1 Chart. What I forgot to post is that the script that cointains the code is attached on a chart created by visual backterster (date range is from 2014/01/01 until 2014/11/30 what is not available on the chart from my broker. At least not on M1 timefrmae). I think that is the problem because dropping the script on the visual backtester chart leads the script to run on the data of my broker.

whroeder1
13640
whroeder1 2014.12.09 13:05  
APeng: does not find the bar. But I can see the bar on the chart. The bar before the searched one ("2014.11.10 22:09") and the bar after it ("2014.11.10 22:11") is found without any problems.

As the bar is clearly visble on the chart I wonder what I am doing wrong.

  1. If there was no tick that minute there is no bar. See "Free-of-Holes" Charts - MQL4 Articles
  2. I doubt you.
APeng
359
APeng 2014.12.09 13:41  
WHRoeder:
APeng: does not find the bar. But I can see the bar on the chart. The bar before the searched one ("2014.11.10 22:09") and the bar after it ("2014.11.10 22:11") is found without any problems.

As the bar is clearly visble on the chart I wonder what I am doing wrong.

  1. If there was no tick that minute there is no bar. See "Free-of-Holes" Charts - MQL4 Articles
  2. I doubt you.

WHRoeder you doubt me???

You truly can believe me, I did see it with my own eyes!


Here is the evidence:

rofl...

(check out my second post, the failure was about the visual backtesitng chart)

whroeder1
13640
whroeder1 2014.12.10 13:50  
APeng: Here is the evidence:
You image shows nothing! Unknown chart from unknown broker. No time of the bar before, bar indicated, bar after.
Open market watch, enlarge the bars to max so there's no question which one the cursor is on, capture 3 images, then maybe you have some evidence. Rofl also.
/
To add comments, please log in or register