Skip to content

Spread is Float but spread is typically different per row of the OHLC dataframe #1300

Description

@FCNealVillangca

Enhancement description

so I was looking at the Backtest class and it accepts spread: float = .0, which is as far as I know spread is different per row and it's not fixed. I'm looking forward to the spread to be either np array or a required column in data: pd.DataFrame,.

Additional info, images

this is what Mt5 return so as you notice the spread has it's own column because it's dynamically changing depending on time.

First 5 rows:
                        Open     High      Low    Close  Volume  spread  real_volume
time
2025-04-16 22:00:00  1.13864  1.14128  1.13847  1.13865    6294       8            0
2025-04-16 23:00:00  1.13866  1.13992  1.13816  1.13981    2788       8            0
2025-04-17 00:00:00  1.13980  1.13994  1.13939  1.13964     627      21            0
2025-04-17 01:00:00  1.13971  1.13997  1.13943  1.13995    1461       8            0
2025-04-17 02:00:00  1.13995  1.14093  1.13940  1.13955    2776       8            0
2025-04-17 03:00:00  1.13959  1.13969  1.13651  1.13677    6776       8            0
2025-04-17 04:00:00  1.13677  1.13692  1.13553  1.13654    6591       8            0
2025-04-17 05:00:00  1.13655  1.13819  1.13651  1.13782    3625       8            0
2025-04-17 06:00:00  1.13782  1.13808  1.13640  1.13642    3374       8            0
2025-04-17 07:00:00  1.13641  1.13699  1.13603  1.13623    2376       8            0
2025-04-17 08:00:00  1.13623  1.13712  1.13441  1.13522    3616       8            0
2025-04-17 09:00:00  1.13523  1.13711  1.13435  1.13589    6353       8            0
2025-04-17 10:00:00  1.13586  1.13789  1.13529  1.13770    8072       8            0
2025-04-17 11:00:00  1.13767  1.13885  1.13681  1.13785    7003       8            0
2025-04-17 12:00:00  1.13785  1.13808  1.13701  1.13727    5780       8            0
2025-04-17 13:00:00  1.13727  1.13766  1.13575  1.13596    7365       8            0
2025-04-17 14:00:00  1.13596  1.13701  1.13559  1.13564    5638       8            0
2025-04-17 15:00:00  1.13560  1.13680  1.13352  1.13564   12521       8            0
2025-04-17 16:00:00  1.13567  1.13776  1.13509  1.13611   12523       8            0
2025-04-17 17:00:00  1.13615  1.13857  1.13384  1.13496   10400       8            0
2025-04-17 18:00:00  1.13498  1.13766  1.13476  1.13632    7736       8            0
2025-04-17 19:00:00  1.13632  1.13712  1.13398  1.13505    8103       8            0
2025-04-17 20:00:00  1.13505  1.13538  1.13410  1.13510    4468       8            0
2025-04-17 21:00:00  1.13511  1.13752  1.13430  1.13733    5151       8            0
2025-04-17 22:00:00  1.13732  1.13760  1.13685  1.13731    3522       8            0
2025-04-17 23:00:00  1.13732  1.13766  1.13615  1.13619    1848       8            0
2025-04-18 00:00:00  1.13614  1.13688  1.13587  1.13666     334      41            0
2025-04-18 01:00:00  1.13674  1.13709  1.13656  1.13675    3927       8            0
2025-04-18 02:00:00  1.13675  1.13747  1.13657  1.13727     701       8            0
2025-04-18 03:00:00  1.13727  1.13862  1.13611  1.13740    3889       8            0

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions