'.' - name expected

Back to topics list To post a new topic, please log in or register
avatar
6
whatrat 2016.06.28 18:07
 

I keep getting this error when trying to compile:


If the image is unclear, this is the link to the screenshot: https://i.gyazo.com/462889da7d1568ff1a55a76fc2d562a7.png

It's the DoTick line called DowGap.

What's causing it is that I used another, working file (for DAX) as a template, changed the inputs like time and stops to fit for DOW, changed all instances of "DaxGap" on the file from to DowGap.

DaxGap works fine as always, DowGap won't compile. Why am I getting this error? And how do I fix it?

I have the programming skills of a Regalian Dung Beetle, hope somebody can help :/

EDIT: Code file attached
Attached files:
  dowgap_1.mq4  (13.29 KB)
avatar
12998
WHRoeder 2016.06.28 19:20 #
 

How can we answer when you don't provide the code (using SRC?) There are no mind readers here.

Is DowGap a class, then DowGap.fcn() is wrong, just as double.fcn() is wrong.

avatar
6
whatrat 2016.06.28 21:09 #
 

Sorry about that, I didn't even know you'd need to see the whole thing. That's what I meant when I said I'm a programming imbecile, a Tarkalian field mouse has more intellectual prowess than I do. Hell, I don't even know what an SRC means, or an FCN, something to do with rifle associations... But I'll just paste the whole code here, thanks in advance :) :

EDIT: Attached

avatar
1213
FMIC 2016.06.28 23:56 #
 

After taking a look at your code I see that "DowGap" is a class and that you instantiated an object variable of that class with the exact same name, namely "DowGap". The problem is that, even though technically allowed, how would you expect the compiler to know the difference between the "class" and the "object" when both have the same name? Consider changing one of them or both. Here is an example implementation:

// Define the DowGap class
class classDowGap
{
   ...
};

// Instantiate an object of the DowGap class (as a globally scoped variable).
classDowGap objDowGap;

void OnTick()
{
   objDowGap.DoTick();   // Call a method of the DowGap object
}

As for other possible errors or warnings, I am unable to check because the supplied code, is missing an include file "SaadIncl.mqh". For now, that include file is not needed if this is the only problem you wish solved, but should there be other difficulties that require us to compile the code in order to analyse it, it may become necessary.

avatar
6
whatrat 2016.06.29 10:29 #
 

Thanks FMIC,

Is there anywhere in particular I should paste that code after changing the names? I pasted it at the end but compiling it gave me a whole load more errors, including still "name expected". Originally the name expected error was the only error it was producing.

I've attached the SadIncl.mqh file if that helps. This file was meant for a bot called DaxGap to which it works perfectly, it's just using that bot as a template to make other bots that is messing things up.

Regards 

avatar
1213
FMIC 2016.06.29 11:11 #
 
whatrat:

Is there anywhere in particular I should paste that code after changing the names? I pasted it at the end but compiling it gave me a whole load more errors, including still "name expected". Originally the name expected error was the only error it was producing.

You misunderstand! My code example is not to be pasted anywhere. It was an example of how you should modify your own code. Here is a more detailed explanatory example (and the complete code attached, with these changes applied):

class classDowGap      // Line  53: was originally "class DowGap"
{
   public:
      classDowGap() :  // Line  73: was originally "DowGap() :"
}

classDowGap objDowGap; // Line 379: was originally "DowGap DowGap;"

void OnTick()
{
   objDowGap.DoTick(); // Line 425: was originally "DowGap.DoTick();"
}
Attached files:
  dowgap_2.mq4  (13.48 KB)
avatar
6
whatrat 2016.06.29 11:25 #
 
Thanks for that. I did say I'm a programming imbecile. Your attachment has compiled properly now, DOW opens later today so I'll let you know how it runs.
avatar
6
whatrat 2016.06.29 15:41 #
 

So the file compiled, but as I feared, it didn't solve another problem I was having when making this new bot from my first template - it still doesn't trigger at the DOW open.

My hunch is that it's something to do with it's connection to the SadIncl.mqh file, which was a file I had created to specifically serve my first mq4 bot called DaxGap.

I think somehow the new DowGap.mq4 is incompatible with the SadIncl.mqh file, and simply replacing all instances of "DaxGap" with "DowGap" inside the dowgap.mq4 file isn't enough.

Maybe I was naive to think it would be so straightforward, but I must admit I'm at a loss to make this DowGap bot work now... Pretty please help a neanderthal like me?

avatar
1213
FMIC 2016.06.29 17:01 #
 
whatrat:

So the file compiled, but as I feared, it didn't solve another problem I was having when making this new bot from my first template - it still doesn't trigger at the DOW open.

My hunch is that it's something to do with it's connection to the SaadIncl.mqh file, which was a file I had created to specifically serve my first mq4 bot called SaadGap.

I think somehow the new DowGap.mq4 is incompatible with the SaadIncl.mqh file, and simply replacing all instances of "SaadGap" with "DowGap" inside the dowgap.mq4 file isn't enough.

Maybe I was naive to think it would be so straightforward, but I must admit I'm at a loss to make this DowGap bot work now... Pretty please help a neanderthal like me?

Before continuing, please tell us your exact level of proficiency in coding! I know that using flourishes like "Regalian Dung Beetle", "Tarkalian field mouse" and "neanderthal" are all quite entertaining but they do not objectively describe your coding skill level or knowledge.

If in fact, your level of coding is extremely limited, as I suspect from your "where do I paste it" comment, I am afraid that our guidance and suggestions may be beyond your capabilities. Should that be the case, it may be more productive for you to consider hiring someone to code it for you instead, but making sure that the source code be part of the agreement so that you can then learn from it.

Should you decide on that route, you can use the Freelance section and have coders bid on the job request. Should you wish, you can also contact me via a private message (just click on my user link and then on "Send Message).

avatar
6
whatrat 2016.06.29 18:04 #
 

Yes it is all beyond me. But good news... I thought it wasn't working but actually it was working fine, my clock was simply running fast.

So a big thank you to you FMIC! You got my bot working and I can go and make some money with it now.

Best regards

Back to topics list  

To add comments, please log in or register