Thank you for your reply. But I am still not sure about the concept of margin in zorro yet. Thank you for bearing with me in my following thoughts to see what I have missed.

In the AssetsFix I set the margincost to be 0 and leverage to be 1 (no leverage for US equity) or 2 (reg-T margin).

In the backtest/live trading I want to reinvest every penny I earned/lost for every single signal. Assuming I am doing a long only system with only SPY and only 1 position would be held at every time point. Under such simple scenario I should not have any margin call in my mind. If I am trading with 5X or 10X leverage I believe Margin = 1 * (Capital + ProfitClosed) would run into margin call but I am not using any leverage and the worst case would just be going to 0 with long only SPY.


Following the suggestion of setting
Capital = 10000;
Margin = 0.1 * (Capital + ProfitClosed);
I reran the backtest. I checked the log file and the first order used 248 which is only 2.5%. Later in the backtest with a capital of
11497 another trade used 1406 which is ~12%. I am totally confused with the meaning of margin now and how I could reinvest with a fixed percentage of total capitals like in other platforms like quantconnect and quantpian.

Thank you.