Giter Site home page Giter Site logo

Comments (7)

LemonBoy avatar LemonBoy commented on August 28, 2024

Something like [1] ? It provides some glue for MQL5's missing functions, I did test it with a simple script and it works just fine and moth MQL{4,5} found no syntax errors.

[1] https://ptpb.pw/IF5x

from ea31337-classes.

kenorb avatar kenorb commented on August 28, 2024

@LemonBoy Sorry for a late reply. Yes, however I expect those methods wrapped in the class, so I could call the methods consistently from the other file without having worrying about #ifdef outside of the class or in which version the main MQL file is compiled. In other words I just want to call DateTime::Day() (or by class instance) from both MQL4/MQL5 file and I expect the same result.

For example the code structure should be:

class DateTime {

  int Day() {
    #ifdef __MQL5__
      MqlDateTime dt;
      TimeCurrent(dt);
      return(dt.day);
    #else
      return Day();
    #endif
  }

  // ... more methods
}

where the methods are replication of MQL4 functions and at the same time they're compatible with MQL5 as well. In DateTime class just use only the function related to date time (so the rest non-relevant part can be removed). This is just initial idea, once the format would be consistent, I'll later provide more classes to write, related to specific functions.

from ea31337-classes.

LemonBoy avatar LemonBoy commented on August 28, 2024

So, something like this [1] ?

[1] https://ptpb.pw/jaGL

from ea31337-classes.

kenorb avatar kenorb commented on August 28, 2024

That's correct. I think making indentation for #ifdef would look better if it's aligned with the code (the code would be more readable). Check for other missing date related functions as well. If there is any blocker function that can't be ported easily, add @todo for MQL5 so you may ignore.

from ea31337-classes.

LemonBoy avatar LemonBoy commented on August 28, 2024

TimeTradeServer has been added in MQL5 and has no equivalent for MQL4, I'll shift the # tokens once I submit a PR. The other options I didn't bring into the class are the ones that are available for both the versions and making a wrapper sounds quite pointless, no ?

from ea31337-classes.

kenorb avatar kenorb commented on August 28, 2024

If TimeTradeServer not there in MQL4, you can still define the method, then return the value for MQL5 but NULL for MQL4 with some code comment (todo), probably this won't be used anyway.

from ea31337-classes.

kenorb avatar kenorb commented on August 28, 2024

Looks fine. I'll test it later on. Thanks.

from ea31337-classes.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.