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

FW: Moving windows and RadarScreen help



PureBytes Links

Trading Reference Links


Oups!
I've just noticed you created an indicator and I created a ShowMe!
Sorry

Phil
-----Original Message-----
From: Philippe Lhermie [mailto:philippe.lhermie@xxxxxxx]
Sent: Tuesday, September 19, 2000 11:19 PM
To: Omega-List@xxxxxxxxxx; Doug Fields
Subject: RE: Moving windows and RadarScreen help


Hi again Doug,
See my comments below

Greetings from Paris,

Philippe


{***************************************
 _GoodTicks is a custom function avoiding errors like Low = 0
****************************************}

Inputs: Minutes(60); { How minutes to calculate }

Vars: LowestLow(0), HighestHigh(0);

IF {_GoodTicks and} (Time >= Sess1StartTime) and
   (Time < MinutesToTime(TimeToMinutes(Sess1StartTime)+ Minutes)) then begin
{***********
You can simplify the second condition by: "Time <
CalcTime(Sess1StartTime,Minutes)"
************* }
 If Date > Date[1] then begin
  LowestLow = Low;
  HighestHigh = High;
 End;

 if LowestLow <= 0 Then begin {<===== This is Not Good! because LowestLow
will never have a negative value (do you know a stock which has a negative
value ???) and also will never be equal to zero because Low is always > 0 if
the _GoodTicks function returns TRUE***************}
  LowestLow = Low;
 end else if (Low < LowestLow) and (Low > 0) Then begin {<====again, Low > 0
is already included in _GoodTicks*******}
  LowestLow = Low;
 End;

 If High > HighestHigh Then begin
  HighestHigh = High;
 End;

 NoPlot(1);
 NoPlot(2);
end;

Plot1(HighestHigh, "Highest High"); {<==== I find it strange to put these
plots here outside the if then statement !, it makes lines of dots!}
Plot2(LowestLow, "Lowest Low");

****************************************************************
Here is the code modified:
It Plots the Highest High and the LowestLow and the times they happen.

Inputs: Minutes(60); { How minutes to calculate }

Vars: TimeEnd(0), LowestLow(0), HighestHigh(0), BarsBackLow(0),
BarsBackHigh(0);

TimeEnd = CalcTime(Sess1StartTime,Minutes);

If _GoodTicks and Time >= Sess1StartTime and Time < TimeEnd then begin
	If Date > Date[1] then begin
		LowestLow = Low;
		HighestHigh = High;
		Value1 = BarNumber; {This is to be able to plot the LowestLow in case it
happens at the first bar of the day}
		Value2 = BarNumber; {Idem for the Highest High}
	End;

	if Low < LowestLow Then begin
	  	LowestLow = Low;
		Value1 = BarNumber;
	End;

	If High > HighestHigh Then begin
	  	HighestHigh = High;
		Value2 = BarNumber;
	End;
end;
BarsBackLow = BarNumber - Value1;
BarsBackHigh = BarNumber - Value2;

If Time >= TimeEnd and Time < CalcTime(TimeEnd,BarInterval) then begin
	Plot1[BarsBackLow](LowestLow, "Lowest Low");
	Plot2[BarsBackHigh](HighestHigh, "Highest High");
end;