Implementing the Hold function

Hi,

I am using the below code to Hold a condition true for a certain number of bars. My understanding is that if a Buy is triggered, that buy condition will be held true for 3 bars (hourly bars) while Limit order is wating to be hit/executed. After 3 hours, the hold will come off and if the BuyLimitprice was not executed, the order would go unfilled. If the new "val" for the 4th bar indicated a Buy or a Short, that limit order would be place per the Hold good go 3 bars.

If I do not use the Hold function, if a Limit order is not filled, that limit order is effectively cancelled, and a new Limit order will be place on the next bar.

Is the above correct?

Thanks,

Mike

// buy on the next bar
Buy = Ref( Val, -1);
Short = Ref( Val, -1);
BuyLimitPrice = Open-(0.0002*slippagemultiplier);
ShortLimitPrice = Open+(0.0002*slippagemultiplier);
// now we check if limit was hit
Buy = Hold( Buy, 3 ) AND L < BuyLimitPrice;
Short = Hold( Short, 3 ) AND H > ShortLimitPrice;
// if Open price is below the limit, then we use Open for entry
BuyPrice = Min( Open, BuyLimitPrice );
ShortPrice = Max( Open, ShortLimitPrice );

SellPrice=Open;
CoverPrice=Open;

This topic was automatically closed 100 days after the last reply. New replies are no longer allowed.