Need help with new syntaxBack to topics list |
|
GJim
2005.03.17 05:31
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);
}
//+------------------------------------------------------------------+
|
