The problem is the Short_Order never had any chance to be filled. I think it is actually been ignored by program.
The funny thing is if I reverse the order of writing in the code, i.e define Short_Order first and then Long_order, as in the following commented out part, the opposite happens: short order filled and long order been ignored.
I am wondering if I missed any setting and long / short stop order can not exist altogether?
#region Variables
private IOrder Long_Order = null;
private IOrder Short_Order = null;
#endregion
protected override void OnBarUpdate(){
Long_Order = EnterLongStop(0, true, Unit, Base_Entry_Price+ x, "L");
Short_Order = EnterLongStop(0, true, Unit, Base_Entry_Price- x, "S");
/*
//this will let the short order be recognized, and long order been ignored.
Short_Order = EnterLongStop(0, true, Unit, Base_Entry_Price- x, "S");
Long_Order = EnterLongStop(0, true, Unit, Base_Entry_Price+ x, "L");
*/
// other order to exit both the short and long position
}
Comment