Hi All,

I am new to QC and have attempted to resolve the following issue using the documentation and the community discussions, to no avail. 

The backtest attached is a basic SMA cross strategy. It looks at the current fast and slow SMA, and the previous period's fast and slow SMA, if (fast_SMA > slow_SMA) and (past_fast_SMA < past_slow_SMA), it should execute a long trade. 

When I cross compare the trades executed on QC, with the Oanda platform, there is a complete mismatch in the data. Below is the logs for the final trade in the back test period: 

2023-02-27 11:00:00 :########### LONG #################

2023-02-27 11:00:00 :Time >> 2023-02-27 11:00:00

2023-02-27 11:00:00 :If (fastEMA > slowEMA) & (pastFastEma < pastSlowEma):

2023-02-27 11:00:00 :pastFastEma >> 1.195029

2023-02-27 11:00:00 :pastSlowEma >> 1.1957374

2023-02-27 11:00:00 :Current fast_EMA >> 1.195813

2023-02-27 11:00:00 :Current slow_EMA >> 1.1955508

2023-02-27 11:00:00 :Long @ >> 1.19774

2023-02-27 11:00:00 :Limit @ >> 1.20274

2023-02-27 11:00:00 :Stop @ >> 1.19574

2023-02-27 15:00:00 :Time: 02/27/2023 15:00:00 OrderID: 69 EventID: 3 Symbol: GBPUSD Status: Canceled Quantity: -10000 StopPrice: 1.19574  

The following data has been taken from the Oanda platform (+ or - a few pips) on the 27th February at 11am. The platform is set to the timezone Utc (London), which should match the timezone set in the back test. 

OANDA DATA:

pastFastEma >> 1.19596

pastSlowEma >> 1.19853

Current fast_EMA >> 1.19640

Current slow_EMA >> 1.19853

Long @ >> 1.19843

This indicates the price the trade is opened at is incorrect.

Regarding the logic: If (fastEMA > slowEMA) & (pastFastEma < pastSlowEma):

Based on the data provided by Oanda, (pastFastEma < pastSlowEma) is correct. However, (fastEMA > slowEMA) is NOT correct. Thus the trade should not have been executed. 

I am not sure if this is a simple or complex fix, or if it is a bug. But any support would be much appreciated. 

Thanks 

Zubair Chaudhary

 

 

Author