Period() isn't working right

 

Hi,

I am programming an indicator and using the function Period().

But it doesn't work really.

On the Timeframe M1 the Period()-Functions gives 1 ...or...60 back.

On the Timeframe M15 the Period()-Functions gives 15...or...60 back.

On the Timeframe H1 the Period()-Functions gives 60 ...or...60 back.

On the Timeframe H4 the Period()-Functions gives 240 ...or...60 back.

...

Why?? What can I do against that?!

 

read the book again


int Period( )
Returns the amount of minutes determining the used period (chart timeframe).

Sample:
  Print("Period is ", Period());

Timeframe of the chart (chart period). It can be any of the following values:

Constant Value Description
PERIOD_M1 1 1 minute.
PERIOD_M5 5 5 minutes.
PERIOD_M15 15 15 minutes.
PERIOD_M30 30 30 minutes.
PERIOD_H1 60 1 hour.
PERIOD_H4 240 4 hour.
PERIOD_D1 1440 Daily.
PERIOD_W1 10080 Weekly.
PERIOD_MN1 43200 Monthly.
0 (zero) 0 Timeframe used on the chart.

 

I know this and understood it!

But on my Alpari Account I got sometimes one of the both values I have written:

On the Timeframe M1 the Period()-Functions gives 1 ...or...60 back.

On the Timeframe M15 the Period()-Functions gives 15...or...60 back.

On the Timeframe H1 the Period()-Functions gives 60 ...or...60 back.

On the Timeframe H4 the Period()-Functions gives 240 ...or...60 back.

I get sometimes the right value and sometimes the wrong value at the same timeframe!

On my ActiveTrade Account everything is working well!

 
show some minimal code example (minimal == a dozen lines, not more) that demonstrates the problem. I don't believe it.
 
Ya, show your code. I doubt it as well.
 
If you got it with the tester, you didn't set the period pull down.
 

What means "period pull down"??? I worked with the tester...

   if(TimeFrame==0)
      TimeF = Period();
   else
      TimeF = TimeFrame;
Print("Period(): ", Period());
 

maybe u have some place in the code that TimeFrame = 60 or TimeF = 60

edit: one more thing

replace:

Print("Period(): ", Period());

with:

Print("Period(): ", TimeF);
 
sunshineh:

What means "period pull down"??? I worked with the tester...

Reason: