Download MetaTrader 5

[HELP] Write/Read to files saved outside MT4 directories

To add comments, please log in or register
Take active part in the life of the community. Improve your rating!
InvestDad ADMIN
InvestDad ADMIN 2015.10.31 19:15 

Hello Gurus,

I am trying to write and read to files which are saved to C:\Folder instead of inside Metatrader 4 folders.

Since MT4 build +600, everything related to import external dd like kernel32 has changed the way they previously working well. Please see part of below code to help if you are successful. Great Thanks in advance :)

#property copyright "Copyright © 2011"
#property link      ""
#property indicator_chart_window
//| Custom indicator initialization function                         |

#import "kernel32.dll"
#define GENERIC_READ    0x80000000
#define GENERIC_WRITE   0x40000000
#define FILE_SHARE_READ                 0x00000001
#define FILE_SHARE_WRITE                0x00000002
#define FILE_SHARE_DELETE               0x00000004
#define CREATE_NEW      1
#define CREATE_ALWAYS   2
#define OPEN_EXISTING   3
#define OPEN_ALWAYS     4

double so_lot_buy=2.6, sl_buy=1.1010, target_buy=1.2010, so_lot_sell=1.2, target_sell=119.123, sl_sell=119.743;
string izzsl = "fgf", izzsh="sdfsdfa";

int CreateFileA(
      string   FileName,
      int      DesiredAccess,
      int      dwShareMode,
      int      lpSecurityAttributes,
      int      dwCreationDistribution,
      int      dwFlagsAndAttributes,
      int      hTemplateFile
qjol 2015.11.01 05:58  
int CreateFileW(
InvestDad ADMIN
InvestDad ADMIN 2015.11.01 07:41  

Thank for your suggestion. I will try asap when market returns to work next Monday then report back here. :)
whroeder1 2015.11.01 15:36  
InvestDad ADMIN
InvestDad ADMIN 2015.11.02 14:20  

Hello there,

I confirm that your suggestion to use CreateFileW() working great. Big Thanks :) 

To add comments, please log in or register