When running a backtest, how is Amibroker calculating the Profit for a trade that is displayed in the analysis window?
I am backtesting a simple breakout system on various futures markets. I have my profit size set to 1 contract in my code.
_SECTION_BEGIN("Breakout System-Test");
// This is a simple breakout/breakdown system using daily data.
// Turn off Quick AFL to use all bars
SetBarsRequired(sbrAll,sbrAll);
// System Parameters
SetOption("InitialEquity",1000000);
SetOption("AllowSameBarExit",False);
SetOption("FuturesMode",True);
SetTradeDelays(1,1,1,1);
// PositionSize=MarginDeposit=1;
SetPositionSize(1,spsShares);
The Profit that Amibroker calculates is different from what I calculate by hand. Following is an example.
The trade in question is in the 3-Month Sterling contract. The signal was given on 8/3/2003 and the trade was entered on 8/4/2003 per my system rules. The signal to exit was given on 1/9/2004 and the trade was exited on 1/12/2004 per my system rules. I checked the entry and exit prices from the backtest and they match what I would calculate by hand.
When I run the backtest, I get the following result for this trade.
The loss of -$28,299.74 is way more than I calculate.
The point loss on the trade is 94.06 - 93.98 or 0.08 points.
The point value for the 3-Month Sterling contract is 1,250 pounds, which I have in my symbol information.
Therefore, I would calculate the loss in pounds on this trade as 1,250 * 0.08 or 100 pounds.
My account is in US dollars. You can see in the symbol information above for 3-Month Sterling I have the currency set to GBP. I have GBP set up in my preferences per the image below.
If I go to a chart of the GBPUSD for the time period, I find that the exchange rate was 1.8511.
Therefore, the loss in USD would be $185.11.
This is wildly different than the Profit that Amibroker calculates for this trade and I am completely confused as to how to Amibroker arrived at a $28k loss on this trade.