What's way to get the Signal Names printed on the chart?
protected override void OnOrderUpdate(Order order, double limitPrice, double stopPrice, int quantity, int filled, double averageFillPrice, OrderState orderState, DateTime time, ErrorCode error, string nativeError)
{
if ( order.Name == @"ENTRYLONG #1/5"
|| order.Name == @"ENTRYLONG #1/4"
|| order.Name == @"ENTRYLONG #1/3"
|| order.Name == @"ENTRYLONG #1/2"
|| order.Name == @"ENTRYLONG #1/1"
)
{
entryLgOrder1 = order;
// Reset the entryLgOrder object to null if order was cancelled without any fill
if (order.OrderState == OrderState.Cancelled && order.Filled == 0)
{
entryLgOrder1 = null;
}
}
if ( order.Name == @"ENTRYLONG #2/5"
|| order.Name == @"ENTRYLONG #2/4"
|| order.Name == @"ENTRYLONG #2/3"
|| order.Name == @"ENTRYLONG #2/2"
|| order.Name == @"ENTRYLONG #2/1"
)
{
entryLgOrder2 = order;
// Reset the entryLgOrder object to null if order was cancelled without any fill
if (order.OrderState == OrderState.Cancelled && order.Filled == 0)
{
entryLgOrder2 = null;
}
}
if ( order.Name == @"ENTRYLONG #3/5"
|| order.Name == @"ENTRYLONG #3/4"
|| order.Name == @"ENTRYLONG #3/3"
|| order.Name == @"ENTRYLONG #3/2"
|| order.Name == @"ENTRYLONG #3/1"
)
{
entryLgOrder3 = order;
// Reset the entryLgOrder object to null if order was cancelled without any fill
if (order.OrderState == OrderState.Cancelled && order.Filled == 0)
{
entryLgOrder3 = null;
}
}
}
}
protected override void OnExecutionUpdate(Cbi.Execution execution, string executionId, double price, int quantity,
Cbi.MarketPosition marketPosition, string orderId, DateTime time)
{
if (entryLgOrder1 != null && entryLgOrder1 == execution.Order)
{
if (execution.Order.OrderState == OrderState.Filled || execution.Order.OrderState == OrderState.PartFilled || (execution.Order.OrderState == OrderState.Cancelled && execution.Order.Filled > 0))
{
Entry_Lg_Prices.Add(execution.Order.AverageFillPrice);
}
}
if (entryLgOrder2 != null && entryLgOrder2 == execution.Order)
{
if (execution.Order.OrderState == OrderState.Filled || execution.Order.OrderState == OrderState.PartFilled || (execution.Order.OrderState == OrderState.Cancelled && execution.Order.Filled > 0))
{
Entry_Lg_Prices.Add(execution.Order.AverageFillPrice);
}
}
if (entryLgOrder3 != null && entryLgOrder3 == execution.Order)
{
if (execution.Order.OrderState == OrderState.Filled || execution.Order.OrderState == OrderState.PartFilled || (execution.Order.OrderState == OrderState.Cancelled && execution.Order.Filled > 0))
{
Entry_Lg_Prices.Add(execution.Order.AverageFillPrice);
}
}
protected override void OnBarUpdate()
{
if ( Cond1 )
{
EnterLong(Convert.ToInt32(Qty1), @"ENTRYLONG #1/3");
EnterLong(Convert.ToInt32(Qty2), @"ENTRYLONG #2/3");
EnterLong(Convert.ToInt32(Qty3), @"ENTRYLONG #3/3");
}
}

Comment