Login Page - Create Account

Support Board


Date/Time: Sun, 19 May 2024 08:47:47 +0000



Post From: ASCIL signal condition becomes false, but order still generated

[2016-08-19 17:55:39]
ManFromTanna - Posts: 6
I wanted to confirm that if using a range bar chart, once a bar closes that sc.Index moves from 0 to -1 instantaneously?

Below is the basic signal condition and order submission using a 10 Tick Range ("Range Per Bar-Fill Gaps" setting)

if((PositionData.PositionQuantity == 0) && (sc.Close[sc.Index - 2] == sc.Low[sc.Index - 2]) && (sc.Close[sc.Index - 1] == sc.High[sc.Index - 1]))
{  
s_SCNewOrder LongEntryOrder;
LongEntryOrder.OrderQuantity = 1;
LongEntryOrder.OrderType = SCT_ORDERTYPE_LIMIT;
LongEntryOrder.Price1 = sc.Open[sc.Index] - 4 * sc.TickSize;
LongEntryOrder.Target1Offset = TargetRange * sc.TickSize;
LongEntryOrder.Stop1Offset = Range.GetFloat() * sc.TickSize;

if(sc.BuyOrder(LongEntryOrder) > 0)  
{
LongEntryOrderID = LongEntryOrder.InternalOrderID;
LongTargetOrderID = LongEntryOrder.Target1InternalOrderID;
LongStopOrderID = LongEntryOrder.Stop1InternalOrderID;
}  
}

My stop order is placed 11 ticks below the high of the current bar using a variable. So if I get stopped out, a new bar begins forms.

This means the current condition is Position = 0, (sc.Close[sc.Index - 2] == sc.High[sc.Index - 2]) && (sc.Close[sc.Index - 1] == sc.Low[sc.Index - 1]).

However, another Buy Order is immediately submitted when my stop is filled, even under the new condition. So is the new condition not picked up before the previous condition?

Thanks.