A

@tianjixuetu said in I backtest a strategy about futures,but I find there something strange about the profit:
there is something different between your case and my case. you let the margin equals 2000 forever,but in real world,
the margin may be change awlays the price volitility.
Real world is different, you may want to educate your self a little bit more on this.
Sometimes margin doesn't fluctuate with the daily prices, even it still depends on volatility.
Also an advice - post the script you use in the very first message, not in the very last. There are no mid readers here, so only you know what is ran. My simplified case shows that bt works as expected, therefore the reason of the discrepancy is in (a) your additions to the bt or (b) in your calculations posted here. Seems it is case (b).