EA profitable on Daily backtest but not in hourly

 
Hi,

I created a basic EA that makes profit when I run on a Day timeframe but it makes losses on intraday trading.

It s based on ATR and MA 20 candle period where both symbol and timeframe are set to NULL.

What am I supposed to do to make my EA work on the Hourly trade?

How do you make your EA work both on Daily and intraday?

Thanks
 

If you call the indicators with an empty timeframe (= 0) they will calculate values accordiing to the timeframe that is set for the chart resp. set for the backtest. As your strategy is based on D1 it is better to call the indicators with a fixed timeframe PERIOD_D1. You could make this an input value to your EA.

input ENUM_TIMEFRAMES TF=PERIOD_D1;
...
double atr=iATR(NULL,TF,...);
This will guarantee your strategy to operate safely whatever timeframe the chart is currently showing.
 
lippmaje:

If you call the indicators with an empty timeframe (= 0) they will calculate values accordiing to the timeframe that is set for the chart resp. set for the backtest. As your strategy is based on D1 it is better to call the indicators with a fixed timeframe PERIOD_D1. You could make this an input value to your EA.

This will guarantee your strategy to operate safely whatever timeframe the chart is currently showing.

thank you so much @lippmaje.

I understand.

 
run it on daily then?