Forex



Go Back   Forex Trading > Downloads > Expert Advisors - Metatrader 4
Forex Forum Register More recent Blogs 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 10-30-2006, 04:23 AM
Eaglehawk's Avatar
Senior Member
 
Join Date: Jun 2006
Posts: 141
Eaglehawk is on a distinguished road
some coding assistance please

i'm working to program a counter that will count when the moon is full to automate when good friday occurs, and as i was flowing through my river of thought, i encountered a dam. the method i'm taking seems simple enough to me, i've just never worked with code this way before.

in order to count the months, it was crucial to reset the days as i went through the months, i found this simple enough when i thought about it for a second for every month with 30 or 31 days. and then i crossed the elusive february.

february has an additional day every leap year, which occurs, usually, every 4 years. there are three rules that govern a leap year specifically though, as i found on google.

1. Every year divisible by 4 is a leap year.
2. a leap year is not divisible by 100
3. a leap year is not divisible by 400

what i want to do is ask the computer to divde the year by 4 to see if it is an integer, and make sure you can't divide it by 100 or 400 and get an integer. here's the function i've made so far. and yes, i know, i have two unused arrays in it so far.
PHP Code:
int goodfriday()
 {
      
double cycledays 29.5306;
      
int month 11;
      
double day 5;
      
bool FullMoon False;
      static 
double gmonth [2] = {0};
      static 
double gday [31] = {0};
       
       {
         
Month() = month && Day() = day && Year() = 2006 && FullMoon True;
         
         
         if (
Month() == month && Day() == day cycledays && Year == 2006)
          {
           
FullMoon True;
          }
         if ((
Month() == || Month() == || Month() == || Month() == || Month() == || Month() == 10 || Month() == 12) && day cycledays 31
         
{
          
month++;
          
day day cycledays 31;
         }
         if ((
Month() == || Month() == || Month() == || Month() == 11) && day cycledays 30
         
{
          
month++;
          
day day cycledays 30;
         }
         if ((
Month() == && Year() /*???*/) && day cycledays 28
         
{
          
month++;
          
day day cycledays 28;
         }
         
         
         return(
0);
       }
 } 
__________________
"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
  #2 (permalink)  
Old 10-30-2006, 08:49 AM
igorad's Avatar
Senior Member
 
Join Date: Oct 2005
Location: Ukraine
Posts: 963
igorad is on a distinguished road
For definiton of duration of February in leap-year you can use
the following code:

if (Month() == 2 )
{if (MathMod(Year(),4)==0) DaysNum = 29; else DaysNum = 28;}
__________________
Let's improve trade skills together
http://finance.groups.yahoo.com/group/TrendLaboratory
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 10-30-2006, 02:04 PM
Eaglehawk's Avatar
Senior Member
 
Join Date: Jun 2006
Posts: 141
Eaglehawk is on a distinguished road
Quote:
Originally Posted by igorad
For definiton of duration of February in leap-year you can use
the following code:

if (Month() == 2 )
{if (MathMod(Year(),4)==0) DaysNum = 29; else DaysNum = 28;}
Thanks for that a ton, answers my question with division, but just out of simple curiousity, why do you campare a 4'th year to 0?
__________________
"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; 10-30-2006 at 02:12 PM.
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 10-30-2006, 03:07 PM
Member
 
Join Date: Aug 2006
Posts: 56
JosTheelen is on a distinguished road
Quote:
3. a leap year is not divisible by 400
Shouldn't this be "every year that can be divided by 400 is a leap year"?
I know that it isn't important now, but maybe over 394 years
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 10-30-2006, 03:30 PM
igorad's Avatar
Senior Member
 
Join Date: Oct 2005
Location: Ukraine
Posts: 963
igorad is on a distinguished road
Quote:
Originally Posted by Eaglehawk
Thanks for that a ton, answers my question with division, but just out of simple curiousity, why do you campare a 4'th year to 0?
Because function MathMod is:

double MathMod( double value, double value2)
The function returns the remainder of division of two numbers.
Parameters:
value - Dividend value.
value2 - Divisor value.
__________________
Let's improve trade skills together
http://finance.groups.yahoo.com/group/TrendLaboratory
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
  #6 (permalink)  
Old 10-30-2006, 03:37 PM
igorad's Avatar
Senior Member
 
Join Date: Oct 2005
Location: Ukraine
Posts: 963
igorad is on a distinguished road
Quote:
Originally Posted by Eaglehawk
Thanks for that a ton, answers my question with division, but just out of simple curiousity, why do you campare a 4'th year to 0?
Because function MathMod is:

double MathMod( double value, double value2)
The function returns the remainder of division of two numbers.
Parameters:
value - Dividend value.
value2 - Divisor value.

If the remainder of division of two numbers is equal 0 the first are multiple to the second.
__________________
Let's improve trade skills together
http://finance.groups.yahoo.com/group/TrendLaboratory
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
  #7 (permalink)  
Old 10-30-2006, 11:52 PM
Eaglehawk's Avatar
Senior Member
 
Join Date: Jun 2006
Posts: 141
Eaglehawk is on a distinguished road
Quote:
Originally Posted by JosTheelen
Shouldn't this be "every year that can be divided by 400 is a leap year"?
I know that it isn't important now, but maybe over 394 years
actually, i meant what i said. according to this website, if it is divisible by 400 than it's not a leap year, here's the link, see for yourself.

http://www.timeanddate.com/date/leapyear.html
__________________
"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
  #8 (permalink)  
Old 10-31-2006, 03:44 PM
Member
 
Join Date: Aug 2006
Posts: 56
JosTheelen is on a distinguished road
Quote:
Originally Posted by Eaglehawk
actually, i meant what i said. according to this website, if it is divisible by 400 than it's not a leap year, here's the link, see for yourself.

http://www.timeanddate.com/date/leapyear.html
Your link also says:
This means that year 1800, 1900, 2100, 2200, 2300 and 2500 are NOT leap years, while year 2000 and 2400 are leap years.
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
  #9 (permalink)  
Old 10-31-2006, 11:17 PM
Eaglehawk's Avatar
Senior Member
 
Join Date: Jun 2006
Posts: 141
Eaglehawk is on a distinguished road
Quote:
Originally Posted by JosTheelen
Your link also says:
This means that year 1800, 1900, 2100, 2200, 2300 and 2500 are NOT leap years, while year 2000 and 2400 are leap years.
right, i overlooked that, i'm not exactly an expert on leap years.

well, i may be now, lol.

thanks for saving my skin, although it may be another 393.15 years, (guessing there).
__________________
"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
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
Your assistance Land General Discussion 2 06-07-2007 12:06 PM
Need a little assistance please! iscuba11 Indicators - Metatrader 4 3 06-12-2006 03:38 AM
Need assistance with Metatrader 4 JBendar General Discussion 2 03-31-2006 04:21 PM


All times are GMT. The time now is 06:30 PM.



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