MT4 Files

Check-in [44f203c90d]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Changed default database to fxddx from testh2db
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1:44f203c90ddf021fb95b028c457e508c50c8f066
User & Date: onagano 2011-04-28 07:53:30
Context
2011-04-28
08:23
Rebind sequence of UIntTimetPointer has been changed check-in: 9e6246a280 user: onagano tags: trunk
07:53
Changed default database to fxddx from testh2db check-in: 44f203c90d user: onagano tags: trunk
03:35
getStatus now uses trade table, not status table check-in: ab4b49a269 user: onagano tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to experts/MOB_executeOrder.mq4.

51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
...
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
...
527
528
529
530
531
532
533

534
535
536
537
538
539
540
541
....
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
#define OPE_CLOSE          2
#define OPE_CLOSEBY        3
#define OPE_DELETE         4
#define OPE_MODIFY         5
#define OPE_DUMP_TRADES    6
#define OPE_DUMP_HISTORY   7
#define OPE_GET_ACCOUNT    8
#define OPE_GET_STATUS     9
#define OPE_COPY_RATES     10

#define ORD_DEFAULT_SLIPPAGE  3
#define MAX_ORDER_SIZE        100

//--- input parameters
extern string    ExtDataSourceName = "testh2db";
extern string    ExtUsername       = "";
extern string    ExtPassword       = "";
extern string    ExtTablePrefix    = "MOB_";
extern bool      ExtDebugPrint     = true;

//--- global variables
string orderTable       = "ORDER";
int    selectOrderStmt  = 0;
int    updateOrderStmt  = 0;

int      ordId[1];
................................................................................
         break;
      case OPE_DUMP_HISTORY:
         dumpTradesInTransaction(true);
         break;
      case OPE_GET_ACCOUNT:
         insertAccount();
         break;
      case OPE_GET_STATUS:
         getStatusInTransaction();
         break;
      case OPE_COPY_RATES:
         copyRates();
         break;
      default:
         setServerResponse(-1, "Unknown operation: " + ordOperation[0]);
      }
................................................................................
         bindOrderParameters();
      }
      rc = mob_executeStatement(updateOrderStmt);
      if (rc < 0) {
         mob_fetchedAll(selectOrderStmt);
         return (rc);
      }

      Print("Operation ", - ordOperation[0], " on ticket ", ordTicket[0],
         " has been done with #", ordErrorNumber[0], " (", ordErrorMessage, ")");
   }
   
   mob_fetchedAll(selectOrderStmt);
   
   return (rc);
}
................................................................................
      mob_rollback();
   } else {
      mob_commit();
   }
   mob_setAutoCommit(true);
}

int getStatus() {
   int rc = 0;
   rc = mob_executeStatement(deleteTradeStmt);
   // The row doesn't need to exist already.
   if (OrderSelect(ordTicket[0], SELECT_BY_TICKET)) {
      bindTradeParameters();
      if (ExtDebugPrint) dumpTradeParameters("getStatus");
      rc = mob_executeStatement(insertTradeStmt);
      if (rc < 0) {
         getDatabaseResponse();
         return (rc);
      }
   } else {
      getServerResponse();
   }
   return (rc);
}

void getStatusInTransaction() {
   mob_setAutoCommit(false);
   int rc = getStatus();
   if (rc < 0) {
      mob_rollback();
   } else {
      mob_commit();
   }
   mob_setAutoCommit(true);
}







|






|



|







 







|
|







 







>
|







 







|





|











|

|







51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
...
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
...
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
....
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
#define OPE_CLOSE          2
#define OPE_CLOSEBY        3
#define OPE_DELETE         4
#define OPE_MODIFY         5
#define OPE_DUMP_TRADES    6
#define OPE_DUMP_HISTORY   7
#define OPE_GET_ACCOUNT    8
#define OPE_GET_TRADE      9
#define OPE_COPY_RATES     10

#define ORD_DEFAULT_SLIPPAGE  3
#define MAX_ORDER_SIZE        100

//--- input parameters
extern string    ExtDataSourceName = "fxddx";
extern string    ExtUsername       = "";
extern string    ExtPassword       = "";
extern string    ExtTablePrefix    = "MOB_";
extern bool      ExtDebugPrint     = false;

//--- global variables
string orderTable       = "ORDER";
int    selectOrderStmt  = 0;
int    updateOrderStmt  = 0;

int      ordId[1];
................................................................................
         break;
      case OPE_DUMP_HISTORY:
         dumpTradesInTransaction(true);
         break;
      case OPE_GET_ACCOUNT:
         insertAccount();
         break;
      case OPE_GET_TRADE:
         getTradeInTransaction();
         break;
      case OPE_COPY_RATES:
         copyRates();
         break;
      default:
         setServerResponse(-1, "Unknown operation: " + ordOperation[0]);
      }
................................................................................
         bindOrderParameters();
      }
      rc = mob_executeStatement(updateOrderStmt);
      if (rc < 0) {
         mob_fetchedAll(selectOrderStmt);
         return (rc);
      }
      Print("ID #", ordId[0],
         " Operation #", - ordOperation[0], " on ticket #", ordTicket[0],
         " has been done with #", ordErrorNumber[0], " (", ordErrorMessage, ")");
   }
   
   mob_fetchedAll(selectOrderStmt);
   
   return (rc);
}
................................................................................
      mob_rollback();
   } else {
      mob_commit();
   }
   mob_setAutoCommit(true);
}

int getTrade() {
   int rc = 0;
   rc = mob_executeStatement(deleteTradeStmt);
   // The row doesn't need to exist already.
   if (OrderSelect(ordTicket[0], SELECT_BY_TICKET)) {
      bindTradeParameters();
      if (ExtDebugPrint) dumpTradeParameters("getTrade");
      rc = mob_executeStatement(insertTradeStmt);
      if (rc < 0) {
         getDatabaseResponse();
         return (rc);
      }
   } else {
      getServerResponse();
   }
   return (rc);
}

void getTradeInTransaction() {
   mob_setAutoCommit(false);
   int rc = getTrade();
   if (rc < 0) {
      mob_rollback();
   } else {
      mob_commit();
   }
   mob_setAutoCommit(true);
}

Changes to experts/MOB_insertData.mq4.

27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
int      mob_selectInt(string sql, int defaultVal);
datetime mob_selectDatetime(string sql, datetime defaultVal);
string   getPeriodSymbol(int period_XX);
datetime mob_time();
#import

//---- input parameters
extern string    ExtDataSourceName = "testh2db";
extern string    ExtUsername       = "";
extern string    ExtPassword       = "";
extern string    ExtTablePrefix    = "MOB_";

int      insertTick;
int      insertBar;
datetime lastTickTime;







|







27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
int      mob_selectInt(string sql, int defaultVal);
datetime mob_selectDatetime(string sql, datetime defaultVal);
string   getPeriodSymbol(int period_XX);
datetime mob_time();
#import

//---- input parameters
extern string    ExtDataSourceName = "fxddx";
extern string    ExtUsername       = "";
extern string    ExtPassword       = "";
extern string    ExtTablePrefix    = "MOB_";

int      insertTick;
int      insertBar;
datetime lastTickTime;