PureBytes Links
Trading Reference Links
|
Some years ago I had some DOS software written by someone (now dead I
think) who developed a way to calculate smoothly changing support and
resistance lines that magically seemed to touch highs and lows without
any curve fitting or paramters.
I never could figure out a way to trade successfully with the concept.
Below is my EasyLanguage indicator for plotting two levels of Midas
support and resistance on any chart. If anybody can figure out how it
can be useful, please let me know.
--------------------------------------------------------------------
{Display the Midas support and resistance indicator
This was described in "Volume-Weighted Average Price" by George Reyna
(Stocks and Commodities 5/2001)
Code by Alex Matulich, Unicorn Research Corporation, July 2002
IMPORTANT: PLOT AS POINTS OR TICKS (NOT LINES), USING THE SCALE AND
SUBGRAPH OF DATA1.
}
Inputs:
numplots(2), {levels to plot (1 or 2)}
lvl2cutoffbars(50); {number of bars after which to start over level2}
Variables:
n(2), j(0), k(0), brk(false),
maxidx(1); {maximum array index}
Arrays:
Bar0H[1](0), Vol0H[1](0), PV0H[1](0),
Bar0L[1](0), Vol0L[1](0), PV0L[1](0),
HH[1](-9999999), LL[1](9999999),
CumVolH[1](0), CumPVH[1](0), {Vol & P*V accumulators (highs)}
CumVolL[1](0), CumPVL[1](0), {Vol & P*V accumulators (lows)}
mL[1](0), mH[1](0); {support & resistance to plot}
n = numplots;
if n>2 then n=2;
if n<1 then n=1;
for j = 0 to maxidx begin
LL[j] = LL[j][1]; HH[j] = HH[j][1];
Vol0L[j] = Vol0L[j][1]; Vol0H[j] = Vol0H[j][1];
end;
{find a new high to start from}
if High >= High[1] then begin
brk = false; j = 0;
while j<=maxidx and brk=false begin
if H>mH[j] then HH[j] = -9999999;
if j>0 and BarNumber-Bar0L[j]>lvl2cutoffbars then HH[j] = -9999999;
if High >= HH[j] then begin
HH[j] = High;
Bar0H[j] = BarNumber;
Vol0H[j] = Volume;
PV0H[j] = Volume * High;
CumVolH[j] = Vol0H[j]; CumPVH[j] = PV0H[j];
for k = j+1 to maxidx begin
HH[k] = -9999999;
Bar0H[j] = BarNumber;
end;
brk = true;
end;
j = j + 1;
end;
end;
{find a new low to start from}
if Low <= Low[1] then begin
j = 0; brk = false;
while j<=maxidx and brk=false begin
if L<mL[j] then LL[j] = 9999999;
if j>0 and BarNumber-Bar0L[j]>lvl2cutoffbars then LL[j] = 9999999;
if Low <= LL[j] then begin
LL[j] = Low;
Bar0L[j] = BarNumber;
Vol0L[j] = Volume;
PV0L[j] = Volume * Low;
CumVolL[j] = Vol0L[j]; CumPVL[j] = PV0L[j];
for k = j+1 to maxidx begin
LL[k] = 9999999;
Bar0L[j] = BarNumber;
end;
brk = true;
end;
j = j + 1;
end;
end;
{calculate Midas support and resistance levels}
for j = 0 to maxidx begin
{support}
if BarNumber > Bar0L[j] then begin
CumVolL[j] = Volume + CumVolL[j][1];
CumPVL[j] = Low * Volume + CumPVL[j][1];
mL[j] = iff(CumVOlL[j]-Vol0L[j]=0, mL[j][1],
(CumPVL[j]-PV0L[j])/(CumVolL[j]-Vol0L[j]));
end else mL[j] = L;
{resistance}
if BarNumber > Bar0H[j] then begin
CumVolH[j] = Volume + CumVolH[j][1];
CumPVH[j] = High * Volume + CumPVH[j][1];
mH[j] = iff(CumVolH[j]-Vol0H[j]=0, mH[j][1],
(CumPVH[j]-PV0H[j])/(CumVolH[j]-Vol0H[j]));
end else mH[j] = H;
End;
{plot if support or resistance is past its first bar}
if n >= 1 then begin
if BarNumber > Bar0L[0] and LL[0]<9999999 then Plot1(mL[0], "Low1");
if BarNumber > Bar0H[0] and HH[0]>-9999999 then Plot2(mH[0], "High1");
if n >= 2 then begin
if BarNumber > Bar0L[1] and LL[1]<9999999 then Plot3(mL[1], "Low2");
if BarNumber > Bar0H[1] and HH[1]>-9999999 then Plot4(mH[1], "High2");
end;
end;
--
,|___ Alex Matulich -- alex@xxxxxxxxxxxxxx
// +__> Director of Research and Development
// \
// __) Unicorn Research Corporation -- http://unicorn.us.com
|