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:
if n=100 //open order condition
Print ("opentime=",time); //it shows open time order on log window
this EA works but ObjectCreate function doesn't work.
"..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
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