Need help with new syntax

 
I'm attempting to re-write my Pivot Point calculator to work with the new version. Needless to say, there have been significant changes to the programming syntax.

Here is my code, so far, but it does contain the problem that I am experiencing.

//+------------------------------------------------------------------+
//|                                                          PV1.mq4 |
//|                                                        Jim Arner |
//|                                                                  |
//+------------------------------------------------------------------+

#property indicator_chart_window
//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int init()
  {
//---- indicators
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| Custor indicator deinitialization function                       |
//+------------------------------------------------------------------+
int deinit()
  {
//---- TODO: add your code here
   
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| Custom indicator iteration function                              |
//+------------------------------------------------------------------+
int start()
  {
   double yesterday_high;
   double yesterday_low;
   double yesterday_close;
   double P,S,R,S0.5,R0.5,S1,R1,S1.5,R1.5,S2,R2,S2.5,R2.5,S3,R3;
   
//---- TODO: add your code here

if(Period()!=1440) return(0);

yesterday_high=High[1];
yesterday_low=Low[1];
yesterday_close=Close[1];

P = (yesterday_high + yesterday_low + yesterday_close)/3;

R1 = (2*P)-yesterday_low;
S1 = (2*P)-yesterday_high;

R0.5=(P+R1)/2;
S0.5=(P+S1)/2;

R2 = P+(yesterday_high - yesterday_low);
S2 = P-(yesterday_high - yesterday_low);

R1.5=(R1+R2)/2;
S1.5=(S1+S2)/2;

R3=(yesterday_high + (2*(P-yesterday_low)));
S3=(yesterday_low - (2*(yesterday_high-P)));
	
Comment("PV1_2","\nR2=",R2,"\nR1.5=",R1.5,"\nR1=",R1,"\nR0.5=",R0.5,"\nP=",P,"\nS0.5=",S0.5,"\nS1=",S1,"\nS1.5=",S1.5,"\nS2=",S2);

   
//----
   return(0);
  }
//+------------------------------------------------------------------+



Here is the problem:

The calculator is supposed to work by temporarily shifting to a D1 chart, then retain the calculated values regardless of the chart time-frame.

If I leave in the line:

if(Period()!=1440) return(0);

the calculator works properly when on a D1 time-frame, however the values are no longer displayed in other time-frames. If I remove that line, the calculator works, but calculates based on the last candle in the particular time-frame - which is, of course, incorrect. I need it to retain the value from the calculation performed in the D1 chart.

I can only guess that there is something different that needs to be done with the 'return(0)' portion, but looking at the few other programming examples gives no clue, nor can I seem to find anythin in the programming reference dictionary.

Thanks for any help.

G'Jim c):{-

Reason: