Symbol.Ask & Symbol.Bid Values for BackTesting Timeframe
Symbol.Ask & Symbol.Bid Values for BackTesting Timeframe
24 Aug 2014, 16:06
I've written the code below which I've used for my cbot successfully in backtesting on the 1 minute timeframe.
I want the code to work the same way when I use it on the live chart so I need to know how to write the code to get the Symbol.Bid value for the 1 minute timeframe otherwise the code will work differently on the live chart and return the Symbol.Bid value for each tick.
I've looked through the forum but can't find the answer so would appreciate assistance with this.
if (position != null && position.TradeType == TradeType.Buy)
{
foreach (var order in PendingOrders)
{
CancelPendingOrder(order);
}
if (MACDValue < 0)
{
Close(TradeType.Buy);
}
else if (Symbol.Bid > position.EntryPrice)
{
ModifyPosition(position, Symbol.Bid - (TrailingStop * Symbol.PipSize), position.TakeProfit);
}
else if (BuyTrailingStop > position.EntryPrice)
{
ModifyPosition(position, BuyTrailingStop, position.TakeProfit);
}
}
modarkat
25 Aug 2014, 10:15
Here you go:
@modarkat