"..but ObjectCreate function doesn't work."
1) It does work, but your code is wrong!
2) Check the return of ObjectCreate(..) and if false check the error code (all to be read in the editor's reference!!)
3) You created an object but you didn't set it properties - look for examples - in the editor's reference!!
4) Follow the link in the editor's reference for "OBJ_VLINE" you'll find a perfect example!
Give objects individual names, once an object exists, a new object with the same name cannot be created
As you already create the string time
ObjectCreate(0,name,OBJ_VLINE,0,opentime,0); //Change to ObjectCreate(0,name+time,OBJ_VLINE,0,opentime,0);
although I would avoid using something like time as a variable name in code because of the possibility of mixing with Time or time in an indicator
I would name it maybe bar_time, or open_time

- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Hi There!!!!
Can an EA create objects during a test?
example: I create an EA and I want to test it ,during the test it opens 3 orders.
Can it automatically creates 3 vertical lines in correspondence with the opening time of the 3 orders ?
I tried this code:
this EA works but ObjectCreate function doesn't work.