Problem with strategy

 

My strategy is working on forex pairs but when i try to backtest my strategy on indices like De30 or US500, nothing appears and im not getting any results. Does anyone know why?

My EA is build on custom made indicator, so this will be linked too.

The problem is not that it does not work. My EA is auto trading as it should when attached to currency pairs like EUR/USD. But when i attach it to indiced like DE30 or US500, it does not trade and i have not clue why that is? Maybe it's just something inside the code but i cannot figure out why.

Regards Sebastian

Files:
 
Sebastian Schwartz:

My strategy is working on forex pairs but when i try to backtest my strategy on indices like De30 or US500, nothing appears and im not getting any results. Does anyone know why?

Why would you think that we should know?

 
Sebastian Schwartz:

My strategy is working on forex pairs but when i try to backtest my strategy on indices like De30 or US500, nothing appears and im not getting any results. Does anyone know why?

Regards Sebastian

Look for errors on logs
 
"Doesn't work" is meaningless — just like saying the car doesn't work. Doesn't start, won't go in gear, no electrical, missing the key, flat tires — meaningless.

Do you really expect an answer? We can't see your broken code. There are no mind readers here and our crystal balls are cracked.

 

Hi. Sorry, of course i forgot to link my EA.

My EA is build on custom made indicator, so this will be linked too.

The problem is not that it does not work. My EA is auto trading as it should when attached to currency pairs like EUR/USD. But when i attach it to indiced like DE30 or US500, it does not trade and i have not clue why that is? Maybe it's just something inside the code but i cannot figure out why.

Files:
 

I think it's the pip value calculation. Indexes have one or two digits. Try this:

double PipsToPoints(double pips)
{
  if (_Digits==5 || _Digits==3 || _Digits==2) pips *= 10;
  return (pips * _Point);
}

double PointsToPips(double points)
{
  if (_Digits==5 || _Digits==3 || _Digits==2) points /= 10;
  return (points / _Point);
}
By the way, your indicator isn't coded very well - it loops through the whole chart history on every tick.
 

In order to run an EA on everything imaginable forget pips points and digits. Think in ticks only and use SYMBOL_TRADE_TICK_SIZE to calculate prices.

//+----------------------------------------------------------------------------------+
//| PriceTicks; Credits: Fernando M. I. Carreiro; https://www.mql5.com/en/users/fmic |
//+----------------------------------------------------------------------------------+   
int PriceTicks (double price) 
  {
    return (int) round( price / SymbolInfoDouble( _Symbol, SYMBOL_TRADE_TICK_SIZE ) );
  }
double TicksPrice (int ticks) 
  {
    return (double)  ticks * SymbolInfoDouble( _Symbol, SYMBOL_TRADE_TICK_SIZE );
  }
 
Sebastian Schwartz:

My strategy is working on forex pairs but when i try to backtest my strategy on indices like De30 or US500, nothing appears and im not getting any results. Does anyone know why?

My EA is build on custom made indicator, so this will be linked too.

The problem is not that it does not work. My EA is auto trading as it should when attached to currency pairs like EUR/USD. But when i attach it to indiced like DE30 or US500, it does not trade and i have not clue why that is? Maybe it's just something inside the code but i cannot figure out why.

Regards Sebastian

This is the perfect case to use the debugger (in the Editor Ctrl+F5, use the options for the settings) to see where and why your EA and Indicator don't do what you want them to do!

 
Sebastian Schwartz:

My strategy is working on forex pairs but when i try to backtest my strategy on indices like De30 or US500, nothing appears and im not getting any results. Does anyone know why?

My EA is build on custom made indicator, so this will be linked too.

The problem is not that it does not work. My EA is auto trading as it should when attached to currency pairs like EUR/USD. But when i attach it to indiced like DE30 or US500, it does not trade and i have not clue why that is? Maybe it's just something inside the code but i cannot figure out why.

Regards Sebastian

did you adapt your lot size for each chart ?

 
Sebastian Schwartz:

I have been told that my strategy is inefficient because it loops throgh the whole chart history on every tick.

Therefore it takes forever to test my strategy but i have no clue how to fix this. Does anybody know how?

My strategy is build on a costume made indicator.

I have attached both here:


I have deleted your other topic and pasted it here.

Why start another topic when you are already discussing the EA here?

Reason: