NexusFi: Find Your Edge


Home Menu

 





ACSIL: How do I get the time value of a Vertical line that I have drawn on the chart


Discussion in Sierra Chart

Updated
      Top Posters
    1. looks_one yonatan with 4 posts (0 thanks)
    2. looks_two ktrader with 2 posts (2 thanks)
    3. looks_3 Quick Summary with 1 posts (0 thanks)
    4. looks_4 funk101 with 1 posts (0 thanks)
    1. trending_up 3,274 views
    2. thumb_up 2 thanks given
    3. group 2 followers
    1. forum 7 posts
    2. attach_file 0 attachments




 
Search this Thread

ACSIL: How do I get the time value of a Vertical line that I have drawn on the chart

  #1 (permalink)
 yonatan 
Haifa Israel
 
Experience: Beginner
Platform: sierra chart
Broker: Optimus Trading Group/Rithmic
Trading: es
Posts: 91 since Apr 2012
Thanks Given: 50
Thanks Received: 71

I want my study to use the Time value of a Vertical line that I have manually drawn on the chart and the Price value of a Horizontal line that I have manually drawn on the chart. Any idea how I can get those values ?

Started this thread Reply With Quote

Can you help answer these questions
from other members on NexusFi?
Pivot Indicator like the old SwingTemp by Big Mike
NinjaTrader
Cheap historycal L1 data for stocks
Stocks and ETFs
Quant vue
Trading Reviews and Vendors
Better Renko Gaps
The Elite Circle
Trade idea based off three indicators.
Traders Hideout
 
Best Threads (Most Thanked)
in the last 7 days on NexusFi
What is Markets Chat (markets.chat) real-time trading ro …
70 thanks
Spoo-nalysis ES e-mini futures S&P 500
55 thanks
Bigger Wins or Fewer Losses?
24 thanks
Just another trading journal: PA, Wyckoff & Trends
24 thanks
The Program
20 thanks
  #3 (permalink)
 
ktrader's Avatar
 ktrader 
glostrup, denmark
 
Experience: Advanced
Platform: Custom platform
Broker: CQG
Trading: Futures, Options, Stocks
Posts: 249 since Aug 2011
Thanks Given: 152
Thanks Received: 275



yonatan View Post
I want my study to use the Time value of a Vertical line that I have manually drawn on the chart and the Price value of a Horizontal line that I have manually drawn on the chart. Any idea how I can get those values ?

You can do like this:

 
Code
#include "C:\Sierrachart\ACS_Source\sierrachart.h"

SCDLLName("GetLineValue")

SCSFExport scsf_GetLineValues(SCStudyInterfaceRef sc)
{	
	if (sc.SetDefaults)
	{
		sc.GraphName = "GetLineValues";		
		sc.StudyDescription = "";		
		sc.GraphRegion = 0;		
		sc.FreeDLL = 1;		
		return;
	}


	s_UseTool line;
	
	if (sc.GetChartDrawing(0, DRAWING_HORIZONTALLINE, line, 0))
 	{

		SCString str;	
		float val = line.BeginValue;
		str.Format("Horizontal line, value: %f",val);
 		sc.AddMessageToLog(str, 0);
 	}

	if (sc.GetChartDrawing(0, DRAWING_VERTICALLINE, line, 0))
 	{

		SCDateTime dt = line.BeginDateTime;
		int yy,mm,dd,h,m,s;
		dt.GetDateTimeYMDHMS(yy, mm, dd, h, m, s);
		int barindex = line.BeginIndex;
		SCString str;	
		str.Format("Vertical line, barindex:%d, time: %d:%d",barindex,h,m);
 		sc.AddMessageToLog(str, 0);
 	}
}

Reply With Quote
Thanked by:
  #4 (permalink)
 yonatan 
Haifa Israel
 
Experience: Beginner
Platform: sierra chart
Broker: Optimus Trading Group/Rithmic
Trading: es
Posts: 91 since Apr 2012
Thanks Given: 50
Thanks Received: 71


ktrader View Post
You can do like this:

 
Code
#include "C:\Sierrachart\ACS_Source\sierrachart.h"

SCDLLName("GetLineValue")

SCSFExport scsf_GetLineValues(SCStudyInterfaceRef sc)
{	
	if (sc.SetDefaults)
	{
		sc.GraphName = "GetLineValues";		
		sc.StudyDescription = "";		
		sc.GraphRegion = 0;		
		sc.FreeDLL = 1;		
		return;
	}


	s_UseTool line;
	
	if (sc.GetChartDrawing(0, DRAWING_HORIZONTALLINE, line, 0))
 	{

		SCString str;	
		float val = line.BeginValue;
		str.Format("Horizontal line, value: %f",val);
 		sc.AddMessageToLog(str, 0);
 	}

	if (sc.GetChartDrawing(0, DRAWING_VERTICALLINE, line, 0))
 	{

		SCDateTime dt = line.BeginDateTime;
		int yy,mm,dd,h,m,s;
		dt.GetDateTimeYMDHMS(yy, mm, dd, h, m, s);
		int barindex = line.BeginIndex;
		SCString str;	
		str.Format("Vertical line, barindex:%d, time: %d:%d",barindex,h,m);
 		sc.AddMessageToLog(str, 0);
 	}
}

Awesome ktrader, much thanks.

Now, if I have a few Horizontal and Vertical lines on the chart and I wish to retrieve those values for a specific line am I correct by assuming that I will have to create this specific line with an ACSIL code and assign to it a "LineNumber" and then I will be able to get its values with sc.GetUserDrawingByLineNumber() ?

Started this thread Reply With Quote
  #5 (permalink)
 
ktrader's Avatar
 ktrader 
glostrup, denmark
 
Experience: Advanced
Platform: Custom platform
Broker: CQG
Trading: Futures, Options, Stocks
Posts: 249 since Aug 2011
Thanks Given: 152
Thanks Received: 275


yonatan View Post
Awesome ktrader, much thanks.

Now, if I have a few Horizontal and Vertical lines on the chart and I wish to retrieve those values for a specific line am I correct by assuming that I will have to create this specific line with an ACSIL code and assign to it a "LineNumber" and then I will be able to get its values with sc.GetUserDrawingByLineNumber() ?

Yes, you can do that. Or if you know how many lines you add you can utilize they are numbered sequentially so:

first horizontal line you add (manually on the chart) you get by:

sc.GetChartDrawing(0, DRAWING_HORIZONTALLINE, line, 0)

second one with
sc.GetChartDrawing(0, DRAWING_HORIZONTALLINE, line, 1)

first vertical: sc.GetChartDrawing(0, DRAWING_VERTICALLINE, line, 0)
second vertical: sc.GetChartDrawing(0, DRAWING_VERTICALLINE, line, 1)

Reply With Quote
Thanked by:
  #6 (permalink)
 yonatan 
Haifa Israel
 
Experience: Beginner
Platform: sierra chart
Broker: Optimus Trading Group/Rithmic
Trading: es
Posts: 91 since Apr 2012
Thanks Given: 50
Thanks Received: 71


ktrader View Post
Yes, you can do that. Or if you know how many lines you add you can utilize they are numbered sequentially so:

first horizontal line you add (manually on the chart) you get by:

sc.GetChartDrawing(0, DRAWING_HORIZONTALLINE, line, 0)

second one with
sc.GetChartDrawing(0, DRAWING_HORIZONTALLINE, line, 1)

first vertical: sc.GetChartDrawing(0, DRAWING_VERTICALLINE, line, 0)
second vertical: sc.GetChartDrawing(0, DRAWING_VERTICALLINE, line, 1)


Great. Thanks again ktrader. This was very very helpful.

Started this thread Reply With Quote
  #7 (permalink)
 funk101 
Margate, Fl.
 
Experience: Advanced
Platform: SierraCharts
Trading: Futures
Posts: 28 since Jun 2009
Thanks Given: 5
Thanks Received: 5

I'm auto-drawing ellipses, I have:

s_UseTool EllipseTool;
EllipseTool.AddMethod = UTAM_ADD_OR_ADJUST;

and when the tool gets drawn I set:

int uid = rand();
EllipseTool.LineNumber = uid;

The Ellipse drawing starts and then a couple of bars later, when certain parameters are met, I want to "close" the Ellipse.
How do I call *that* particular Ellipse?

I have this, and works about 90%:

if (sc.LineExists(sc.ChartNumber, uid)
{
blah;
}

many tools are drawn and closed as expected, however one seems to be hanging from the beginning of the chart to the current index. Which leads me to believe the code has missed this particular LineNumber, or something. Which then leads me to believe that I need more control and how to call each generated Ellipse. Any ideas?

Reply With Quote
  #8 (permalink)
 yonatan 
Haifa Israel
 
Experience: Beginner
Platform: sierra chart
Broker: Optimus Trading Group/Rithmic
Trading: es
Posts: 91 since Apr 2012
Thanks Given: 50
Thanks Received: 71


funk101 View Post
I'm auto-drawing ellipses, I have:

s_UseTool EllipseTool;
EllipseTool.AddMethod = UTAM_ADD_OR_ADJUST;

and when the tool gets drawn I set:

int uid = rand();
EllipseTool.LineNumber = uid;

The Ellipse drawing starts and then a couple of bars later, when certain parameters are met, I want to "close" the Ellipse.
How do I call *that* particular Ellipse?

I have this, and works about 90%:

if (sc.LineExists(sc.ChartNumber, uid)
{
blah;
}

many tools are drawn and closed as expected, however one seems to be hanging from the beginning of the chart to the current index. Which leads me to believe the code has missed this particular LineNumber, or something. Which then leads me to believe that I need more control and how to call each generated Ellipse. Any ideas?


Hi Funk101, I think you better post this in the main sierra charts programming forum ( Sierra Chart Programming - Big Mike's Trading Forum) so it will not hide here in this thread.

Started this thread Reply With Quote




Last Updated on June 25, 2012


© 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