@backtrader @ab_trader I dug further and discovered that the buy column value is the value that initiated a buy order. There is no column for the executed buy price. That would be incredibly helpful. I have dug through the source of Writerfile and noticed none of the schema is hardcoded there. I also discovered that I don't have easy access to all the info I need in the notifiy_order function defined in a strategy to just make my own alternative dataframe to write to file. Do you have thoughts on how to create that column that captures the executed price in the results report?
Posts made by Darian Hickman
RE: PNL calculation broken
PNL calculation broken
![alt text]( image url)
I'm learning the WriterFile feature. I learned how to backtest a bracket order and now I'm getting weird math.
I have a buy and sell pair that should report a profit but instead it's reporting pnlminus of -$125.354.
If helpful here are the settings for my Cerebro:
Set our desired cash start
cerebro.broker.setcash(100000.0) # Add a FixedSize sizer according to the stake cerebro.addsizer(bt.sizers.FixedSize, stake=10) # Set the commission cerebro.broker.setcommission(commission=0) cerebro.addanalyzer(SQN) cerebro.addwriter(bt.WriterFile, csv=True, rounding=2, out="/Users/darianhickman/Documents/MorningstarGrep/Results.csv")