artsedge: I want to build in number of time period options to trade into my first code, is there an enumeration that could deal with a list of options. |
|
I see there is an enumeration for Timeframes for the range of different timesframes, but i was looking at trading at different times of the day say midnight to 9am or midnight to midday.
artsedge: I see there is an enumeration for Timeframes for the range of different timesframes, but i was looking at trading at different times of the day say midnight to 9am or midnight to midday.
There are 86400 seconds in a day. Do you expect 86400 enumerations? Code a time filter#define HR2400 (PERIOD_D1 * 60) // 86400 = 24 * 3600 int TimeOfDay(datetime when=0){ if(when == 0) when = TimeCurrent(); return( when % HR2400 ); } datetime DateOfDay(datetime when=0){ if(when == 0) when = TimeCurrent(); return( when - TimeOfDay(when) ); } //datetime Tomorrow( datetime when=0){ if(when == 0) when = TimeCurrent(); // return(DateOfDay(when) + HR2400); } //datetime Yesterday(datetime when=0){ if(when == 0) when = TimeCurrent(); // int iD1 = iBarShift(NULL, PERIOD_D1, DateOfDay(when) - 1); // return( iTime(NULL, PERIOD_D1, iD1) ); } OnStart(){ #define MIDNIGHT 0 #define NOON 43200 // 12 * 3600 int tod = TimeOfDay(); if(tod >= MIDNIGHT && tod < NOON){ ...
Thank you very much for this - i hope you leave posted for other people learning like me.
could you complete the section that is missing after if( >= MIDNIGHT && tod < NOON) {
artsedge: could you complete the section that is missing after if( >= MIDNIGHT && tod < NOON) {
You said "i was looking at trading at different times of the day say midnight to 9am or midnight to midday. " So call your trading code.

You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
I want to build in number of time period options to trade into my first code, is there an enumeration that could deal with a list of options. Thanks for any advice !