Is it possible to Get graphics/Windows control in SC/ACSIL? - futures io
futures io futures trading



Is it possible to Get graphics/Windows control in SC/ACSIL?


Discussion in Sierra Chart

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




Welcome to futures io: the largest futures trading community on the planet, with well over 125,000 members
  • Genuine reviews from real traders, not fake reviews from stealth vendors
  • Quality education from leading professional traders
  • We are a friendly, helpful, and positive community
  • We do not tolerate rude behavior, trolling, or vendors advertising in posts
  • We are here to help, just let us know what you need
You'll need to register in order to view the content of the threads and start contributing to our community.  It's free and simple.

-- Big Mike, Site Administrator

(If you already have an account, login at the top of the page)

 
Search this Thread
 

Is it possible to Get graphics/Windows control in SC/ACSIL?

(login for full post details)
  #1 (permalink)
Portland, OR
 
Experience: Intermediate
Platform: Sierra Chart
Trading: ES
 
Posts: 269 since Jan 2011
Thanks: 327 given, 180 received

Hello - Need some help/guidance/clarification dealing with better graphics control in Sierra platform for generic graphics related tasks.

In Ninja - One can have better control over plots using plot(Graphics graphics, Rectangle bounds, double min, double max) etc and can use various brushes etc to draw text/rectangles etc with ease. I am trying to mimic something similar in Sierra but so far stuck with this task.

Has anyone done any work in this space in Sierra? Can any one review this code and suggest any options?

Wondering if anyone has done any work with Windows GDI so that I can convert portion of the code from Ninja to Sierra ( Graphics graphics, Rectangle bounds, double min, double max) - https://www.sierrachart.com/index.php?page=doc/error.php

PS: Have opened a thread in Sierra forum as well - https://www.sierrachart.com/index.php?page=doc/error.php

Code:
 
Code
	if (sc.SetDefaults)
	{
		sc.GraphName = "UseTool";
		sc.StudyDescription = "UseTool";
		sc.GraphRegion = 0;
		sc.FreeDLL = 1;
		
		sc.AutoLoop = 0; 

		return;
	}

	if (sc.UpdateStartIndex == 0)
	{
		sc.NumFillSpaceBars = 20;
		sc.PreserveFillSpace = true;
		sc.UpdateAlways=1;
	}
	
        static const int UniqueLineNumber = (sc.ChartNumber+sc.StudyGraphInstanceID)*1000;

	s_UseTool Tool;
	Tool.Clear();

	Tool.ChartNumber = sc.ChartNumber;
	Tool.Region = sc.GraphRegion;
	Tool.DrawUnderneathMainGraph=1;
	Tool.TextAlignment = DT_RIGHT | DT_VCENTER;

	int BarIndex=sc.IndexOfLastVisibleBar;
	float BarValue=sc.Close[BarIndex];
	SCString ValueText=sc.FormatGraphValue(BarValue,sc.GetValueFormat());
	int offset=(int)(sc.NumFillSpaceBars/3);
	int lineStartIdx=BarIndex;
	int lineEndIdx=BarIndex+offset;
	int rectStartIdx=lineEndIdx;
	int rectEndIdx=rectStartIdx+ValueText.GetLength();  // Is this the correct way to get the string length? Based on the image - it doesn't look like
	int textStartIdx=rectStartIdx;

	Tool.Clear();
	Tool.Tool=DRAWING_LINE;
	Tool.TextAlignment=DT_RIGHT;
	Tool.LineNumber =  UniqueLineNumber + 1;
	Tool.BeginIndex=lineStartIdx;
	Tool.EndIndex=lineEndIdx;
	Tool.BeginValue=BarValue;
	Tool.EndValue=BarValue;
	Tool.Color = RGB(255,0,0);
	Tool.LineWidth = 1;
	Tool.AddMethod = UTAM_ADD_OR_ADJUST;
	sc.UseTool(Tool);

	Tool.Clear();
	Tool.ChartNumber = sc.ChartNumber;
	Tool.Tool = TOOL_RECTANGLE_HIGHLIGHT;
	Tool.LineNumber = UniqueLineNumber + 2;
	Tool.BeginIndex=rectStartIdx;
	Tool.EndIndex=rectEndIdx;
	// Ideally Begin/End Values for Rectangle should be calculated based on the Text Real Height - which is dependent on the font-size
	// But Don't know how to calculate this in SC..
	Tool.BeginValue=BarValue+(sc.TickSize/2);  // there should be an intelligent way to handle this based on font size and should be independent of the scaling/instrument
	Tool.EndValue=BarValue-(sc.TickSize/2);   // there should be an intelligent way to handle this based on font size and should be independent of the scaling/instrument
	Tool.Color = RGB(255,0,0); // Red
	Tool.LineWidth = 1;
	Tool.SecondaryColor = RGB(0,255,0); // Green
	Tool.TransparencyLevel = 90;
	Tool.AddMethod = UTAM_ADD_OR_ADJUST;
	sc.UseTool(Tool);

	Tool.Clear();
	Tool.DrawingType = DRAWING_TEXT;
	Tool.LineNumber = UniqueLineNumber + 3;
	//Tool.UseRelativeValue = true;
	Tool.Color = RGB(255,255,255);  //WHITE
	Tool.TextAlignment = DT_RIGHT | DT_VCENTER;
	Tool.FontBackColor = sc.ChartBackgroundColor; //   GREEN;
	Tool.FontBold = false;

	Tool.Text = ValueText;
	Tool.BeginValue = BarValue;
	//Tool.BeginIndex=textStartIdx;  // Don't know why can't get this to work instead of BeginDateTime
	Tool.BeginDateTime=sc.BaseDateTimeIn[BarIndex+10];  // Would be nice to get this into BarIndex mode rather than time
	Tool.FontSize = 10;
	Tool.AddMethod = UTAM_ADD_OR_ADJUST;
	Tool.ReverseTextColor = false;
	sc.UseTool(Tool);

Attached Thumbnails
Click image for larger version

Name:	SC_Text_rectangle_1.png
Views:	121
Size:	23.5 KB
ID:	102276   Click image for larger version

Name:	SC_Text_rectangle_2.png
Views:	86
Size:	22.8 KB
ID:	102277   Click image for larger version

Name:	Ninja_Text_In_Rectangles.png
Views:	87
Size:	7.7 KB
ID:	102278  
Started this thread Reply With Quote

Can you help answer these questions
from other members on futures io?
COTbase for quant trading?
Elite Algorithmic NinjaTrader Trading
Webinar: Finding your own way in trading w/Adam Grimes
The Elite Circle
If ES tracks SPX, why do support/resistance, Level 2, vo …
Emini and Emicro Index
Short Interest Ratio indicator?
ThinkOrSwim
Indicators for pair trading MES and M2K
Platforms and Indicators
 
Best Threads (Most Thanked)
in the last 7 days on futures io
Selling Options on Futures?
109 thanks
Battlestations: Show us your trading desks!
108 thanks
Rank your Futures vs Stocks trading priority
55 thanks
Want your NinjaTrader indicator created, free?
27 thanks
Whats this confusion with margins?
23 thanks


futures io Trading Community Platforms and Indicators Sierra Chart > Is it possible to Get graphics/Windows control in SC/ACSIL?


Last Updated on February 10, 2013


Upcoming Webinars and Events
 

NinjaTrader Indicator Challenge!

Ongoing
 

Battlestations! Show us your trading desk - $1,500 in prizes!

March
 

Importance of Finding Your Own Way w/Adam Grimes

Elite only
 

Journal Challenge w/Jigsaw

April
     



Copyright © 2021 by futures io, s.a., Av Ricardo J. Alfaro, Century Tower, Panama, +507 833-9432, info@futures.io
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.
no new posts