Welcome to Forex-TSD!, one of the largest Forex forums worldwide, where you will be able to find the most complete and reliable Forex information imaginable.
From the list below, select the forum that you want to visit and register to post, as many times you want. It’s absolutely free. Click here for registering on Forex-TSD.
Exclusive Forum
The Exclusive Forum is the only paid section. Once you subscribe, you will get free access to real cutting-edge Trading Systems (automated and not), Indicators, Signals, Articles, etc., that will help and guide you, in ways that you could only imagine, with your Forex trading.
Elite Section
Get access to private discussions, specialized support, indicators and trading systems reported every week.
Advanced Elite Section
For professional traders, trading system developers and any other member who may need to use and/or convert, the most cutting-edge exclusive indicators and trading systems for MT4 and MT5.
I'm builing an ea I can use over and over to make new ea from a standard format.
When I was recently inputting a holiday safety feature for interbankfx i created long ago, I decided to experiment a little with using functions.
Now, no matter what i do when i try to call two variables, (DayOff, and DayOffClose), from two functions i made, my opening logics compiles out, "variable not defined".
This leads me to believe it isn't returning the order integer in the closing logics either.
What am i doing wrong?
__________________
"One's ability to accomplish his or her goals is limited only by the ingenuity of how one uses what he or she already knows."- Eaglehawk
REMEMBER, "Genius is nothing but a greater aptitude for patience." –Benjamin Franklin
____________________________________
Have a simple ea you just can't figure out how to code??? Odds are you can make it here. Just remember to push complete when you're done, NOT SAVE!!! http://sufx.core.t3-ism.net/ExpertAdvisorBuilder
//+------------------------------------------------------------------+
//| Entry logics |
//+------------------------------------------------------------------+
{
HolidayAbandonTest();
HolidayTest();
}
if ((UseDayOff) && DayOff == False && DayOffClose == False)
//put in your entry logics between theese brackets
{
}
The variables DayOff and DayOffClose are not defined in the start function.
int goodfriday(gmonth, gday)
{
double cycledays = 29.5306;//approxamation of how long it takes the moon to return to a full moon
int month = 11;//last full moon was november 2006
You are going to need types for gmonth and gday (e.g. int).
//+------------------------------------------------------------------+
//| Entry logics |
//+------------------------------------------------------------------+
{
HolidayAbandonTest();
HolidayTest();
}
if ((UseDayOff) && DayOff == False && DayOffClose == False)
//put in your entry logics between theese brackets
{
}
The variables DayOff and DayOffClose are not defined in the start function.
int goodfriday(gmonth, gday)
{
double cycledays = 29.5306;//approxamation of how long it takes the moon to return to a full moon
int month = 11;//last full moon was november 2006
You are going to need types for gmonth and gday (e.g. int).
that just gives me more errors
Compiling 'Starter EA.mq4'...
'DayOff' - variable not defined C:\Documents and Settings\Tricia\Desktop\Currency Study\John's Metatrader 4\experts\Starter EA.mq4 (159, 26)
'DayOffClose' - variable not defined C:\Documents and Settings\Tricia\Desktop\Currency Study\John's Metatrader 4\experts\Starter EA.mq4 (159, 45)
'gmonth' - variable already defined C:\Documents and Settings\Tricia\Desktop\Currency Study\John's Metatrader 4\experts\Starter EA.mq4 (327, 11)
'gday' - variable already defined C:\Documents and Settings\Tricia\Desktop\Currency Study\John's Metatrader 4\experts\Starter EA.mq4 (328, 11)
'gmonth' - variable not defined C:\Documents and Settings\Tricia\Desktop\Currency Study\John's Metatrader 4\experts\Starter EA.mq4 (400, 16)
'gday' - variable not defined C:\Documents and Settings\Tricia\Desktop\Currency Study\John's Metatrader 4\experts\Starter EA.mq4 (400, 24)
'gmonth' - variable not defined C:\Documents and Settings\Tricia\Desktop\Currency Study\John's Metatrader 4\experts\Starter EA.mq4 (419, 22)
'gday' - variable not defined C:\Documents and Settings\Tricia\Desktop\Currency Study\John's Metatrader 4\experts\Starter EA.mq4 (419, 42)
'gday' - variable not defined C:\Documents and Settings\Tricia\Desktop\Currency Study\John's Metatrader 4\experts\Starter EA.mq4 (419, 63)
9 error(s), 0 warning(s)
__________________
"One's ability to accomplish his or her goals is limited only by the ingenuity of how one uses what he or she already knows."- Eaglehawk
REMEMBER, "Genius is nothing but a greater aptitude for patience." –Benjamin Franklin
____________________________________
Have a simple ea you just can't figure out how to code??? Odds are you can make it here. Just remember to push complete when you're done, NOT SAVE!!! http://sufx.core.t3-ism.net/ExpertAdvisorBuilder
Variable not defined means the variable is not defined at global or function level (as per my first reply) Variable already defined means you have defined the variable twice.
e.g.
int goodfriday(int gmonth, int gday)
{
double cycledays = 29.5306;//approxamation of how long it takes the moon to return to a full moon
int month = 11;//last full moon was november 2006
double day = 5;//last full moon was november 5, 2006
bool FullMoon = False;//self-explanatory
int gmonth = 0;//month good friday occurs in int gday = 0;//da
Variable not defined means the variable is not defined at global or function level (as per my first reply) Variable already defined means you have defined the variable twice.
e.g.
int goodfriday(int gmonth, int gday)
{
double cycledays = 29.5306;//approxamation of how long it takes the moon to return to a full moon
int month = 11;//last full moon was november 2006
double day = 5;//last full moon was november 5, 2006
bool FullMoon = False;//self-explanatory
int gmonth = 0;//month good friday occurs in int gday = 0;//da
With all do respect, that is exactly what i have done, i can tell you haven't payed attention to the small change in the code you suggested. i had already tried to do that several times before. I have a larger understanding of what i'm doing than you give me credit. and i research what i do, i've looked at both of those before, and i have skimmed through several c+ books. refrence alone can not gain skill in a single area of coding, or in coding as a whole, no refrence i have observed has givin an example of EVERY possible use for a tool mentioned, to do so would take extra time, and make their books and refrences much longer. if i am troubled by some errors with a compiler, i generally experiment obvious answers to solve them, i'm not someone who posts questions on this forem simply for every problem i am confronted with.
__________________
"One's ability to accomplish his or her goals is limited only by the ingenuity of how one uses what he or she already knows."- Eaglehawk
REMEMBER, "Genius is nothing but a greater aptitude for patience." –Benjamin Franklin
____________________________________
Have a simple ea you just can't figure out how to code??? Odds are you can make it here. Just remember to push complete when you're done, NOT SAVE!!! http://sufx.core.t3-ism.net/ExpertAdvisorBuilder
Fixed the compile errors, didn't have time to check the logic.
thank you tururo, i can deal with the logics now that i know what was wrong with the errors.
__________________
"One's ability to accomplish his or her goals is limited only by the ingenuity of how one uses what he or she already knows."- Eaglehawk
REMEMBER, "Genius is nothing but a greater aptitude for patience." –Benjamin Franklin
____________________________________
Have a simple ea you just can't figure out how to code??? Odds are you can make it here. Just remember to push complete when you're done, NOT SAVE!!! http://sufx.core.t3-ism.net/ExpertAdvisorBuilder
Thought you might say somthing like that, your code changes suggested you do not know what you are doing, all I am suggesting is you might benefit from learning some more programming fundimentals, I forward this as a helpful suggestion from somebody who has been down the same road, not as a put-down.
You are correct in that good programming skills come from practical experence, but you really need to understand (for example) how to declare a function properly before you start coding and you also need to understand the concept of variable scoping, this is gone over in the MQL documentation I have referenced, which you have so obvously NOT read.
I could have also fixed your errors for you, but what good does that do? you still have no idea why it was broken!! If you can't take some gentle proding in the direction of the facts, your not going to get very far...in fact why am I bothering even writing this because your only going to ignore it anyway...or tell me I'm full of shit...losing interest zzzzzzzzzz
Thought you might say somthing like that, your code changes suggested you do not know what you are doing, all I am suggesting is you might benefit from learning some more programming fundimentals, I forward this as a helpful suggestion from somebody who has been down the same road, not as a put-down.
You are correct in that good programming skills come from practical experence, but you really need to understand (for example) how to declare a function properly before you start coding and you also need to understand the concept of variable scoping, this is gone over in the MQL documentation I have referenced, which you have so obvously NOT read.
I could have also fixed your errors for you, but what good does that do? you still have no idea why it was broken!! If you can't take some gentle proding in the direction of the facts, your not going to get very far...in fact why am I bothering even writing this because your only going to ignore it anyway...or tell me I'm full of shit...losing interest zzzzzzzzzz
Wow... 5 post's and you are already being a jerk to someone like Eaglehawk? He's got 150+ posts here, and if you read more than 3 of them you would know how far out of line you are. Grow up.
__________________
"Only those who dare to fail greatly can ever achieve greatly."
Does the fact that he has posted here more than me mean that I have to avoid the truth? I have looked back though this posts, I'm not too sure what part of his posting is supposed to engender respect. He is trying to write EA's, fair enough, I just think he should have a better grasp of what he is doing from a coding point of view, this suggestion was made to help him, it's going to help him get where he wants to be is it not?
I offered help, he is the one that did his nut when I suggested some research. I don't see what is immature on my part. Quite the opposite in fact.