Download MetaTrader 5

graphical objects issue in backtest

To add comments, please log in or register
Share links from other resources. Now they have a description.
APeng
359
APeng 2014.01.24 09:06 

Hi!

I draw a trendline into the chart and save the template as "tester". Then I run a backtest, when the price hits the trendline an order shall be placed. When the backtest starts, the trenline is drawn but shiftet to the right. I select the trendline and check the parameters. They are exactly as they should be. After clicking the ok-button the trendline jumps back to the place where I draw it first (where it should be).

I would be thankfull for any idea how I could solve this issue!

Greetings.



edit: ObjectGet deliveres the values stored in the object not the values where the object is placed. So I probably can work with it. But it would be nice to know why that issue occurs.

APeng
359
APeng 2014.01.24 12:59  

solved (if someone else has the same problem, too):


cycle through object, get objects values and set the objects with same values places them where they should be be placed.

int counter = ObjectsTotal();
    while(counter >=0)
    {
    string name = ObjectName(counter);
    datetime time1 = ObjectGet(name,OBJPROP_TIME1);
    datetime time2 = ObjectGet(name,OBJPROP_TIME1);
    ObjectSet(name,OBJPROP_TIME1,time1);
    ObjectSet(name,OBJPROP_TIME1,time2); 
    counter--;
    }
To add comments, please log in or register