- Check Indicator Value on a different timeframe
- comparing candles
- Time Between Trades
Let's have a look at :
Returns the amount of minutes determining the used period (chart timeframe).
|
This is what I've got so far:
int Test()
{
int TimeFrames[9] = { 1,5,15,30,60,240,1440,10080,43200 };
for(int i=0; i<=9; i++)
if(TimeFrames[i]==Period()) return(TimeFrames[i+1]);
}
And this is correct....
I appreciate the info but please read the question before replying. Knowledge of Period() does not preclude a knowledge of arrays and conditional statements. I asked hoping that their was a built-in array for timeframes.
hey,
I modified your code a little:
int Test()
{
int TimeFrames[10] = { 1,5,15,30,60,240,1440,10080,43200,43200 };
for(int i=0; i<9; i++)
if( TimeFrames[i] == Period() ) return(TimeFrames[i+1]);
}
The above should do what you asked for. I dont know what you would like to return above the monthly timeframe, I put the same number (monthly) as the next one - you may change it according to your needs...
thank you
Automated (automatedfx@gmail.com)
--
http://www.forexmosaic.com/ - free publishing, analyzing and portfolio building service
//+---------------------------------------------------------------------+ //| subGetNextTimeFrame function - returns the next timeframe | //+---------------------------------------------------------------------+ int subGetNextTimeFrame() { int TimeFrames[9] = { 1,5,15,30,60,240,1440,10080,43200 }; int CurrentTimeIndex = ArrayBsearch(TimeFrames,_Period,8,0,MODE_ASCEND); return((ENUM_TIMEFRAMES) TimeFrames[CurrentTimeIndex+1]); }

- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use