//gets current month from todays date
dateToday = Currentdate;
dateInDateTimeFormat = ELDateToDateTime(dateToday);
dateReadable = FormatDate("YYYMMdd", dateInDateTimeFormat);
currentMonth = Month(dateReadable);
The above code returns the following error
Types are not compatible for line 30 which is
dateReadable = FormatDate("YYYMMdd", dateInDateTimeFormat);
Now, all i want is the current month?
is current month jan, or feb, or mar or what?
Thats all i am trying to do here?
How to get the current month? [SOLVED]
- TJ
- Posts: 7742
- Joined: 29 Aug 2006
- Location: Global Citizen
- Has thanked: 1033 times
- Been thanked: 2222 times
Re: How to get the current month?
What kind of variable is "dateReadable"? string? numeric?//gets current month from todays date
dateToday = Currentdate;
dateInDateTimeFormat = ELDateToDateTime(dateToday);
dateReadable = FormatDate("YYYMMdd", dateInDateTimeFormat);
currentMonth = Month(dateReadable);
The above code returns the following error
Types are not compatible for line 30 which is
DateReadable = FormatDate("YYYMMdd", dateInDateTimeFormat);
Now, all i want is the current month?
is current month jan, or feb, or mar or what?
Thats all i am trying to do here?
- TJ
- Posts: 7742
- Joined: 29 Aug 2006
- Location: Global Citizen
- Has thanked: 1033 times
- Been thanked: 2222 times
Re: How to get the current month?
ps. [FAQ] How to Post Codes (that people can read)
viewtopic.php?f=16&t=11713
viewtopic.php?f=16&t=11713
Re: How to get the current month?
Dear Sir,ps. [FAQ] How to Post Codes (that people can read)
viewtopic.php?f=16&t=11713
It is NumericSimple, if you are about to suggest i make it a string, how do i do that?
Code: Select all
dateInDateTimeFormat(0),
dateReadable(0),
currentMonth(0);
- TJ
- Posts: 7742
- Joined: 29 Aug 2006
- Location: Global Citizen
- Has thanked: 1033 times
- Been thanked: 2222 times
Re: How to get the current month?
Dear Sir,
It is NumericSimple, if you are about to suggest i make it a string, how do i do that?Code: Select all
dateInDateTimeFormat(0),
dateReadable(0),
currentMonth(0);
Code: Select all
var:
dateReadable("");
- TJ
- Posts: 7742
- Joined: 29 Aug 2006
- Location: Global Citizen
- Has thanked: 1033 times
- Been thanked: 2222 times
Re: How to get the current month?
from the Wiki help file:
FormatDate
Returns a formated string expression corresponding to the date (integer) portion of the specified DateTime value.
Re: How to get the current month?
Dear Sir,
I thankyou for our response, but now the next line is throwing an error
"Incorrect argument type."
So it expect a numeric and returns a numeric
All i want to do is basically get the current month, so i can use it in a switch statement later.
Because depending on the month it is, i have a few different rules.
So this part of the code, all i am trying to achieve is get current month.
I thankyou for our response, but now the next line is throwing an error
"Incorrect argument type."
So it expect a numeric and returns a numeric
All i want to do is basically get the current month, so i can use it in a switch statement later.
Because depending on the month it is, i have a few different rules.
So this part of the code, all i am trying to achieve is get current month.
dateInDateTimeFormat(0),
dateReadable(""),
currentMonth(0);
array: ranges[](0);
array_setmaxindex(ranges, NoOfDaysForATR);
//gets current month from todays date
dateInDateTimeFormat = ELDateToDateTime(Currentdate);
dateReadable = FormatDate("YYYMMdd", dateInDateTimeFormat);
currentMonth = Month(dateReadable);
- TJ
- Posts: 7742
- Joined: 29 Aug 2006
- Location: Global Citizen
- Has thanked: 1033 times
- Been thanked: 2222 times
Re: How to get the current month?
rkhan:Dear Sir,
I thankyou for our response, but now the next line is throwing an error
"Incorrect argument type."
::
I can give you a quick answer, like I did in the previous post. But you should start here:
viewtopic.php?f=16&t=6929
Please get an EasyLanguage ebook and go through it from cover to cover. You have bright ideas; but you need to have a working knowledge of the programming language.
- TJ
- Posts: 7742
- Joined: 29 Aug 2006
- Location: Global Citizen
- Has thanked: 1033 times
- Been thanked: 2222 times
Re: How to get the current month?
How do you want your months?::
Now, all i want is the current month?
is current month jan, or feb, or mar or what?
Thats all i am trying to do here?
jan, feb, mar...?
or 1, 2, 3...?
- TJ
- Posts: 7742
- Joined: 29 Aug 2006
- Location: Global Citizen
- Has thanked: 1033 times
- Been thanked: 2222 times
Re: How to get the current month?
For explanation of EasyLanguage keywords,
look for "PowerLanguage Keyword Reference"
https://www.multicharts.com/trading-sof ... /Main_Page
The keywords you should look up:
MONTH
DATE
look for "PowerLanguage Keyword Reference"
https://www.multicharts.com/trading-sof ... /Main_Page
The keywords you should look up:
MONTH
DATE
Re: How to get the current month?
Dear Sir,
Yes, if you look at my initial code, that is what i have used
I have used Month
But i cannot get it working
All i want to do is, get a numerical value (1-12) corresponding to the month of the current bar
Yes, if you look at my initial code, that is what i have used
I have used Month
But i cannot get it working
All i want to do is, get a numerical value (1-12) corresponding to the month of the current bar
- TJ
- Posts: 7742
- Joined: 29 Aug 2006
- Location: Global Citizen
- Has thanked: 1033 times
- Been thanked: 2222 times
Re: How to get the current month?
Have you followed my instruction in post #10?Dear Sir,
Yes, if you look at my initial code, that is what i have used
I have used Month
But i cannot get it working
All i want to do is, get a numerical value (1-12) corresponding to the month of the current bar
Re: How to get the current month?
Dear Sir,
I didnt understand it,
Thats what i had at the begining, i used month
but it needs an input.. its needs a date. and thats where i get all consfused
coz i use current date, which i then convert to appropriate format, and basically im still where i started
That initial code is what i still have and isnt working for me
I didnt understand it,
Thats what i had at the begining, i used month
but it needs an input.. its needs a date. and thats where i get all consfused
coz i use current date, which i then convert to appropriate format, and basically im still where i started
That initial code is what i still have and isnt working for me
- TJ
- Posts: 7742
- Joined: 29 Aug 2006
- Location: Global Citizen
- Has thanked: 1033 times
- Been thanked: 2222 times
Re: How to get the current month?
TryDear Sir,
I didnt understand it,
Thats what i had at the begining, i used month
but it needs an input.. its needs a date. and thats where i get all consfused
coz i use current date, which i then convert to appropriate format, and basically im still where i started
That initial code is what i still have and isnt working for me
Code: Select all
currentmonth = MONTH( DATE );