Login Page - Create Account

Support Board


Date/Time: Tue, 26 Nov 2024 20:26:33 +0000



Post From: is it possible to hide/show all studies with a single mouse-click?

[2023-10-30 14:23:27]
Tony - Posts: 519
Thanks @User431178!

@raheemrazzak previous code modified and tested, assumed the Simple Moving Aaverage
is on the top of study's list, but its study ID is not 1 (i.e. ID 6), this is so much easier,
no Short Name entries are needed. (1 based Index)


#include "sierrachart.h"

SCDLLName("KeyToHide")

SCSFExport scsf_KeyToHide(SCStudyInterfaceRef sc)
{
  if (sc.SetDefaults)
  {
    sc.GraphName = "Key To Hide";
    sc.GraphRegion = 0;
    sc.AutoLoop = 1;
    sc.UpdateAlways = 1;
    sc.ReceiveCharacterEvents = 1;    
    return;
  }
  
  static int VisibilityOfGroup1 {1};
  static int VisibilityOfGroup2 {1};
  
  if (sc.CharacterEventCode==113) // "q"uick hide
    VisibilityOfGroup1 = !VisibilityOfGroup1;
    
  if (VisibilityOfGroup1) {
    sc.SetStudyVisibilityState(sc.GetStudyIDByIndex(sc.ChartNumber, 1), 1);
    //sc.SetStudyVisibilityState(sc.GetStudyIDByIndex(sc.ChartNumber, 2), 1);
    //sc.SetStudyVisibilityState(sc.GetStudyIDByIndex(sc.ChartNumber, 3), 1);
  }
  else {
    sc.SetStudyVisibilityState(sc.GetStudyIDByIndex(sc.ChartNumber, 1), 0);
    //sc.SetStudyVisibilityState(sc.GetStudyIDByIndex(sc.ChartNumber, 2), 0);
    //sc.SetStudyVisibilityState(sc.GetStudyIDByIndex(sc.ChartNumber, 3), 0);
  }
}

Date Time Of Last Edit: 2023-10-30 14:53:26