Function Error Unexpected
Page 1 of 732 12 LastLast
Results 1 to 10 of 311

Thread: Function Error Unexpected

  1. #1
    I am getting an error quot;work definition unexpectedquot; I typed it in to the search engine and couldn't find anything. . Does anybody know what I should be looking for to fix it and what this means?

  2. #2
    When you double click the error what line does it take you to? Additionally, attach your EA so people may help youwe will waste time imagining what the problem may be.

  3. #3
    As you may see, I am attempting to wash an old EA and enter my design to it and make it dynamic.... It will be challenging since I am not acquainted with this app language

    I'll be going one by one and incorporating alterations once I have a decent frame set up

    ==========================

    Edited it since I cleaned out a little more.... And went back through my notes also added more credits in it....
    https://www.forexsoutheast.asia/atta...2848662951.mq4

  4. #4
    In your beginning function you're missing 2 } which is causing your problem.

  5. #5
    Is there something or a program that will help with viewing the code's layout? It seems to me it would be easier to write in some other area and then move over to the MetaEditor since it's really tough to line up the brackets.... I added it to the end and it compiles but I am convinced it isn't properly aligned probably, and that I Will Need to take care of that when the guts of the beginning function change up

  6. #6
    No, that is the joy of working with mt4. Nothing that will assist you troubleshoot the code. I indie each one and would print it out and make sure that there is one to shut it out. Probably the most easy way.

    For a habit of mine, each time I open a new I set in two blank lines and set the opposing so I remember. I then go back and fill in the lines.

  7. #7
    Quote Originally Posted by ;
    As a custom of mine, every time I start a new I set in 2 blank lines and set the opposing therefore I remember. Then I go back and fill in the lines.
    That is exactly what I do too. And to facilitate indentation, I use the tab key a lot. It is equal to 3 spaces (configurable in options).

  8. #8
    Inserted Code for(cnt=0;cntlt;OrdersTotal();cnt ) if (OrderSelect(cnt, SELECT_BY_POS, MODE_TRADES)) if (OrderSymbol()==Symbol() OrderMagicNumber() == MagicNumber) if (OrderType()==OP_BUY Ok, I am trying to figure out logistically what exactly this is Performing... Either from a programming Perspective and a Forex trading Perspective

    It looks like It's counting the number of open trades, but I don't have a fullf grasp of the logic behind what is Actually being done here... here's my interpretation

    It's looking to see if there are Some opentrades... then if there are, It's checking the magic number/symbol combination.... Then if it's a market or limit order.... Then running a count of each... that the OrderSelect function is not explained to me clearly in the metratrader library

  9. #9
    Inserted Code And this Really Is the pseudo code logic that I am trying to implement... I'm Certain it may be Overlooking some checks, but basically, I want it to check if the currency is tradeable based on a market scan script... if it is then to only Let It have only one order Started per line

  10. #10

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.