[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[amibroker] ApplyStop function ?



PureBytes Links

Trading Reference Links

Hello all, 

for backtesting purposes I want to define "nBarsWait" like this:

nBarsWait = 60 - Minute();
ApplyStop(stopTypeLoss,stopModePoint,nStop,1,False,nBarsWait); 
ApplyStop stopTypeProfit,stopModePoint,nTarget,1,False,nBarsWait); 

But the applystop function does not allow me to do this.

My aim is, that, after a Buy signal was previously generated
and the position is closed by applystop function, I want my 
trading system to wait until the next full hour starts until
it is ready again for opening the next Buy position.

In realtime trading it should work (see fomula below) but for 
backtesting with historical data, the applystop function does 
not accept referencing to the bar´s minute "Minute()".

Will appreciate any help.
Thanks and regards.
Robert

_________________________________________________________________
Time = Now(4);
CurMinute = int(Time/100%100);
nBarsWait = 60 - CurMinute;
ApplyStop(stopTypeLoss,stopModePoint,nStop,1,False,nBarsWait); 
ApplyStop stopTypeProfit,stopModePoint,nTarget,1,False,nBarsWait); 
_________________________________________________________________