Creating valid header for .fxt file

 
I wrote a Perl script to convert .csv tick-data files to .fxt. I've done alot of special coding (combine multiple CSV source files, etc) and can't use MT4 scripts to do the conversion; I need to use the Perl script I wrote.

I create the .fxt file OK, with a 600-byte header, but when I use it in the tester the file is rejected and a new file is created. I can view the file OK in "offline charts", I just can't use it in the tester; it recreates the file.

My question is: what fields/values are required in the header in order for MT4 to accept the fxt file (spread, tickvalue, etc)?

I found some information here: "importing tick data to history center" However, supplying the values listed in the C-code snippet didn't fix the problem.

Thanks for your help!
 
*BUMP*

Slawa, please respond if possible. Thanks!
 
Did You consider "MQL4: FXTHeader" and naming convention?
 
Yes, I looked at that file, thanks.

Does the ReadAndCheckHeader( ) function give a complete list of validations that MT4 performs when considering a fx4 file for validity? I'm trying to find out why MT4 is rejecting my file.

Thanks again!
 
i_bars must be more than 100 (first 100 bars are not modelled and must be written as is)

i_from and i_to members of section "for internal use" must be zeroed

//---- for internal use                                                                -------
int      i_from_bar=0;                               // 'fromdate' bar number          //  312 + 4
int      i_to_bar=0;                                 // 'todate' bar number            //  316 + 4
int      i_start_period[6];                                                            //  320 + 24
int      i_from=0;                                   // must be zero                   //  344 + 4
int      i_to=0;                                     // must be zero                   //  348 + 4
int      i_reserved[62];                             // unused                         //  352 + 248 = 600
 
As far as I know I'm doing all that.

May I zip and send you my .fxt file so you can analyze? Zipped it's 280k. I'm sure you could tell in a few seconds what is wrong.

Please provide an email address if that's OK.
 
stringo AT metaquotes DOT ru
 
Check header for:
i_lot_step>0
i_stops_level>0

Recommendations:
i_spread>0
i_lot_max>0
d_contract_size>0
d_tick_value>0
d_tick_size>0

All these values can be obtained by MarketInfo function. See first part of WriteHeader function for example
//---- FXT file header
   s_symbol=symbol;
   i_period=period;
   i_bars=0;
   s_currency=StringSubstr(s_symbol,0,3);
   i_spread=MarketInfo(s_symbol,MODE_SPREAD);
   i_digits=Digits;
   d_point=Point;
   i_lot_min=MarketInfo(s_symbol,MODE_MINLOT)*100;
   i_lot_max=MarketInfo(s_symbol,MODE_MAXLOT)*100;
   i_lot_step=MarketInfo(s_symbol,MODE_LOTSTEP)*100;
   i_stops_level=MarketInfo(s_symbol,MODE_STOPLEVEL);
   d_contract_size=MarketInfo(s_symbol,MODE_LOTSIZE);
   d_tick_value=MarketInfo(s_symbol,MODE_TICKVALUE);
   d_tick_size=MarketInfo(s_symbol,MODE_TICKSIZE);
   i_profit_mode=MarketInfo(s_symbol,MODE_PROFITCALCMODE);
   i_swap_type=MarketInfo(s_symbol,MODE_SWAPTYPE);
   d_swap_long=MarketInfo(s_symbol,MODE_SWAPLONG);
   d_swap_short=MarketInfo(s_symbol,MODE_SWAPSHORT);
   i_free_margin_mode=AccountFreeMarginMode();
   i_margin_mode=MarketInfo(s_symbol,MODE_MARGINCALCMODE);
   i_margin_stopout=AccountStopoutLevel();
   i_margin_stopout_mode=AccountStopoutMode();
   d_margin_initial=MarketInfo(s_symbol,MODE_MARGININIT);
   d_margin_maintenance=MarketInfo(s_symbol,MODE_MARGINMAINTENANCE);
   d_margin_hedged=MarketInfo(s_symbol,MODE_MARGINHEDGED);
   s_margin_currency=StringSubstr(s_symbol,0,3);
   i_from_bar=start_bar;
   i_start_period[0]=start_bar;
//----
Reason: