Login Page - Create Account

Support Board


Date/Time: Sun, 24 Nov 2024 15:07:41 +0000



[User Discussion] - Distinguish the currently active chart from others ?

View Count: 296

[2024-05-31 08:19:03]
BenjFlame - Posts: 324
Hi,
is there a visual way, a setting, a color to distinguish the currently active chart from the others ? In particular if the chart's title bar is hidden.
[2024-05-31 15:12:17]
Tony - Posts: 516
can be easily done with ACSIL, what would be ideal signal you prefer? i.e. a word "Active" or a colored square on the top right corner of the chart? If it's not too fancy, I will write a study and post here.
[2024-05-31 16:07:10]
BenjFlame - Posts: 324
Thank you.
A sky blue square would be great.
[2024-05-31 17:12:23]
Tony - Posts: 516
This one was tested and works, you will have to load this study in each chart window. I think it would be more efficient if you could work on Subgraphs if you have custom studies in your chart, by checking this condition:
sc.ChartWindowHandle == GetFocus()

In case you need instructions on how to build custom studies from source code, here is the link:
How to Build an Advanced Custom Study from Source Code


Here is the code for the study:
#include "sierrachart.h"

SCDLLName("ChartActivated")

SCSFExport scsf_ChartActivated(SCStudyInterfaceRef sc)
{

  if (sc.SetDefaults)
  {
    sc.GraphName = "Chart Activated";
    sc.GraphRegion = 0;
    sc.AutoLoop = 1;
    sc.UpdateAlways = 1;
    
    sc.Input[0].Name = "Vertical Position";
    sc.Input[0].SetInt(92);
    
    sc.Input[1].Name = "Horizontal Position";
    sc.Input[1].SetInt(120);

    sc.Input[2].Name = "Square Size";
    sc.Input[2].SetInt(2);
    
    sc.Input[3].Name = "Square Color";
    sc.Input[3].SetColor(127,127,255);
    
    return;
  }
  
  
  s_UseTool Tool;
  Tool.Clear();
  Tool.ChartNumber = sc.ChartNumber;

  Tool.LineNumber = 74191;
  Tool.DrawingType = DRAWING_RECTANGLEHIGHLIGHT;
  Tool.UseRelativeVerticalValues = 1;

  Tool.BeginDateTime = sc.Input[1].GetInt();
  Tool.EndDateTime = sc.Input[1].GetInt() + (sc.ChartWindowHandle == GetFocus() ? (int)(sc.Input[2].GetInt()*2.5) : 0);
  Tool.BeginValue = sc.Input[0].GetInt();
  Tool.EndValue = sc.Input[0].GetInt() + (sc.ChartWindowHandle == GetFocus() ? sc.Input[2].GetInt() : 0);

  Tool.LineWidth = 0;
  Tool.SecondaryColor = sc.Input[3].GetColor();
  Tool.AddMethod = UTAM_ADD_OR_ADJUST;

  sc.UseTool(Tool);

}

Date Time Of Last Edit: 2024-05-31 17:31:49
[2024-06-02 13:45:15]
BenjFlame - Posts: 324
Thank you very much. It works well. Well done !

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

Login

Login Page - Create Account