NexusFi: Find Your Edge


Home Menu

 





Code that displays only most recent Indicator (from right of chart)


Discussion in TradeStation

Updated
    1. trending_up 1,210 views
    2. thumb_up 0 thanks given
    3. group 1 followers
    1. forum 0 posts
    2. attach_file 2 attachments




 
Search this Thread

Code that displays only most recent Indicator (from right of chart)

  #1 (permalink)
Wsquare
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;

Attached Thumbnails
Click image for larger version

Name:	TS_OutputCode1.png
Views:	156
Size:	34.4 KB
ID:	193054   Click image for larger version

Name:	TS_OutputExample1.png
Views:	184
Size:	84.6 KB
ID:	193055  
Reply With Quote




Last Updated on September 16, 2015


© 2024 NexusFi™, s.a., All Rights Reserved.
Av Ricardo J. Alfaro, Century Tower, Panama City, Panama, Ph: +507 833-9432 (Panama and Intl), +1 888-312-3001 (USA and Canada)
All information is for educational use only and is not investment advice. There is a substantial risk of loss in trading commodity futures, stocks, options and foreign exchange products. Past performance is not indicative of future results.
About Us - Contact Us - Site Rules, Acceptable Use, and Terms and Conditions - Privacy Policy - Downloads - Top
no new posts