Harrisburg, PA
Posts: 1 since Sep 2015
Thanks Given: 0
Thanks Received: 0
|
I am trying to code a vertical line indicator {VL} so that it displays only the most recent SMA cross over rather than all of the crosses of the SMAs which might over the range of the chart. Below is an example of the code, I am going to code in a "loop" once I get get the placement of the VL correct. I do not understand why the placement is not working. Any guidance as to which function to use is much appreciated. Thank you very much!
Inputs: Line1(True), LineTime1(Close),
Line2(True), LineTime2(Average(Close,5));
Using elsystem;
using elsystem.drawing;
Using elsystem.drawingobjects;
Vars: VerticalLine VL(Null);
Method void DrawVerticalLine()
Begin
VL = VerticalLine.Create(BNPoint.Create(CurrentBar, Close));
VL.Persist = FALSE;
DrawingObjects.Add(VL);
End;
If LastBarOnChart then
Begin
If (Close > LineTime2) and (Close[1] < LineTime2[1]) then Begin
DrawVerticalLine();
DrawingObjects.Add(VL);
VL.Color = elsystem.drawing.Color.RED; // Upward Line
VL.Style = StyleType.solid;
VL.Weight = Weight.weight4;
End;
If (Close[1] > LineTime2[1]) and (Close[2] < LineTime2[2]) then Begin
DrawVerticalLine();
DrawingObjects.Add(VL);
VL.Color = elsystem.drawing.Color.CYAN; // Upward Line
VL.Style = StyleType.solid;
VL.Weight = Weight.weight4;
End;
If (Close[2] > LineTime2[2]) and (Close[3] < LineTime2[3]) then Begin
DrawVerticalLine();
DrawingObjects.Add(VL);
VL.Color = elsystem.drawing.Color.YELLOW; // Upward Line
VL.Style = StyleType.solid;
VL.Weight = Weight.weight4;
End;
End;
|