HomeSample Page

Sample Page Title


Beneath are the required recordsdata to make use of the MML Information Bridge

dataStructs.mqh

#ifndef dataStructs
#outline dataStructs


#outline CHAR_FIELD_WIDTH 128 




struct DIRECTION {
    datetime time;
    int sign;
};


struct BTC_DATA {
    datetime time;
    double actual_price;
    double predicted_price;
    double price_residual;
    double price_error_pct;
    double actual_return;
    double predicted_return;
    double return_residual;
    double direction_correct;
    char dataset_name[CHAR_FIELD_WIDTH];
};

#endif 


MMLUtility.mqh

#property strict
#embrace <dataStructs.mqh>



#import "MMLDataBridge.ex5"
  
  void initializeBridge_internal(string eaName);  
  void shutdownBridge_internal();  
 bool getRecordBytes_internal(const string csvFileName, uchar &out[]); 
  string CStrFromCharArray(const char &arr[], int max_len = CHAR_FIELD_WIDTH);
#import




void initializeBridge(string eaName){
 initializeBridge_internal(eaName);
}


void shutDownBridge() { 
  shutdownBridge_internal();
}


string CharArrayToStr(const char &arr[]) { 
  return CStrFromCharArray(arr); }




template<typename T>
bool returnData(const string csvFileName, T &out) {
   
   uchar bytes[];
   if (!getRecordBytes_internal(csvFileName, bytes))
      return false;

   const int want = sizeof(out);
   const int have = ArraySize(bytes);

   if (have != want) {
      if (have > want) {
         PrintFormat("MML Information Bridge: Struct measurement mismatch for '%s'", csvFileName);
         Print("   Your struct is lacking %d area(s) or has incorrect area varieties.");
         PrintFormat("   Resolution: Add lacking area(s) to your struct or verify area information varieties");
         
         return false;
      } else {
         PrintFormat("MML Information Bridge: Struct measurement mismatch for '%s'", csvFileName);
         PrintFormat("   This implies your struct has %d additional area(s) or incorrect area varieties");
         PrintFormat("   Resolution: Take away additional area(s) out of your struct or verify area information varieties");
         
         return false;
      }
   }

   
   return CharArrayToStruct(out, bytes, 0);
}

Related Articles

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Latest Articles