[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Pivot, S1 S2 R1 R2



PureBytes Links

Trading Reference Links

--- Peter Laird <pj.laird@xxxxxxxxxx> wrote:
> Hi,
> 
> I'm looking for an indicator or easylanguage formula
> that will display
> the Pivot R1 R2 S1 and S2 for me every day.
This is an indicator for two support/resistance levels
D2:


input: DAYSBACK(1);
var:  Avg1(0), High1(0), Low1(0), High2(0), Low2(0);
var: index(0), Havg(0), Lavg(0), Cavg(0);
var: days_back1(0), HHigh(0), LLow(0);
array: DayHigh[60](0), DayLow[60](0), DayClose[60](0);

days_back1 = DAYSBACK - 1;


if Date > Date[1] then Begin

   Havg = 0;
   Lavg = 0;
   Cavg = 0;

   for index = DAYSBACK downto 2 Begin

      DayHigh[index] = DayHigh[index - 1];
      DayLow[index] = DayLow[index - 1];
      DayClose[index] = DayClose[index - 1];

      Havg = Havg + DayHigh[index];
      Lavg = Lavg + DayLow[index];
      Cavg = Cavg + DayClose[index];
      
   End;

   DayHigh[1] =  HHigh;
   DayLow[1] =  LLow;
   DayClose[1] = Close[1];


   Havg = (Havg + DayHigh[1])/DAYSBACK;
   Lavg = (Lavg + DayLow[1])/DAYSBACK;
   Cavg = (Cavg + DayClose[1])/DAYSBACK;

   HHigh = High;
   LLow = Low;

end; {if}



If Date = Date[1] then begin
	If High > HHigh Then HHigh = High;
	If Low < LLow Then LLow = Low;
end;

Avg1  = (Havg + Lavg + Cavg)/3;
High1 = (2*Avg1) - Lavg;
Low1  = (2*Avg1) - Havg;
High2 = Avg1 + High1 - Low1;
Low2 = Avg1 + Low1 - High1;


Value1=(Highest(high,10) + 200 points);
Value2=(Lowest(Low,10) -  200 points);

{
If High1 < Value1 and High1 > Value2 then Plot1
(High1, "High1");
If Low1 < Value1 and  Low1 > Value2 then Plot2 (Low1,
"Low1");
If High2 < Value1 and High2 > Value2 then Plot3
(High2, "High2");
If Low2 < Value1 and Low2 > Value2 then Plot4 (Low2,
"Low 2");
}

if Avg1 < Value1 and Avg1 > Value2 then Plot1 (Avg1,
"Avg1");


=====
JFB
Wading Pool Trading Co
New York City