Currently when using datetime.date.today() the today's date is returned as YYYY-MM-DD I would like to return it as YYYY,MM,DD as I would like to automate the date that is used in the MT5 copy rates function
mt5.copy_rates_from(EURUSD, mt5.TIMEFRAME_H4, yyyy,mm,dd, 200)
I would like to calculate the date with out having to manually type it in but if I use datetime.date.today() the code does not work.
Automate the date with out manually typing it in.
You can get year, month, and day separately by using the method timetuple() of date. The function, however, returns a tuple with 9 items. You can get the first three by doing:
[:3]means the first three values of the list. Each variable is assigned to the corresponding value of the list.The values are returned as
ints, not strings.