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

Back to topics list To post a new topic, please log in or register
avatar
28
InvestDad 2015.10.31 20: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
#define INVALID_HANDLE -1

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
);   

 

avatar
3134
qjol 2015.11.01 06:58 #
 
int CreateFileW(

avatar
28
InvestDad 2015.11.01 08:41 #
 
qjol:

Thank for your suggestion. I will try asap when market returns to work next Monday then report back here. :)
avatar
13006
WHRoeder 2015.11.01 16:36 #
 
avatar
28
InvestDad 2015.11.02 15:20 #
 
qjol:

Hello there,

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

Back to topics list  

To add comments, please log in or register