Problem in Strategy Tester Chart (Properties) ? - page 2

 

Thanks @Alain: That was actually a good idea!


@Jack Thomas: Thanks for your Input. I managed to get rid of the sell arrow using the following Code:

#include <trade/trade.mqh>

CTrade         m_trade;                     
MqlTick        last_tick;                   
bool           trade = true;

int OnInit() {

ChartSetInteger(0, CHART_COLOR_VOLUME, clrBlack);

ChartRedraw();

   return(INIT_SUCCEEDED);   
}

void OnTick() {
   
   if(trade) {
      
      m_trade.Sell(0.1, _Symbol, last_tick.ask, 0, 0, NULL);
           
      trade = false;
      
      // ObjectsDeleteAll(0,0,OBJ_ARROW_SELL);
   }
   
   ObjectsDeleteAll(0,0,OBJ_ARROW_SELL);
   // ObjectsDeleteAll(0,0,-1);      
    
}

But there are still two Things I do not get my head around:

1. Why is 

ObjectsDeleteAll(0,0,OBJ_ARROW_SELL);

not working inside the if-clause? Putting the statement outside the if-clause it removes the red sell arrow


2. In the Chart, after removing the arrow, the text  #2 sell 0.10 still stays. However, when I press shift +B or go to Chart functions -> Objects it is grayed out saying there are no more objects left. So why is the text still there then? even though redrawing the Chart using ChartRedraw() does not get rid of it. What am I missing?


Thank you!



 

2. In the Chart, after removing the arrow, the text  #2 sell 0.10 still stays. However, when I press shift +B or go to Chart functions -> Objects it is grayed out saying there are no more objects left. So why is the text still there then? even though redrawing the Chart using ChartRedraw() does not get rid of it. What am I missing?

Hi, i have the same problem. Did you fix that?

I removed all objects with ObjectDeleteAll function, but the outside of rectangles and trend lines still stay in the strategy tester chart window. In the "real" Chart, everything is cleared. I think its a strategy tester Bug :(

 
Robert Hess:

Hi, i have the same problem. Did you fix that?

I removed all objects with ObjectDeleteAll function, but the outside of rectangles and trend lines still stay in the strategy tester chart window. In the "real" Chart, everything is cleared. I think its a strategy tester Bug :(

Fixed that: 

void deleteObjects(string prefix)
  {
   int length = StringLen(prefix);
   for (int i=0; i < ObjectsTotal(0); i++)
   {
      string object = ObjectName(0,i);
      if(StringSubstr(object,0,length) != prefix)
      {
         continue;
      }
      ObjectDelete(0,object);
   }
  }
deleteObjects("YOUR PREFIX");

That function searches for all objects with your defined prefix in its name and deletes it. 

Reason: