I am trying to execute a sellshort market order when I get above a certain value in an existing Range Bar. As I understand the wiki and C# guide CalcBar will be called for every N Ticks specified within BarMagnifier in this case every 1 tick. However I cannot ever get the entry to occur anytime other than at the close of the bar.
I can get this to work with a IOrderPrice Stop order but I would prefer to use a Market Order Instead.
I cannot find this question elsewhere and I cannot find the information on the wiki. Please Advise?
General Gist of Code
Code: Select all
private IOrderMarket sell_order;
protected override void Create(){
ConsecBarsDn_Cnt = new VariableObject<int>(this);
sell_order = OrderCreator.MarketThisBar(new SOrderParameters(Contracts.Default, "SE", EOrderAction.SellShort));
}
protected override void StartCalc(){
}
protected override void CalcBar(){
double TestHigh;
double TestLow;
double TestInternalHigh;
double TestInternalLow;
double RealRange;
...
if (Bars.CloseValue > TestInternalHigh && Bars.CloseValue < TestHigh ){
sell_order.Send();
}
}