Learn New MQL Coding - Page 9
Page 9 of 509 FirstFirst ... 789
Results 81 to 87 of 87

Thread: Learn New MQL Coding

  1. #81
    Dear people,

    I understand that nobody is looking at this thread . However, for those who should eventually discover it in the long run, as I did, please have some debug already done.

    In place #39, when placing two moving averages together, there's a mistake in the submitted MyMovingAverage.mqh file. The MyMovingAverage:Compute definition is wrong, because the change statement slips consistently in the exponential average calculation. Please take care and insert a break bewtween the SMA and the EMA cubes like this:

    Inserted Code switch(m_Method){ case MODE_SMA: switch(m_AppliedPrice) case PRICE_OPEN: ComputeSma(totalrates, prevcalcd, available ); split; situation PRICE_HIGH: ComputeSma(totalrates, prevcalcd, high); split; situation PRICE_LOW: ComputeSma(totalrates, prevcalcd, low); split; situation PRICE_CLOSE: ComputeSma(totalrates, prevcalcd, close); split; split; situation MODE_EMA: switch(m_AppliedPrice) case PRICE_OPEN: ComputeEma(totalrates, prevcalcd, available ); split; situation PRICE_HIGH: ComputeEma(totalrates, prevcalcd, high); split; situation PRICE_LOW: ComputeEma(totalrates, prevcalcd, low); split; situation PRICE_CLOSE: ComputeEma(totalrates, prevcalcd, close); split;
    This is for prevent to others debugging time. I hope Broketrader you do not get hurted because of this. Your work was anyway very strong and useful, sorry.

  2. #82
    Hi betterlife and sorry for replying so late...

    For the ArraySetSeries question, well I believe I was making some tests and forgot to restore the appropriate code, I must dive right into the code actually to truly confirm this but simply don't have time at this moment...

    Concerning some other questions...

    1) Production of object pointers isn't compulsory at all, you could absolutely utilize automatic factors but the use of pointers gives you the possibility to pass them in to functions or other object methods. Thing which you cannot do if using automatic factors as you cannot pass references in MQL.

    Two ) Passing argument as const implies that you prohibit the function or method of which you pass the argument to alter the source data. This can be helpful when passing pointers.

    Great job for the switch statement mistake, I did not see it!

    And don't worry, there's no offend at all.

    Thank you !

  3. #83
    Thank you very much Broketrader, and apologies for my late response also.
    Your ribbon is really fine and I am going on in studying, utilizing it as functional examples while reading the Eckel's Bible of C . I am in the course of an intriguing project hoping to creating indiors modular, so you can pass the value to one into another and then into another and so on... Without using iCustom, of course, that can be pretty wasteful.

    On a negative note, I also shifted all of the MyMovingAverage:Initialize method of the code in place #39 inside the constructor of MyMovingAverage itself. Folks state that the constructor was devised exactly for avoiding people to be forced of using initialization purposes... It works!

  4. #84
    Hi,
    I want to pass an array from 1 indior document to some other indior. Can somebody pls. Guide on how to do it thru MQL code?
    I utilize Globalvariable Get- Establish departure simple factors between indiors. But don't have any hint about arrays.

    Due
    Best Wishes,

  5. #85
    Quote Originally Posted by ;
    Thank you very much Broketrader, and apologies for my late reply also. Your thread is actually nice and I am going on in analyzing, utilizing it as practical examples while reading the Eckel's Bible of C . I am in the course of an intriguing project trying to creating indiors modular, so you can pass the value to one into another and then into another and so on... Without using iCustom, of course, which can be pretty inefficient. On a side note, I also altered all the MyMovingAverage:Initialize way of your code in place #39 inside the constructor...
    Hi betterlife,
    Studying C is the way to go, good fortune and a lot of pleasure, do not hesitate if you've got questions.

    Concerning the constructors, well, in reality it is dependent upon the context. For instance you could require an initialization method when you build your object just once but need to reset (reinitialize it) several times a program implementation instead of deleting it and creating a new one, you see the gap?

    Quote Originally Posted by ;
    Hi, I want to pass a range from 1 indior document to another indior. Can somebody pls. Guide on how to do it thru MQL code? I utilize Globalvariable Get- Set for passing simple variables between indiors. But have no hint about passing arrays. Thanks Best wishes,
    Hi Tilltheend,
    I never had to pass arrays between indiors and do not actually have a solution for you but I see two possible solutions you could explore:
    1) Merge both indiors into a single, then no difficulty in sharing anything.
    2) Use a C DLL to share data between them but I am not certain this will be possible.

  6. #86
    Quote Originally Posted by ;
    quote Hi Tilltheend, I never needed to pass arrays involving indiors and don't really have a solution for you but I see 2 possible solutions you could investigate: 1) Merge your two indiors into a single, then no difficulty in sharing anything. 2) Utilize a C DLL to share information between them but I am not sure this is possible.
    When the sender is an indior, a solution is to pass the factors through buffers and retrievable by the other indior through iCustom().

  7. #87
    Quote Originally Posted by ;
    quote If the sender is an indior, a solution would be to pass the variables via buffers and retrievable by another indior via iCustom().
    Broketrader/....Thanks for replies....as of now I am trying to merge 2 indiors into 1; This looks less cumbersome than other options

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
This website uses cookies
We use cookies to store session information to facilitate remembering your login information, to allow you to save website preferences, to personalise content and ads, to provide social media features and to analyse our traffic. We also share information about your use of our site with our social media, advertising and analytics partners more information