Sign Up

Have an account? Sign In Now

Sign In

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask question.

Forgot Password?

Need An Account, Sign Up Here
Sign InSign Up

First independent community of traders

First independent community of traders Logo First independent community of traders Logo

First independent community of traders Navigation

  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • Buy Theme
  • Home
  • About Us
  • Blog
  • Contact Us
Home/ Questions/Q 2339
Next
In Process
twg
twg

twg

  • 2 Questions
  • 2 Answers
  • 0 Best Answers
  • 20 Points
View Profile
  • 0
twg
Asked: December 26, 20202020-12-26T12:12:47+00:00 2020-12-26T12:12:47+00:00In: Forex Expert Advisors

clone object?

  • 0

Hello everyone The situation is such that the expert Advisor used an array of pointers to the object
class – all is well:

MyClass{
        public:
int a;

void MyClass(int i){
this.a=i;
}

                
void test()
{
Print("test: "+(string)this.a);
}
};

MyClass *test[];
int size=10;
ArrayResize(test, size);

for(int i=0; inew MyClass(i);
}

Then I quietly deleted them with the delete statement

for(int i=0; idelete test[i];
}
ArrayResize(test, 0);

But the new feature, now I don’t need to remove the entire array, and leave some of them, I was looking up how to clone an object not found, I searched both
to reindex the array is also not found… I need about the implementation of a trail situation:

for(int i=0; i2){
        delete test[i];
}

//we get
//test[1] object
//test[3] object
//test[5] object
//test[7] object
//test[9] object

//Here you need to somehow reindex the entire array test[] and get the output

test[0].test(); //1
test[1].test(); //3
test[2].test(); //5
test[3].test(); //7
test[4].test(); //9

Tell me how to implement this in mql4?
 

  • 4 4 Answers
  • 0 Followers
  • 0
Answer
Share
  • Facebook

    4 Answers

    • Voted
    • Oldest
    • Recent
    1. twg

      twg

      • 2 Questions
      • 2 Answers
      • 0 Best Answers
      • 20 Points
      View Profile
      twg
      2020-12-26T12:13:08+00:00Added an answer on December 26, 2020 at 12:13 pm

      Thank you all – I figured it out! I just deleted the buffer array ahead of time, as a result of which I cleaned the main pointers and got invalid pointer
      access

      … here is a purely Russian approach.

      Memory leaks are fixed! =)

      • 0
      • Reply
      • Share
        Share
        • Share on Facebook
        • Share on Twitter
        • Share on LinkedIn
        • Share on WhatsApp
    2. denkir

      denkir

      • 0 Questions
      • 9 Answers
      • 0 Best Answers
      • 38 Points
      View Profile
      denkir
      2020-12-26T12:13:01+00:00Added an answer on December 26, 2020 at 12:13 pm

      Matvey Alekseev:

      Hello everyone The situation is such that the adviser used an array of pointers to

      object
      class – all is well:

      Then I quietly deleted them with the delete statement

      But here’s a new Fitch, now I don’t have to delete the entire array, but
      leave some of them, I was looking for how to clone an object – not found, I was looking for how to reindex an array-also not found… I need
      roughly implementing a trace of the situation:

      Tell me how to implement this in mql4?
       

      A typical task for a list. Take a closer look at the appropriate class.
      In MQL4, it also works.

      • 0
      • Reply
      • Share
        Share
        • Share on Facebook
        • Share on Twitter
        • Share on LinkedIn
        • Share on WhatsApp
    3. tara

      tara

      • 0 Questions
      • 9 Answers
      • 0 Best Answers
      • 38 Points
      View Profile
      tara
      2020-12-26T12:12:55+00:00Added an answer on December 26, 2020 at 12:12 pm

      Nothing works at all.

      • 0
      • Reply
      • Share
        Share
        • Share on Facebook
        • Share on Twitter
        • Share on LinkedIn
        • Share on WhatsApp
    4. igorm

      igorm

      • 0 Questions
      • 17 Answers
      • 0 Best Answers
      • 54 Points
      View Profile
      igorm
      2020-12-26T12:12:52+00:00Added an answer on December 26, 2020 at 12:12 pm

      Matvey Alekseev:

      Tell me how to implement this in mql4?
       

      today, the search does not work, I also dealt with this issue last year, the search for my typedef messages should be found

      or as an option, I posted a panel in C# in the blog, there I also tied it to an array of function pointers-almost one – to-one as Your task

      • 0
      • Reply
      • Share
        Share
        • Share on Facebook
        • Share on Twitter
        • Share on LinkedIn
        • Share on WhatsApp
    Leave an answer

    Leave an answer
    Cancel reply

    Browse

    Sidebar

    Ask A Question

    Stats

    • Questions 504
    • Answers 2k
    • Posts 5
    • Comments 0
    • Best Answers 0
    • Users 677
    • Popular
    • Comments
    • Tags
    • forexcommunity

      Highlighting what’s important about questions & Answers on Discy Community!

      • 0 Comments
    • forexcommunity

      Introducing Keyboard Shortcuts, our first Labs feature

      • 0 Comments
    • forexcommunity

      Defining quality on Discy Engine — what a helpful answer ...

      • 0 Comments
    • forexcommunity

      Organizational and company accounts on Discy Engine the next step

      • 0 Comments
    • forexcommunity

      Hello world!

      • 0 Comments

    Related Questions

    • Brus Agell

      Правельный выбор

      • 0 Answers
    • pinupcasinoo

      Pin Up Casino

      • 0 Answers
    • c00l777

      During optimization, indicators that are not present in the robot ...

      • 2 Answers
    • c00l777

      During optimization, indicators that are not present in the robot ...

      • 0 Answers
    • c00l777

      Optimization results differ on different accounts

      • 3 Answers

    Users

    HiramJanny

    HiramJanny

    • 0 Questions
    • 0 Answers
    Geraldimaky

    Geraldimaky

    • 0 Questions
    • 0 Answers
    Jeffreytix

    Jeffreytix

    • 0 Questions
    • 0 Answers

    Footer

    First independent community of traders

    About

    An independent community of forex traders. This is where traders communicate. You can ask your questions and you will receive an answer to your question.
    • Terms of Use
    • Privacy Policy
    • Cookie Policy
    • Knowledge Base
    • Support

    © 2021 Forexcommunity.net. All Rights Reserved