Forex



Go Back   Forex Trading > Downloads > Expert Advisors - Metatrader 4
Forex Forum Register More recent Calendar Advertising Others Help






Register
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.
See more

Reply
 
Thread Tools Display Modes
  #1 (permalink)  
Old 11-07-2006, 03:15 AM
Eaglehawk's Avatar
Senior Member
 
Join Date: Jun 2006
Posts: 141
Eaglehawk is on a distinguished road
Question recalling functional errors

i am still working on programming good friday. but i happilly announce i am on the last step! (horray!)

i constantly have been double checking to make sure that this function has been spitting out the correct dates, but time and time again i get up to three diffrent dates each year, after modification and modification, and small adjustment after small adjustment to no avail.


here are the dates i'm wanting it to return.

04/07/04
04/27/05
04/19/06

here's the function

PHP Code:
int goodfriday(int gmonthint gday)
 {
      
double cycledays 29.5306;//approxamation of how long it takes the moon to return to a full moon
      
int month 12;//starting full moon is in December
      
double day 9;//starting full moon in in December 9
      
bool FullMoon False;//self-explanatory
      
int year 1990;//starting full moon is in December 9, 1990
      
gmonth 0;//month good friday occurs in
      
gday 0;//day of the month good friday occurs
      
int Mday 0;//number of days in february, determined below
      
double day2 0;//value used to seperate the decimal from the day's value
      
int day3 0;//full moon's day withought decimals
      
bool Goccur False;//makes sure good friday already hasn't occured this year
       
       
{

         
//beginning time of the full moon
         
if (Month() == month && Day() == day && Year() == year)
         {
          
FullMoon True;
         }
         else
         {
          
FullMoon False;
         }
         
         
// cycles through the days to determine the next full move
         
if (Month() == month && Day() == day cycledays && Year() == year)
          {
           
FullMoon True;
          }

         
//continues the cycle for the months with 31 days in them
         
if ((Month() == || Month() == || Month() == || Month() == || Month() == || Month() == 10 || Month() == 12) && day cycledays 31)
         {
          
month++;
          
day day cycledays 31;
         }

         
//continues the cycle for the months with 30 days in them
         
if ((Month() == || Month() == || Month() == || Month() == 11) && day cycledays 30)
         {
          
month++;
          
day day cycledays 30;
         }

         
//resets the months after december is over
         
if (month 12)
         {
          
month 1;
          
year++;
         }

         
//expression determines if we are in a leap year to determine whether there are 28 or 29 days in february
         
if (Month() == 2)
           {if ((
MathMod(Year(),4) == 0) && (((MathMod(Year(),100) == 0) && (MathMod(Year(),400) == 0)) || (MathMod(Year(),100) != 0))) Mday 29; else Mday 28;}

         
//resets the days after february finishes
         
if (Month() == && day cycledays Mday)
          {
           
month++;
           
day day cycledays Mday;
          }

         
//determines what difference is required to round the day count down to an integer
         
{day2 = (NormalizeDouble(day,0) - NormalizeDouble(day,4));}
         
         
//expression rounds the day value down to an integer
         
if (MathRound(day2) == 1)
          {
          
day3 day day2;
          }
         
         
//determines exact day of full moon 
         
if((day3 == Day()) && (month == Month()))
          {
           
FullMoon True;
          }
          
          
//last string of code translates good friday from the phases of the moon
         
if(Goccur == False && ((Month() == && Day() > 21) || Month() == 4) && DayOfWeek() == && (Day() + day3))
           {
            
gmonth Month();
            
gday Day();          
            Print (
"Today is Good Friday");
            
Goccur True;
           }
         
         
//resets Goccur each year
         
if(Month() == 12)
           {
           
Goccur False;
           }
       }
 } 
and here's a few quick explenations.

i made day3 equal to the day when the full moon occurs, withought the decimal. (integer)

Goccur is supposed to be used to only allow 1 good friday per year, but it's not hard to notice it's not working the way i wanted it to.

variables day and month are the day and month a full moon occurs.
Attached Files
File Type: txt Tester results.txt (39.0 KB, 11 views)
__________________
"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

Last edited by Eaglehawk; 11-07-2006 at 05:22 AM.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!StumbleUpon this Post!Reddit this Post!Facebook this Post!BlinkList this Post!Google Bookmarks this Post!Yahoo! My Web this Post!
Reply With Quote
  #2 (permalink)  
Old 11-07-2006, 05:47 AM
Eaglehawk's Avatar
Senior Member
 
Join Date: Jun 2006
Posts: 141
Eaglehawk is on a distinguished road
Arrow

Quote:
Originally Posted by Eaglehawk
i am still working on programming good friday. but i happilly announce i am on the last step! (horray!)

i constantly have been double checking to make sure that this function has been spitting out the correct dates, but time and time again i get up to three diffrent dates each year, after modification and modification, and small adjustment after small adjustment to no avail.


here are the dates i'm wanting it to return.

04/07/04
04/27/05
04/19/06

here's the function

PHP Code:
int goodfriday(int gmonthint gday)
 {
      
double cycledays 29.5306;//approxamation of how long it takes the moon to return to a full moon
      
int month 12;//starting full moon is in December
      
double day 9;//starting full moon in in December 9
      
bool FullMoon False;//self-explanatory
      
int year 1990;//starting full moon is in December 9, 1990
      
gmonth 0;//month good friday occurs in
      
gday 0;//day of the month good friday occurs
      
int Mday 0;//number of days in february, determined below
      
double day2 0;//value used to seperate the decimal from the day's value
      
int day3 0;//full moon's day withought decimals
      
bool Goccur False;//makes sure good friday already hasn't occured this year
       
       
{

         
//beginning time of the full moon
         
if (Month() == month && Day() == day && Year() == year)
         {
          
FullMoon True;
         }
         else
         {
          
FullMoon False;
         }
         
         
// cycles through the days to determine the next full move
         
if (Month() == month && Day() == day cycledays && Year() == year)
          {
           
FullMoon True;
          }

         
//continues the cycle for the months with 31 days in them
         
if ((Month() == || Month() == || Month() == || Month() == || Month() == || Month() == 10 || Month() == 12) && day cycledays 31)
         {
          
month++;
          
day day cycledays 31;
         }

         
//continues the cycle for the months with 30 days in them
         
if ((Month() == || Month() == || Month() == || Month() == 11) && day cycledays 30)
         {
          
month++;
          
day day cycledays 30;
         }

         
//resets the months after december is over
         
if (month 12)
         {
          
month 1;
          
year++;
         }

         
//expression determines if we are in a leap year to determine whether there are 28 or 29 days in february
         
if (Month() == 2)
           {if ((
MathMod(Year(),4) == 0) && (((MathMod(Year(),100) == 0) && (MathMod(Year(),400) == 0)) || (MathMod(Year(),100) != 0))) Mday 29; else Mday 28;}

         
//resets the days after february finishes
         
if (Month() == && day cycledays Mday)
          {
           
month++;
           
day day cycledays Mday;
          }

         
//determines what difference is required to round the day count down to an integer
         
{day2 = (NormalizeDouble(day,0) - NormalizeDouble(day,4));}
         
         
//expression rounds the day value down to an integer
         
if (MathRound(day2) == 1)
          {
          
day3 day day2;
          }
         
         
//determines exact day of full moon 
         
if((day3 == Day()) && (month == Month()))
          {
           
FullMoon True;
          }
          
          
//last string of code translates good friday from the phases of the moon
         
if(Goccur == False && ((Month() == && Day() > 21) || Month() == 4) && DayOfWeek() == && (Day() + day3))
           {
            
gmonth Month();
            
gday Day();          
            Print (
"Today is Good Friday");
            
Goccur True;
           }
         
         
//resets Goccur each year
         
if(Month() == 12)
           {
           
Goccur False;
           }
       }
 } 
and here's a few quick explenations.

i made day3 equal to the day when the full moon occurs, withought the decimal. (integer)

Goccur is supposed to be used to only allow 1 good friday per year, but it's not hard to notice it's not working the way i wanted it to.

variables day and month are the day and month a full moon occurs.
last problem solved, new one found!

2006.11.06 22:44:53 2006.03.22 00:00 Starter EA EURUSD,Daily: Today is Good Friday
2006.11.06 22:44:41 2005.03.23 00:00 Starter EA EURUSD,Daily: Today is Good Friday
2006.11.06 22:44:25 2004.03.24 00:00 Starter EA EURUSD,Daily: Today is Good Friday
2006.11.06 22:44:20 Starter EA inputs: MagicNumber=0; Lots=0.1; Slippage=3; StopLoss=5; TakeProfit=30; TrailingStop=15; MaxOpenTrade=1;
2006.11.06 22:44:13 Starter EA EURUSD,Daily: loaded successfully


now i get the Goccur to work right, but now i'm getting the wrong dates.

don't have time to solve the problem now, may need assistance, may not. i'll keep everyone posted
__________________
"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
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!StumbleUpon this Post!Reddit this Post!Facebook this Post!BlinkList this Post!Google Bookmarks this Post!Yahoo! My Web this Post!
Reply With Quote
  #3 (permalink)  
Old 11-07-2006, 11:20 AM
Member
 
Join Date: Aug 2006
Posts: 56
JosTheelen is on a distinguished road
Will this help?
http://kenhamady.com/form25.shtml
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!StumbleUpon this Post!Reddit this Post!Facebook this Post!BlinkList this Post!Google Bookmarks this Post!Yahoo! My Web this Post!
Reply With Quote
  #4 (permalink)  
Old 11-07-2006, 10:49 PM
Eaglehawk's Avatar
Senior Member
 
Join Date: Jun 2006
Posts: 141
Eaglehawk is on a distinguished road
Quote:
Originally Posted by JosTheelen
oy yoi yoi, no comments. i don't do well with reading code when there's not documentation on a scope past "this chunk of code calculates good griday".

i don't easily take in code i haven't made unless i'm sure it does what it says it does. and the whole algorithm this uses just makes me more confused, frankly.

thanks for the suggestion though, i appreciate your input.
__________________
"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
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!StumbleUpon this Post!Reddit this Post!Facebook this Post!BlinkList this Post!Google Bookmarks this Post!Yahoo! My Web this Post!
Reply With Quote
  #5 (permalink)  
Old 11-08-2006, 08:52 PM
Member
 
Join Date: Aug 2006
Posts: 56
JosTheelen is on a distinguished road
OK. If you get stuck, mail me and I can translate it to MT4.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!StumbleUpon this Post!Reddit this Post!Facebook this Post!BlinkList this Post!Google Bookmarks this Post!Yahoo! My Web this Post!
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
How do MT4 EAs handle trade errors? ZTrader Questions 11 02-22-2008 12:30 PM
Out of Memory Errors with ZUP 58 pipdaddy Harmonic trading 2 05-25-2007 03:53 PM
Can anyone give me a functional example? niva Questions 4 08-25-2006 10:37 AM
TSD Errors jdun Metatrader 3 4 11-01-2005 08:44 PM


All times are GMT. The time now is 08:34 PM.



Search Engine Friendly URLs by vBSEO 3.2.0 ©2008, Crawlability, Inc.