Did you look at the Documentation for iOpen() ? it is used by passing it 3 variables, a string for the symbol, an int for the timeframe and an int for the bar number . . .
You are passing an int which seems to be based on a date ? why ? if you think about this question you will probably find the answer to you issue . . . if you can't, ask again and I'll help some more.
Did you look at the Documentation for iOpen() ? it is used by passing it 3 variables, a string for the symbol, an int for the timeframe and an int for the bar number . . .
You are passing an int which seems to be based on a date ? why ? if you think about this question you will probably find the answer to you issue . . . if you can't, ask again and I'll help some more.
I checked passing DateTime into an int. I worked.
Or If you can please give a method to mention the time-of-the-day in a integer format. Say 01:20 as an integer.
Code Below worked in same manner but time mentioned are different.
int start() { bool k = ObjectCreate("label_object_1", OBJ_VLINE, 0, D'06:45', 0); bool j = ObjectCreate("label_object_2", OBJ_VLINE, 0, 15342.05556, 0); retuen(0); }
I checked passing DateTime into an int. I worked.
That isn't the problem . . . a datetime is basically a date, specified as the number of seconds since 1st Jan 1970 . . . . but a date is not a bar number, for iOpen you need a bar number.
Take a look at iBarshift()
That isn't the problem . . . a datetime is basically a date, specified as the number of seconds since 1st Jan 1970 . . . . but a date is not a bar number, for iOpen you need a bar number.
Take a look at iBarshift()
2012.03.13 17:32:12 Veri_Line Crude_Oil,M15: shift of bar with open time 2012.03.12 04:45 is 0
test_line is being drawn. But open time shift is 0(zero)
int start() { datetime some_time=D'2012.03.12 04:45'; bool k = ObjectCreate("test_line", OBJ_VLINE, 0, some_time, 0); int shift=iBarShift("EUROUSD",PERIOD_M1,some_time); Print("shift of bar with open time ",TimeToStr(some_time)," is ",shift); }
I suspect your symbol name is wrong . . . "EUROUSD" . . . should it be "EURUSD" ?
I chnaged into Symbol()
I works. Thanks a lot friend. I am a newbie to MQL4. Do you have skype or Yahoo id? So that i can contact you instantly for my doubts.
I chnaged into Symbol()
I works. Thanks a lot friend. I am a newbie to MQL4. Do you have skype or Yahoo id? So that i can contact you instantly for my doubts.
You are welcome . . . please contact me here so others can also learn from any issues you have.
Hi Simon,
I have completed 90% of the project. Now I have a doubt. I placed an buying order with STOP_LEVEL and TAKE_PROFIT.
While sending the order I have mentioned the expiry time as 04:45. The order has been executed and a position is opened in mentioned price.
Now the time is 05:30. But still the STOP_LEVEL and TAKE_PROFIT orders are alive.
Can you explain how the expiry time works, which is not explained by the MQL4?
Note: I m using GCI Demo account.
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Here is the code I used, just for checking. I am using GCI Demo Account. I get 0 as return value.
Can anyone suggest alternate code or method to get the output?
Output:
"2012.03.13 13:40:30 test1 Crude_Oil,M15: Current Open = 0.00000000"