Hi sdelatorre,

I am a newbie as well so take everything with a pinch of salt. I am able to replicate similar backtest results with both 60 and 5 minute BarPeriod using the modified code below. Have a look and compare against your original code and deep dive into manual. I guess you also need to handle LOOKBACK to ensure backtest start at the same time.

Not sure why 1 minute is producing different results though.

Code
int profit()
{
	if(TradeIsOpen && (TradeProfit/TradeUnits/PIP < -10) && TradeIsShort)
	{
		exitTrade();
	}

	if(TradeIsOpen && (TradeProfit/TradeUnits/PIP > 10) && TradeIsShort)
	{
		exitTrade();
	}

	return 0;
}

function run() 
{
	set(LOGFILE,PLOTNOW,TICKS);
	
	Fill = 0; // For the sake of comparison, not realistic otherwise
	
	StartDate = 20191215;
	EndDate = 20191220;

	BarMode = BR_FLAT; // To handle potential missing M1 data which would screw up time comparisons below...
	
	//BarPeriod=60;
	BarPeriod=5;
	
	asset("EUR/USD");

	if(hour()==22 && minute()==0)
	{
		enterShort(profit);
	}

	if(hour()==06 && minute()==0)
	{
		exitTrade();
	}
}



Last edited by ozgur; 12/27/19 23:39.