- You have only three choices: Search for it, learn to code it, or pay someone. We're not going to code it FOR you. We are willing to HELP you when you post your attempt (using SRC) and the nature of your problem.
- First n days of new month is easy TimeDay(when) <= n
- Last n is slightly harder
enum eMonth {JANUARY=1, FEBRUARY, MARCH, APRIL, MAY, JUNE, JULY, AUGUST, SEPTEMBER, OCTOBER, NOVEMBER, DECEMBER }; int DaysOfMonth(datetime when){ // Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec static int dpm[] = {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 }; eMonth mo = TimeMonth(when); return dpm[mo - JANUARY] + (mo != FEBRUARY ? 0 : (int)IsLeapYear(when) ); } bool IsLeapYear(dateime when){ int year = TimeYear(when); return year%4==0 && (year%100!=0 || year%400==0);} : if(DaysOfMonth(when) - TimeDay(when) > n)
From my code
- You have only three choices: Search for it, learn to code it, or pay someone. We're not going to code it FOR you. We are willing to HELP you when you post your attempt (using SRC) and the nature of your problem.
- First n days of new month is easy TimeDay(when) <= n
- Last n is slightly harderFrom my code
angevoyageur: Can you explain why you are still coding on 80 columns in 2015 ? | Are your books one column but two feet wide? No because that is unreadable. They are 6 inches, sometimes two columns, so you can read it easily. So should be your code. I'm not going to go scrolling (or moving my eyes) back and forth trying to read it. |
angevoyageur: Can you explain why you are still coding on 80 columns in 2015 ? | Are your books one column but two feet wide? No because that is unreadable. They are 6 inches, sometimes two columns, so you can read it easily. So should be your code. I'm not going to go scrolling (or moving my eyes) back and forth trying to read it. |
Are you coding in columns ?
I don't code on a book, I code on a computer, any screen can easily contains 130 characters on a line and still being perfectly readable (on my 13 inches and with my glasses).
Anyway that's all a matter of taste, personally I always find your code unreadable, being so compact.
Fortunately, this does not stop me from learning. No offense.
enum eMonth { JANUARY=1,FEBRUARY,MARCH,APRIL,MAY,JUNE,JULY,AUGUST,SEPTEMBER,OCTOBER,NOVEMBER,DECEMBER }; int DaysOfMonth(datetime when) { // Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec static int dpm[] = {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 }; eMonth mo = TimeMonth(when); //--- return(dpm[mo - JANUARY] + (mo != FEBRUARY ? 0 : (int)IsLeapYear(when) )); } bool IsLeapYear(dateime when) { int year=TimeYear(when); //--- return(year%4==0 && (year%100!=0 || year%400==0)); } : if(DaysOfMonth(when)-TimeDay(when)>n)
angevoyageur:
Are you coding in columns? I don't code on a book, I code on a computer, any screen can easily contains 130 characters on a line and still being perfectly readable (on my 13 inches and with my glasses). Anyway that's all a matter of taste, personally I always find your code unreadable, being so compact. Fortunately, this does not stop me from learning. No offence. |
|
No offense taken. |
Are you coding in columns ?
I don't code on a book, I code on a computer, any screen can easily contains 130 characters on a line and still being perfectly readable (on my 13 inches and with my glasses).
Anyway that's all a matter of taste, personally I always find your code unreadable, being so compact.
Fortunately, this does not stop me from learning. No offense.
Hi. I am trying to use this code but it can only be typed on global, namespace or class scope. Is there any way it can be placed OnTick?
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Hi all,
could you help me with this approach, i need to code a signal that opens a trade n days before the end of the month or n first days of new month. Could you help my with pseudocode please?.
Best.