FX31337 / FX-BT-Scripts

:page_facing_up: Useful scripts for backtesting.
MIT License
34 stars 39 forks source link

convert_csv_to_mt.py: Missing `end_of_test` before `freeze_level`. #34

Closed kenorb closed 8 years ago

kenorb commented 8 years ago

This is what is in script:

    header += pack('<d', 1.25)                                                      # MarginDivider
    header += bytearray('EUR'.ljust(12, '\x00'), 'latin1', 'ignore')                # MarginCurrency
    header += bytearray(4)                                                          # 4 Bytes of padding
    # Commission calculation
    header += pack('<d', 0.0)                                                       # CommissionBase - basic commission
    header += pack('<i', 1)                                                         # CommissionType - basic commission type {COMM_TYPE_MONEY, COMM_TYPE_PIPS, COMM_TYPE_PERCENT}
    header += pack('<i', 0)                                                         # CommissionLots - commission per lot or per deal {COMMISSION_PER_LOT, COMMISSION_PER_DEAL}
    # For internal use
    header += pack('<i', 0)                                                         # FromBar - FromDate bar number
    header += pack('<i', 0)                                                         # ToBar - ToDate bar number
    header += pack('<6i', 1, 0, 0, 0, 0, 0)                                         # StartPeriod - number of bar at which the smaller period modeling started
    header += pack('<i', 0)                                                         # SetFrom - begin date from tester settings
    header += pack('<i', 0)                                                         # SetTo - end date from tester settings
    header += pack('<i', 0)                                                         # FreezeLevel - order's freeze level in points

and here is probably the correct version (see: fxt-405-refined.mqh):

  double            margin_divider;     // Margin divider.
  char              margin_currency[12];// Margin currency.
  // 420
  //---- Commission calculation.
  double            comm_base;          // Basic commission
  int               comm_type;          // Basic commission type          { COMM_TYPE_MONEY, COMM_TYPE_PIPS, COMM_TYPE_PERCENT }
  int               comm_lots;          // Commission per lot or per deal { COMMISSION_PER_LOT, COMMISSION_PER_DEAL }
  // 436
  //---- For internal use.
  int               from_bar;           // FromdAte bar number.
  int               to_bar;             // ToDate bar number.
  int               start_period[6];    // Number of bar at which the smaller period modeling started.
  int               set_from;           // Begin date from tester settings.
  int               set_to;             // End date from tester settings.
  // 476
  //----
  int               end_of_test;
  int               freeze_level;       // Order's freeze level in points.

The difference is between end_of_test which is missing in the script and 4 bytes of padding which probably are not there (based on the header file).

Can we find out which version is correct?

kenorb commented 8 years ago

I think it's fine now. Added extra integer for generating errors. a510b1a168e20252199f9c02e630007bd9a2727f