Please help to make my code backtestable

Dear Seniors,

can someone please help me to make this attached code back testable...
Buy condition is: when the current price is > buy price and time is < 2:30 pm.
sell condition is: when the current price is less than Sell price and time is < 2:30 pm.

_SECTION_BEGIN( "code v1" );

SetChartOptions( 0, chartShowArrows | chartShowDates );
_N( Title = StrFormat( "{{NAME}} - {{INTERVAL}} {{DATE}} Open %g, Hi %g, Lo %g, Close %g (%.1f%%) {{VALUES}}", O, H, L, C, SelectedValue( ROC( C, 1 ) ) ) );
Plot( C, "Close", ParamColor( "Color", colorDefault ), styleNoTitle | ParamStyle( "Style" ) | GetPriceStyle() );

StartTime = ParamTime( "Start time", "9:15:00" );
endtime = ParamTime( "End time", "2:30:00" );
square_off_time = ParamTime( "Square off time", "3:15:00" );
initial_trail = Param( "Initial trail %", 0.3, 0, 10, 0.1 );



newday = Day() != Ref( Day(), -1 );

starttime = ValueWhen( newday, TimeNum() );
orb = "10min";


//Go to 10 Min time fram
if( orb == "10min" )
{
    IBendtime = starttime + 1000;
    minh = ValueWhen( newday, TimeFrameGetPrice( "H", in5Minute * 3 ) );
    minl = ValueWhen( newday, TimeFrameGetPrice( "L", in5Minute * 3 ) );
}

//*************************************************************************************************************************************
// Current Day 10 min high /low
current_day_10_min_high = IIf( TimeNum() < IBendtime, Null , minh );
current_day_10_min_low = IIf( TimeNum() < IBendtime, Null, minl );
//Previous day high low close
prev_day_close = ValueWhen( newday, TimeFrameGetPrice( "C", inDaily, -1 ) );
prev_day_High = ValueWhen( newday, TimeFrameGetPrice( "H", inDaily, -1 ) );
prev_day_LOW = ValueWhen( newday, TimeFrameGetPrice( "L", inDaily, -1 ) );
prev_day_open = TimeFrameGetPrice( "O", inDaily, 0 );
printf( "\n prev_day_close = %.2f", prev_day_close );
printf( "\n prev_day_High = %.2f", prev_day_High );
printf( "\n prev_day_LOW = %.2f", prev_day_LOW );
printf( "\n cur_day_10h = %.2f \n", current_day_10_min_high );
printf( "\nscur_day_10l = %.2f \n", current_day_10_min_low );

//*************************************************************************************************************************************

// Plotting buy and sell value....

FIBO = .618;
PREV_Day_Range = prev_day_High - prev_day_LOW;
Current_Day_Range = current_day_10_min_high - current_day_10_min_low;
printf( "\n PREV_Day_Range = %.2f", PREV_Day_Range );
printf( "\n Current_Day_Range = %.2f", Current_Day_Range );

FIBO_RANGE = ( PREV_Day_Range + Current_Day_Range ) * FIBO;
// Calcualte .618 range from yesterdays close..
Buy_Range_High = prev_day_close + FIBO_RANGE;
Sell_Range_Low = prev_day_close - FIBO_RANGE;
/// If todays price is gapup or gapbelow  .618 range.
Condition1 = current_day_10_min_high > Buy_Range_High;
Condition2 = current_day_10_min_low < Sell_Range_Low;
ExtraCondition =  Condition1 OR Condition2;

Plot( IIf( ExtraCondition, current_day_10_min_high, Buy_Range_High ), "Upper Break Out", colorYellow , styleDashed );
Plot( IIf( ExtraCondition, current_day_10_min_low, Sell_Range_Low ), "Lower Break Down", colorYellow, styleDashed );

//*************************************************************************************************************************************
//SETTING Buy AND Sell Price

BuyPrice1 = IIf( ExtraCondition, current_day_10_min_high, Buy_Range_High );
printf( "\n Buy Price = %.2f", BuyPrice1 );
sellPrice1 = IIf( ExtraCondition, current_day_10_min_Low, Sell_Range_Low );
printf( "\n sell Price = %.2f", sellPrice1 );

//setting stoploss
ExtraCondition_buystoploss = current_day_10_min_high - ( current_day_10_min_high * ( 0.5 / 100 ) );
ExtraCondition_Sellstoploss = current_day_10_min_low + ( current_day_10_min_low * ( 0.5 / 100 ) );
NormalCondition_buystoploss = Buy_Range_High - ( Buy_Range_High * ( 0.5 / 100 ) );
NormalCondition_Sellstoploss = Sell_Range_Low + ( Sell_Range_Low * ( 0.5 / 100 ) );
BuySL = IIf( ExtraCondition, ExtraCondition_buystoploss, NormalCondition_buystoploss );
SellSL = IIf( ExtraCondition, ExtraCondition_Sellstoploss, NormalCondition_Sellstoploss );
printf( "\n Buy Sl = %.2f", BuySL );
printf( "\n Sell SL = %.2f", SellSL );

Buy =  IIf( ExtraCondition, current_day_10_min_high, Buy_Range_High ) AND TimeNum() > StartTime AND TimeNum() < endtime;
Short =  IIf( ExtraCondition, current_day_10_min_Low, Sell_Range_Low ) AND TimeNum() > StartTime AND TimeNum() < endtime;


_SECTION_END();

Thanks in advance.

Hello @SUMITJAIN,

I haven't looked at your code, or even attempted to test it - please provide some details of what you think it should be doing, what you've done, and where you think there's a problem.

Also, please have a look at the following link: How to ask a good question