Support Board
Date/Time: Sun, 24 Nov 2024 14:44:52 +0000
Post From: Distinguish the currently active chart from others ?
[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
|