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

Re: LastTickLine



PureBytes Links

Trading Reference Links

The LastTickLine code to plot a trend line at the level of the close shown
by Ian and Alex was modified very slightly so that  different values
can be used and named _LastValueLine.

Inserting the modified indicator three times may almost satisfy Gerald's
comment:
    "What would be REALLY helpful is to have a line segment plotted at the
       -    Highest close in a BULL price swing (before a BEAR retracement)
       -    Lowest close in a BEAR price swing (before a BULL retracement)
      to indicate a price level for static stops."

The following are examples of the trendlines that may be drawn:

1) To plot the close of the previous swing high bar surrounded by 1 lower
high:
Insert the indicator _LastValueLine
     Set the Input Value=SwingHigh(1,C,1,30)

2) To plot the close of the previous swing low bar surrounded by 1 higher
low:
Insert the indicator _LastValueLine
     Set the Input Value=SwingLow(1,C,1,30)

3) And to plot the close of the last bar:
Insert the indicator _LastValueLine
     Set the Input Value=C

The indicator code is the following:

{ Begin Indicator _LastValueLine
 Draws a horizontal trend line at the value of the input Value
 and optionally plots a line at the value of the input Value.
 Value can be a price, e.g., C, H, L[2] or
 a function, e.g.,
   SwingLow(1,C,1,30), or
   SwingHigh(1,C,1,30), or
   iff(H>SwingHigh(1,H,1,30),H,SwingHigh(1,H,1,30)).
}
Inputs: Value(C), color(Red), width(2), ShowPlot(True);
Vars: tl(-1);

If CurrentBar = 1 then begin
    tl = tl_new(date[1],time[1],Value,date,time,Value);
    if tl >= 0 then begin
        tl_setcolor(tl,color);
        tl_setstyle(tl,1);
        tl_setsize(tl,width);
        tl_SetExtLeft(tl,true);
    end;
end else if LastBaronChart and tl >= 0 then begin
    tl_setEnd(tl, date, time, Value);
    tl_setBegin(tl, date[1], time[1], Value);
end;

if ShowPlot and Value<>-1 then plot1(Value,"LastVal");

{End of indicator _LastValueLine}

Doug Fogg