Login Page - Create Account

Support Board


Date/Time: Fri, 19 Apr 2024 04:12:40 +0000



Displaying an image on a trading chart

View Count: 2976

[2018-06-20 16:08:00]
User906224 - Posts: 14
Is it possible to display an image e.g. a logo or picture from a PNG or JPG file directly onto an area of a trading chart?
[2018-06-25 17:07:19]
User906224 - Posts: 14
The use case for this is perhaps for a vendor, broker, or other partner to display a logo directly onto the chart (a transparency-supporting .PNG file) or to mark trades with custom arrows that might also be a transparency-supporting .PNG. There are many other similar use cases - custom fonts, or fancier custom visualizations, etc. It would be a bonus if clicks on the image can be intercepted. Ideally, they would be detectable and run arbitrary ACSIL code, but if not, perhaps just allow a URL to be specified and open the link with the default browser if the URL is specified and the image is clicked.
Date Time Of Last Edit: 2018-06-25 17:07:49
[2018-06-25 17:17:09]
Sierra Chart Engineering - Posts: 104368
Well you can certainly mark trades with arrows and other types of draw styles currently supported by Sierra Chart.

We really do not see adding the capability you are looking for. We have marked this as a User Discussion.

You can certainly draw text on a chart, and use whatever system font is available.
Sierra Chart Support - Engineering Level

Your definitive source for support. Other responses are from users. Try to keep your questions brief and to the point. Be aware of support policy:
https://www.sierrachart.com/index.php?l=PostingInformation.php#GeneralInformation

For the most reliable, advanced, and zero cost futures order routing, *change* to the Teton service:
Sierra Chart Teton Futures Order Routing
[2018-06-25 17:26:53]
User906224 - Posts: 14
Yes, you can display text on a chart; however, you cannot display a vendor's logo (short of creating a font and installing the font onto the user's machine, which is a very long way around the barn for this). Suppose the vendor wants to display something unusual - perhaps a pie chart or meter display next to a set of bars. How would they do that? It's trivial in .NET platforms, but in SC is essentially impossible. As a workaround, though, if you were to simply make a type of drawing tool that has a property to specify the .PNG file to be displayed at the tool's position, we could then simply output the visualization we want to a temporary file and add a drawing tool that displays it at the right spot on the chart. You're right, it is not a critical need, but it is a feature gap between SC and its competitors because unlike with .NET the SC architecture does not allow a programmer to output directly to the screen. What I was proposing was a way for you to provide that capability, at least in a basic way.
[2018-06-25 17:30:20]
User906224 - Posts: 14
Alternatively, you could expose the Windows handles for the screen so that we could draw directly on the chart from ACSIL using the handles. That would require a higher level of capability on the part of the programmer but would be the most flexible thing you could do that would essentially put it all on them to get it right.
[2018-06-25 17:31:14]
Sierra Chart Engineering - Posts: 104368
? It's trivial in .NET platforms, but in SC is essentially impossible
You know actually this is taken as an overwhelming complement. We really do appreciate that. And that is the honest truth. Essentially when anyone compares us to .NET, we cannot help but think about the absolute trash that that crap is. And we really do not care if we offend anyone. It becomes so obviously clear, day after day after day after day, how the Sierra Chart architecture is superior to everything out there, and how we stand way above everyone else when it comes to quality speed and reliability. Computer software is in a state of deterioration at this point, but we continue to excel. And there is all kinds of work we are currently doing to improve Sierra Chart further and further which does not involve Microsoft and their trash. It allows us to adapt Sierra Chart to other operating systems.

And really we do not care if anyone else does not agree with us.

Nevertheless, there is a lot of room for improvement in Sierra Chart, and that is what we are working hard with. We do not talk about everything we are doing, but there is a lot going on and planned.


but it is a feature gap between SC and its competitors because unlike with .NET the SC architecture does not allow a programmer to output directly to the screen
Really, this does not bother us but anyway we thought of a way you can do this. Actually this has been supported for many years now.

Refer to:
ACSIL Programming Concepts: Custom Free Form Drawing into Chart Window Using GDI (Graphics Device Interface)
Sierra Chart Support - Engineering Level

Your definitive source for support. Other responses are from users. Try to keep your questions brief and to the point. Be aware of support policy:
https://www.sierrachart.com/index.php?l=PostingInformation.php#GeneralInformation

For the most reliable, advanced, and zero cost futures order routing, *change* to the Teton service:
Sierra Chart Teton Futures Order Routing
Date Time Of Last Edit: 2018-06-25 17:40:13
[2018-06-25 17:38:22]
User906224 - Posts: 14
I understand your stance regarding .NET - that's fine - I was only concerned with finding a way to do the functionality and have absolutely no axe to grind here - I just wanted a way to meet a client's need.

The link you posted on CustomFreeFormDrawing will allow me to do what they wanted, I think. I will proceed in that direction. Thank you.
[2018-06-25 17:42:17]
Sierra Chart Engineering - Posts: 104368
Yes, it definitely should. It is very well implemented. And thinking about that at some point we can also when we are finished, provide our GDI wrapper that we are currently developing. It will also support OpenGL as well.

The other thing we want to mention, is that obviously you have to be able to resolve particular coordinates on the chart, to specific pixel coordinates on the chart window. We are fairly sure, that every function and variable that you need exists within that the existing sc structure to do this. So be sure to refer to what is available in the documentation. If not, we can add what you need or suggest how to do this.
Sierra Chart Support - Engineering Level

Your definitive source for support. Other responses are from users. Try to keep your questions brief and to the point. Be aware of support policy:
https://www.sierrachart.com/index.php?l=PostingInformation.php#GeneralInformation

For the most reliable, advanced, and zero cost futures order routing, *change* to the Teton service:
Sierra Chart Teton Futures Order Routing
[2018-06-25 17:44:44]
User906224 - Posts: 14
Thank you.
[2018-06-26 20:10:19]
User906224 - Posts: 14
If an image is displayed in this manner using GDI direct access and we turn on mouse events for all tools, and a click event is received, we can access sc.ActiveToolIndex for the bar index or sc.ActiveToolYPosition for the vertical position in pixels, but is there a corresponding property to give us back the horizontal pixel position of the click in pixels within the area on which we have drawn? This would enable us to determine if the image we have drawn has been clicked, as it may not correspond to a specific bar e.g. if it's always in a chart corner or is an irregular shape, etc.
Date Time Of Last Edit: 2018-06-26 20:13:21
[2018-06-26 20:11:00]
User906224 - Posts: 14
On a similar note, but for a different use case, is there a way to determine the X and Y position in pixels of a given bar index and price? This pixel location could then be used for GDI drawing for the use case in which the drawing is related to a specific bar and price.
Date Time Of Last Edit: 2018-06-26 20:14:09
[2018-06-27 11:51:00]
Sierra Chart Engineering - Posts: 104368
Look for functions and variables that have "coordinate" in the name, you will see ways to do everything that you need. Refer to:

https://www.sierrachart.com/index.php?page=doc/ACSIL_Members_Functions.html
ACSIL Interface Members - Variables and Arrays
Sierra Chart Support - Engineering Level

Your definitive source for support. Other responses are from users. Try to keep your questions brief and to the point. Be aware of support policy:
https://www.sierrachart.com/index.php?l=PostingInformation.php#GeneralInformation

For the most reliable, advanced, and zero cost futures order routing, *change* to the Teton service:
Sierra Chart Teton Futures Order Routing
Date Time Of Last Edit: 2018-06-27 11:51:16
[2018-06-27 11:53:57]
User906224 - Posts: 14
Great - thank you.
[2018-06-27 12:17:03]
Sierra Chart Engineering - Posts: 104368
Please do not say thank you. On this Support Board it is not considered good etiquette to say thank you. There is a thank you button.
Sierra Chart Support - Engineering Level

Your definitive source for support. Other responses are from users. Try to keep your questions brief and to the point. Be aware of support policy:
https://www.sierrachart.com/index.php?l=PostingInformation.php#GeneralInformation

For the most reliable, advanced, and zero cost futures order routing, *change* to the Teton service:
Sierra Chart Teton Futures Order Routing
Date Time Of Last Edit: 2018-06-27 12:17:24
[2019-10-04 04:01:45]
onnb - Posts: 660
Yes, it definitely should. It is very well implemented. And thinking about that at some point we can also when we are finished, provide our GDI wrapper that we are currently developing. It will also support OpenGL as well.

I understand from this you will provide a wrapper for GDI and OpenGL

1. How far in the future is this?
2. For GDI, we currently use the sc.p_GDIFunction - is there going to be an equivalent for OpenGL ?
[2019-10-04 06:57:13]
Sierra Chart Engineering - Posts: 104368
I understand from this you will provide a wrapper for GDI and OpenGL

1. How far in the future is this?
We do not think we want to do this because we cannot take the time to document or support this.

2. We will look into this.
Sierra Chart Support - Engineering Level

Your definitive source for support. Other responses are from users. Try to keep your questions brief and to the point. Be aware of support policy:
https://www.sierrachart.com/index.php?l=PostingInformation.php#GeneralInformation

For the most reliable, advanced, and zero cost futures order routing, *change* to the Teton service:
Sierra Chart Teton Futures Order Routing
Date Time Of Last Edit: 2019-10-04 06:57:44
[2019-12-14 05:26:51]
Tony - Posts: 457
I managed to get around this with 'Stationary Text', to handle simple
images like a company logo or a pencil sketch, attached a screen shot of
a Apple logo, Peter Steidlmayer and a picture of my dog in "Stationary.png"

1, use an online ASCII art program like 'Glass Giant' to
convert your image into text.
2, paste text into 'Stationary Text', choose a font
that all letters have equal width, and set size to 1.
3, pick up what ever colour you like. (the Apple logo
consists 6 pieces of 'Stationary Text' on top of another)

You don't want your picture be too big, because maximum lines
'Stationary Text' can display is 125, (125 vertical 'pixels')
Human faces could be a bit tricky, you will have to convert
the image to pencil sketch style first, by using a image
processing program like GIMP, so it would have a realistic
looking.

For larger images, as the example shows in Image.png, size of 400x500 pixels,
you need a custom study to display text file by compiling following code, change
the font name (Noto Mono), folder location and size of text file (320K) if necessary:


//code start
#include "sierrachart.h"
SCDLLName("ImageToText")
SCSFExport scsf_ASCII_Art(SCStudyInterfaceRef canvas)
{
  SCInputRef HorizonPos = canvas.Input[0];
  SCInputRef VerticalPos = canvas.Input[1];
  SCInputRef TextColor = canvas.Input[2];
  SCInputRef FilePath = canvas.Input[3];
  
  if (canvas.SetDefaults) {
    canvas.GraphName = "ASCII Art";
    canvas.GraphRegion = 0;
    HorizonPos.Name = "Horizontal Position";
    HorizonPos.SetInt(12);
    VerticalPos.Name = "Vertical Position";
    VerticalPos.SetInt(98);
    TextColor.Name = "Text Color";
    TextColor.SetColor(0, 0, 0);
    FilePath.Name = "ASCII Text File";
    FilePath.SetPathAndFileName("C:\\SierraChart\\ASCII\\");
    return;
  }
  
  if (!canvas.HideStudy && !canvas.Index) {
    char TextPixels[320000] = {};
    int FileHandle = 1;
    unsigned int *p_BytesRead = new unsigned int(0);
    canvas.OpenFile(FilePath.GetPathAndFileName(), 2, FileHandle); //Open Mode: 2 (open for read only),
    canvas.ReadFile(FileHandle, TextPixels, 320000, p_BytesRead);
    canvas.CloseFile(FileHandle);

    s_UseTool Pencil;
    Pencil.Clear();
    Pencil.DrawingType = DRAWING_TEXT;
    Pencil.LineNumber = 2; //has to be greater than 0, set 0 will cause repetitive drawing
    Pencil.UseRelativeVerticalValues = 1;
    Pencil.BeginDateTime = HorizonPos.GetInt();
    Pencil.BeginValue = VerticalPos.GetInt();
    Pencil.AddMethod = UTAM_ADD_ALWAYS;
    Pencil.Color = TextColor.GetColor();
    Pencil.FontSize = 1;
    Pencil.Text = TextPixels;
    Pencil.FontFace = "Noto Mono";
    canvas.UseTool(Pencil);
  }
}
//code end
Date Time Of Last Edit: 2020-06-11 05:10:13
imageStationary.png / V - Attached On 2019-12-21 06:32:05 UTC - Size: 58.18 KB - 565 views
imageImage.png / V - Attached On 2020-02-20 06:02:51 UTC - Size: 265.66 KB - 601 views
[2021-11-27 12:22:45]
User422070 - Posts: 2
Amazing! Now just need the logo to change for the correct chart symbol loaded.
Maybe there's a way to load all the text images into the Study settings window?

Great work :)
Attachment Deleted.
imageLogo_on_Chart.JPG / V - Attached On 2021-11-27 12:21:48 UTC - Size: 69.57 KB - 229 views
[2021-11-27 15:42:53]
user8888 - Posts: 158
Great!

But how about Sierra Chart allowing us to set a gradient color for a chart background?. Or what about a translucent background?

Cheers
[2021-11-30 05:32:42]
Tony - Posts: 457
Thanks User422070. Of cause there is a way, I always feel that
with ACSIL, the only limit is our imagination. There are few
steps, 1st you need to find out the exact symbol string by using
sc.Symbol variable, i.e. 'NFLX' 'CMG' etc, save each text image
to file like NFLX.txt, CMG.txt, then inside 'if (!sc.Index)' block,
load a text file according the symbol on the chart, you are done.

if (!sc.Index) {} is only executed once, but each time you change
the symbol on a chart, the study will be re-loaded, meaning,
if (!sc.Index) {} will be executed again, so, it feels like logo
is "automatically" changed every time you change the symbol, although
no coding is involved. It is easier to change the study in post #17
as a function (above all study functions).

If you are not into coding, there is a quick dirty way by changing 3rd line in post #17:
SCSFExport scsf_ASCII_Art(SCStudyInterfaceRef canvas)
to SCSFExport scsf_NFLX(SCStudyInterfaceRef canvas), also:
canvas.GraphName = "ASCII Art"; to canvas.GraphName = "NFLX";

Copy and paste from 3rd to end and change study and graph names for another stocks
now you have multiple studies in TextToImage.dll, then you can pick one of them along
with other studies you use for every chart, save them as a study collection: i.e.
NFLX.StdyCollct.

user8888, not sure what you are trying to achieve, I would like
to imagine that background would have negative impact to your judgment.
If you just want some horizontal colour stripes based on price levels,
then you need 2 subgraphs for each stripe, set each one of those 2 subgraphs
to whatever value you need, and one as Fill Top, the other as Fill Bottom
(see attachment)

for (int IndexCount = sc.IndexOfLastVisibleBar; IndexCount >= sc.IndexOfFirstVisibleBar; IndexCount--) {
SubgraphTop[IndexCount] = MyLevel_1;
SubgraphBottom[IndexCount] = MyLevel_2;
}

Hope that would help.
Date Time Of Last Edit: 2022-01-28 19:01:07
imageStripe.png / V - Attached On 2021-11-30 05:30:09 UTC - Size: 19.14 KB - 251 views
[2021-11-30 07:49:54]
User422070 - Posts: 2
Hi Tony,

Thanks so much for your replies and solutions. My brother is a coder and got it working over the weekend. Pretty damn shabby :)
I will be spending many nights creating ASCII art, it's pretty cool when you get into creating them!

I've passed your message to my brother who will be very pleased to hear your suggestions.

Cheers!
Date Time Of Last Edit: 2021-11-30 07:53:04

To post a message in this thread, you need to log in with your Sierra Chart account:

Login

Login Page - Create Account