
- www.mql5.com
Hi,
I used ObjectCreate to put some objects on the chart within the strategy tester. However, TimeCurrent and the bid price seem to have no effect. I want the objects to move with current as well as the bid price but they remain static. Any ideas?
void OnTick() {
ObjectCreate(0,"test9999",OBJ_ARROW_LEFT_PRICE,0,TimeCurrent(),SymbolInfoDouble(_Symbol,SYMBOL_BID)-0.001);
ObjectCreate(0,"test9991",OBJ_ARROW_RIGHT_PRICE,0,TimeCurrent(),SymbolInfoDouble(_Symbol,SYMBOL_BID)-0.001);
ObjectCreate(0,"test9992",OBJ_ARROW_SELL,0,TimeCurrent(),SymbolInfoDouble(_Symbol,SYMBOL_BID)-0.001);
ObjectCreate(0,"test9993",OBJ_VLINE,0,TimeCurrent(),SymbolInfoDouble(_Symbol,SYMBOL_BID));
Print(TimeCurrent());
}
You are trying to create multiple objects with the same name. It's not allowed.
You have to either delete and recreate objects on each tick or use ObjectMove().
Also, you should always check the return value of the ObjectCreate() and react if you get an error.

- 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,
I used ObjectCreate to put some objects on the chart within the strategy tester. However, TimeCurrent and the bid price seem to have no effect. I want the objects to move with current as well as the bid price but they remain static. Any ideas?
void OnTick() {
ObjectCreate(0,"test9999",OBJ_ARROW_LEFT_PRICE,0,TimeCurrent(),SymbolInfoDouble(_Symbol,SYMBOL_BID)-0.001);
ObjectCreate(0,"test9991",OBJ_ARROW_RIGHT_PRICE,0,TimeCurrent(),SymbolInfoDouble(_Symbol,SYMBOL_BID)-0.001);
ObjectCreate(0,"test9992",OBJ_ARROW_SELL,0,TimeCurrent(),SymbolInfoDouble(_Symbol,SYMBOL_BID)-0.001);
ObjectCreate(0,"test9993",OBJ_VLINE,0,TimeCurrent(),SymbolInfoDouble(_Symbol,SYMBOL_BID));
Print(TimeCurrent());
}