How do I make an EA quotquitquot?
Results 1 to 5 of 5

Thread: How do I make an EA quotquitquot?

  1. #1
    Does calling the deinit() work create an EA quit? How can I make an EA bail out or quit, for inistance in case it can't connect to such or a host?

  2. #2
    Quote Originally Posted by ;
    Does calling the deinit() work make an EA stop? How do I stop, for inistance if it can not connect to a host or such or make an EA bail out?
    In the start function, as the very first thing

    if (your creteria to stop == true) return(0);

    this may only stop it from doing anything past the if statement if it is true. The EA will not be removed by it from the platform.

  3. #3
    Thank you for the answer

    So if I call return(0) from init() from the startegy tester it will bail out?
    You can not prevent the beginning() function from running every tick so that you must specify your own standards.

    I think I get it now

  4. #4
    Quote Originally Posted by ;
    Thanks for the answer

    So if I call return(0) in init() from the startegy tester it will bail out?
    You can not stop the beginning() function from conducting every tick so that you must specify your own criteria.

    I believe I get it now
    No, return(0) in the init function will just transfer to the beginning() you must use it at first() to cause a loop without any instructions in the loop. The EA sits idle



    Your test in the if ( ... ) may be a call to another function where your tests are finished. Such as

    if (yourcriteria() == true) return(0);

    There are most likely others that are far more talented at MT4 programing than that, however. Perhaps one of these people understand how to cause itself to be removed by the EA.

  5. #5
    Quote Originally Posted by ;
    Thank you for the reply

    So if I call return(0) from init() in the startegy tester it'll bail out?
    Bail from init() yes. It then goes directly to start()

    you are able to use the IsConnected() function to discover if your own mt4 is connected to the broker's server.

    If you would like to know whether the EA is running on backtester, then you can use the IsTesting() function.

    A good illuion of what you will put at the first couple of lines of the start() function is.

    Inserted Code int start() if(IsTesting()) return(0); // ... additional codes ...
    ideally this will effectively disable backtesting of the EA. Not sure you'll need that though.

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.