Backtesting with Amibroker: Buy stop

Hi every one.

i am ayub for Indian working in ksa.with programming background. Trying my luck in financial markets
amibroker is the best analysis/charting software we can buy.
this community has been a great help to me and many like me. I have used this community for learning amibroker for two years and have found most of my quires answered,
thanks to all the experts, trading is a long journey and been a fascinating one..

i have found a basic harami and bullish engulfing pattern working very nicely in backtesting.
have hit walls and could not figure out solution for my problem.

_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", colorWhite ), styleNoTitle | ParamStyle("Style") | GetPriceStyle() ); 
SetOption("PriceBoundChecking", False);

O1 = Ref(O,-1);O2 = Ref(O,-2); 
H1 = Ref(H,-1);H2 = Ref(H,-2); 
L1 = Ref(L,-1);L2 = Ref(L,-2); 
C1 = Ref(C,-1);C2 = Ref(C,-2); 

vrange = Param("VWMA range", 14, 1, 200 ); 
mrange = Param("MA range", 60, 1, 200 ); 

vsum = Sum( Volume, vrange ); 
vpsum = Sum( Close * Volume, vrange ); 

vwma = vpsum / vsum; 


PositionRisk = 1; // how much (in percent of equity) we risk in single position
TradeRisk = 5	; // trade risk in percent equals to max. loss percentage stop  8 GIVE MAX PROFIT
PctSize = 100 * PositionRisk / TradeRisk;
SetPositionSize( PctSize, spsPercentOfEquity );
Harami=((O1>C1) AND (C>O) AND (C<= O1) AND (C1<= O) AND ((C-O)<(O1-C1))); 
BullishEngulfing = ((O1>C1) AND (C>O) AND (C>= O1) AND (C1>= O) AND ((C-O)>(O1-C1))); 
BuyStopPrice =Ref(H,-1);
SellStopPrice =Ref(L,-1);
// BuyPrice = max( BuyStopPrice,Open); IF GAP UPS DONT MISS OUT
BuyPrice = BuyStopPrice;
//Buy=HARAMI   ;
Buy = (Ref (harami,-1) OR Ref(BullishEngulfing,-1))  AND (Cross( c, Ref( H, -1))	 ); 	
Sell= C<sellstopprice	 ;

PlotShapes( shapeHollowSmallUpTriangle*Buy , colorGreen, 0, H, 45 );
AddColumn(H,"Buy Above",1.2);
ApplyStop( 0, 0, sellstopprice, exitatstop=1, volatile = False, ReEntryDelay = 0, ValidFrom = 0, ValidTo = -1 );
//ApplyStop( stopTypeLoss, stopModePercent, percent_amount = 2, ExitAtStop = 1 );
//ApplyStop(stopTypeLoss, stopModePoint, L1, True, True );
pchng = ((C - Ref(C,-1)) / Ref(C,-1)) * 100;
 Filter = pchng;
 AddColumn(Close, "Close Price" );
 AddColumn(pchng, "Percent Change" );
 AddColumn(sellstopprice, "Stop Price" );
 AddColumn(Ref(Harami,-1), "Harami" );
  AddColumn(Ref(BullishEngulfing,-1), "BullishEngulfing" );

above code produces excellent signals for buy and stoploss..
buy my code buy stop is hit even if the gap up and the buystop.. i want results only if the price hits my buy stop, backtesting results show me I am in profit even if the price never reaches my buy stop

backtesting on two days candles gives almost to good to be true results.. any help will be greatly appreciated.

thanking all the experts for the great work