PureBytes Links
Trading Reference Links
|
Someone was kind enough to share the following code that plots a down
trendline on a RSI oscillator.
Could someone help me with the lines of code that would convert this to a
Showme or Paintbar that plotted a dot on the high where
the osc crosses from below the trendline to above it. I know it is
something along the lines of:
If osc[1] < trendline[1] and osc > trendline then
Plot2(high, "crossover");
However, I'm having difficulty defining "trendline" based on the code below.
Any help would be appreciated.
Barry
============================================================================
====
{DownTrend Line for Oscillator
Notes:
1- the indicator is plotted in the same graph as the RSI oscillator
2- the scaling for this indicator is "User Defined" Max 100 and Min 0
3- indicator Style is "line"}
INPUTS:
OSC(RSI(close,14)), STRENGTH(2), OCCUR(1), LENGTH(100);
VARIABLES:
JLA_LINE(0), W(0), CTR(0), H1(0), H2(0), H1BAR(0), H2BAR(0), SLOPE(0);
{XXXXXXXXX DETERMINE POINTS 1 AND 2 XXXXXXXXXXXXXXX}
H1BAR = SWINGHIGHBAR(OCCUR,OSC,STRENGTH, LENGTH);
H1 = OSC[H1BAR];
H2BAR = 0;
H2 = 0;
CTR = OCCUR + 1;
WHILE H2 < H1 AND H2BAR <= LENGTH AND H2BAR <> -1
BEGIN
H2BAR = SWINGHIGHBAR(CTR,OSC,STRENGTH,LENGTH);
H2 = OSC[H2BAR];
CTR = CTR + 1;
END;
IF H2BAR <> -1 THEN
BEGIN
SLOPE = (H2 - H1) / (H1BAR - H2BAR);
CTR = H1BAR - STRENGTH;
JLA_LINE = 99999;
FOR W = H2BAR DOWNTO 0
BEGIN
PLOT1[W](H2 + (H2BAR - W) * SLOPE,"DOWNTREND");
END;
END; {NO POINT 2}
|