Indicator based on EA with live Backtest

 

We are working on a EA that shows you trading signals and stop signals that also plots a rectangle and show you how many pips your profit of that trade was.

This picture is from a strategy tester run. You can see red Vlines as sell signals and green as buy. Black Vlines are close orders and the rectangles are from open order to close order (not TP or SL).


While backtesting i started to think about if it was possible to have an indicator to this instead of a EA. The indicator could "backtest" and see if the strategy would have been good or bade much faster then the Strategy tester or at least give you a hint on if these settings would work on this Symbol and timeframe.

This picture is taken from the indicator just put on a symbol and shows almost the same results.


I'm having some problems when switching timeframes and symbols with the objects not being deleted propoly and I also have a problem with calculating the pip profit.
In the indicator I'm trying to see if I can make it display how much $ the profit would have been instead of it in pips and that isn't working as I want to.

Here is the part where i'm trying to convert the pip's to $ and display it.


double calculatePip(double number)
  {
   double a = Point;
   number = NormalizeDouble( (number/a) * (pipsmultiplier),Digits);
   number = number * Static_LotSize;
   return(number);
  }



And regarding the problem with the objects not deleting properly the code for that is here.

int OnInit()
  {
//--- indicator buffers mapping
   SetIndexBuffer(0,EmaTrendBuffer);
   SetIndexBuffer(1,EmaShortBuffer);
   SetIndexBuffer(2,TrendBuffer);
   deleteObjects();

   if(MarketInfo(Symbol(),MODE_DIGITS)==3 && MarketInfo(Symbol(),MODE_DIGITS)==5)
     {
      pipsmultiplier=10;
     }
   else
     {
      pipsmultiplier=1;
     }

//---
   return(INIT_SUCCEEDED);
  }
//+------------------------------------------------------------------+
//| expert deinitialization function                                 |
//+------------------------------------------------------------------+
int deinit()
  {
//----
   deleteObjects();
//----
   return(0);
  }
//+------------------------------------------------------------------+
//|   Delete CreateObjects                                           |
//+------------------------------------------------------------------+
int deleteObjects()
  {
   ObjectsDeleteAll(NULL, OBJ_VLINE); // delete all horizontal lines from the 2nd subwindow
   ObjectsDeleteAll(NULL, OBJ_RECTANGLE);
   ObjectsDeleteAll();
   return(0);
  }
//+------------------------------------------------------------------+




I'm hoping someone can give me a hint on where I'm wrong.

Reason: