Conversion of Daily Strategy to Intraday

Hi!

I have been trying to convert a day trading Daily (EOD) strategy to intraday just because I need to close any open positions at 16:30 instead of at market close.

I managed to install the 1 minute market data in order to be able to intraday backtest and also used those instructions to have the trading strategy calculations still based on the Daily time frame and implemented the following code to get the position closed at 16:30:

myVal1 = ValueWhen(TimeNum() == 163000, Close, 0 );
SellPrice = myVal1;

When I backtest I simple can not make it work. Not sure if for intraday backtest is needed any specific additional adjustment to allow the intraday backtest or maybe there is a simple way to simple keep the original code and make it close the trade at 16:30 without so many adjustments.

Below code for backtesting that is original for the daily time frame and I could not found the adjustments needed:

//=================================================================================
//Entry and Exit Signals
//=================================================================================
DC = TimeFrameGetPrice( "C", inDaily, 0 ); // today daily Close.
DOp = TimeFrameGetPrice( "O", inDaily, 0 ); // today daily Open.
DL =  TimeFrameGetPrice( "L", inDaily, 0 ); // today daily Low.
DH =  TimeFrameGetPrice( "H", inDaily, 0 ); // today daily High.

TimeFrameSet( inDaily ); // switch to Daily timeframe

Cond1 = ADX_Calc > Ref(ADX_Calc,-1) AND ADX_Calc > Ref(ADX_Calc,-5) AND ADX_Calc > Ref(ADX_Calc,-10); // -8, -16
Cond2 = IndexUp AND OptFilt;
Cond3 = C > MA(C,MAf) AND ADX_Calc > ADX_Level;
Cond4 = ROC_Calc > ROC_MinLevel AND ROC_Calc < ROC_MaxLevel;

TimeFrameRestore(); // restore time frame to original

/* expand calculated Daily data to Intraday so we can use it with Intraday signals */
Cond3 = TimeFrameExpand( Cond3 , inDaily );

BuySetUp = Cond1 AND Cond2 AND Cond3 AND Cond4; 
Buy = Ref(BuySetUp,-1);
BuyPrice = Min(DOp,Ref(BuyLimit,-1));
Sell = Buy==1;

//SellPrice = DC;
myVal1 = ValueWhen(TimeNum() == 134000, Close, 0 );
SellPrice = myVal1;
/===============================================

BuySignal = Buy AND DL <= Ref(BuyLimit,-1); 
ExitSignal = BuySignal AND Sell;

//===============================================
Short = Cover = False;
//=================================================================================
_SECTION_END();

_SECTION_BEGIN("Custom Backtester");
//=================================================================================
//Custom Backtester
//=================================================================================
DL =  TimeFrameGetPrice( "L", inDaily, 0 ); // today daily Low.

DailyEntryOrderLimit = MaxPos; 
Ticker = Name();
StaticVarSet(Ticker + "LimitEntryPrice", Ref(BuyLimit,-1)); 
//==========================================================
SetCustomBacktestProc(""); 
if (Status("action") == actionPortfolio) 
{
	bo = GetBacktesterObject(); 
	bo.PreProcess(); // 
	MaxOrdersToPlace = 0;
	TotalOrdersPlaced = 0;

	for (i = 0; i < BarCount; i++) 
	{
		MaxOrdersToPlace = MaxPos - bo.GetOpenPosQty();
		TotalSignalCount = 0;
		SigCount = 0;

		
		for (sig = bo.GetFirstSignal(i); sig; sig = bo.GetNextSignal(i))
		{ 
			if (sig.IsEntry() && sig.IsLong())
				TotalSignalCount++;
		}
		
		
		for (sig = bo.GetFirstSignal(i); sig; sig = bo.GetNextSignal(i))
		{ 
			if (sig.IsEntry() && sig.IsLong())
			{
				SigCount++;

				LimitPrice = StaticVarGet(sig.Symbol + "LimitEntryPrice");
				LowPrice = Foreign(sig.Symbol, "Low");
				
				
				if (SigCount > MaxOrdersToPlace OR					
					SigCount > DailyEntryOrderLimit)				
					sig.Price = -1; 								
				else
					TotalOrdersPlaced++; 							

				if (LimitPrice[i] < LowPrice[i])					
					sig.Price = -1; 																

			}
		} 
		bo.ProcessTradeSignals(i); 
	} 
	
	bo.PostProcess();
	
	
	st = bo.GetPerformanceStats(0);
	bo.AddCustomMetric("Total Entry Orders Placed", TotalOrdersPlaced, Null, Null, 0);
	bo.AddCustomMetric("Fill Rate", NumToStr(((st.getvalue("AllQty") / TotalOrdersPlaced) * 100), 1.0) + "%", Null, Null, 1);
	
}
//=================================================================================
_SECTION_END();

If anyone can help, thanks in advance!

What timeframe is the Periodicity setting set to in the Analysis window ?
It has to be the target lower timeframe that you want to backtest or explore in.

Thanks for your reply.
I´m using 1 minute time frame, but shows no results, even after making the adjustments to have calculate the data based on DailyTime frame.

When I run the backtest on daily time frame it generate the trades, but does not close the positions at 16:30 close price, so it seems I'm missing an adjustment.