i have write the code like this :
...when i run the ea in strategy tester , nothing has create in the chart , and the journal have this "------------ObjectCreate return TURE".
Can someone tell me why?
thanks
- Please use the SRC button when you post code.
- Object aren't plotted in normal mode, read here.
i have write the code like this :
void OnTick() { // some codes... if(!PositionSelect(_Symbol)) { CTrade trade; trade.PositionOpen(_Symbol,ORDER_TYPE_BUY,0.1, SymbolInfoDouble(_Symbol,SYMBOL_ASK), 0,0,""); bool res = ObjectCreate(0,"test obj",OBJ_ARROW_THUMB_UP,0,TimeCurrent(),SymbolInfoDouble(_Symbol,SYMBOL_ASK)+1); if (res) printf("------------ObjectCreate return TURE"); else printf("----------------ObjectCreate return FALSE"); } // some codes.... }
when i run the ea in strategy tester , nothing has create in the chart , and the journal have this "------------ObjectCreate return TURE".
Can someone tell me why?
thanks
Maybe the Objects are created but not at the time or price that you expect, add a Print() statement and output the time and price that you are using for the position of the Object and check it is correct. Print these . . .
TimeCurrent(),SymbolInfoDouble(_Symbol,SYMBOL_ASK)+1
Objects are not created when you are running the Optimizer.
Br, Candles
thank you for your advice,and i have found the reason.
Good. because if for example EURUSD is 1.23456, then this code below
SymbolInfoDouble(_Symbol,SYMBOL_ASK)+1
will draw your object on EURUSD at 2.23456.
Just press Ctrl + O to see the object list and you will find your object at about 10,000 pips away :D.
BTW, why you need this arrow ?. Is MT5 deal arrow is not enough ?, you can activate it by open Option (Ctrl + O), click "Trade" tab and select "Show real time history on chart" .
Good. because if for example EURUSD is 1.23456, then this code below
will draw your object on EURUSD at 2.23456.
Just press Ctrl + O to see the object list and you will find your object at about 10,000 pips away :D.
BTW, why you need this arrow ?. Is MT5 deal arrow is not enough ?, you can activate it by open Option (Ctrl + O), click "Trade" tab and select "Show real time history on chart" .
I was going to suggest the same, unfortunately that won't work in the Strategy Tester :-( how do we get a list of the Objects in the Strategy Tester ?
Object aren't plotted in Strategy Tester in "normal" mode, and in visual mode you can't almost do anything. Don't know why.

- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
i have write the code like this :
void OnTick()
{
// some codes...
if(!PositionSelect(_Symbol))
{
CTrade trade;
trade.PositionOpen(_Symbol,ORDER_TYPE_BUY,0.1,
SymbolInfoDouble(_Symbol,SYMBOL_ASK),
0,0,"");
bool res = ObjectCreate(0,"test obj",OBJ_ARROW_THUMB_UP,0,TimeCurrent(),SymbolInfoDouble(_Symbol,SYMBOL_ASK)+1);
if (res) printf("------------ObjectCreate return TURE");
else printf("----------------ObjectCreate return FALSE");
}
// some codes....
}
when i run the ea in strategy tester , nothing has create in the chart , and the journal have this "------------ObjectCreate return TURE".
Can someone tell me why?
thanks