other code below also not working on backtest? also has 2 errors
//+------------------------------------------------------------------+
//| Expert initialization function |
//+------------------------------------------------------------------+
int OnInit()
{
//--- create timer
EventSetTimer(60);
return(INIT_SUCCEEDED);
}
//+------------------------------------------------------------------+
//| Expert deinitialization function |
//+------------------------------------------------------------------+
void OnDeinit(const int reason)
{
//--- destroy timer
EventKillTimer();
}
//+------------------------------------------------------------------+
//| Expert tick function |
//+------------------------------------------------------------------+
void OnTick()
{
double high13 = iHigh(NULL, PERIOD_D1, 13);
double low5 = iLow(NULL, PERIOD_D1, 5);
double currentPrice = iClose(NULL, PERIOD_CURRENT, 0);
// Check if we should buy
if(currentPrice >= high13)
{
// Buy logic
if(PositionSelect(Symbol()) == false)
{
trade.Buy(1.0, Symbol(), currentPrice, 0, 0, "Buy at 13-day high");
}
}
// Check if we should exit
if(currentPrice <= low5)
{
// Exit logic
if(PositionSelect(Symbol()) == true)
{
trade.Close(Symbol());
}
}
}
//+------------------------------------------------------------------+
//| Timer function |
//+------------------------------------------------------------------+
void OnTimer()
{
//--- check for new tick
OnTick();
}