Login Page - Create Account

Support Board


Date/Time: Sun, 24 Nov 2024 20:27:18 +0000



Post From: Change Color of Chart Background in Simulation Mode

[2024-05-03 17:49:28]
jsandlan - Posts: 46
In case anyone else would like a way to do this I put together this simple custom ASCIL study to change the background color when in simulation and to apply no background color when not in simulation.


#include "sierrachart.h"

SCDLLName("Simulation Background Color")

SCSFExport scsf_SimulationBackgroundColor(SCStudyInterfaceRef sc)
{
  int TradeSimulationIsOn = sc.GlobalTradeSimulationIsOn;
  SCSubgraphRef Subgraph_Background = sc.Subgraph[0];
  // Set the configuration and defaults
  sc.GraphName = "Simulation Background Color";
  sc.StudyDescription = "Simulation Background Color";
  sc.AutoLoop = true;
  sc.GraphRegion = 0;
  sc.DrawStudyUnderneathMainPriceGraph = 1; // not required in studies, but want color behind price for this study
  Subgraph_Background.Name = "Simulation Background Color";
  Subgraph_Background.DrawStyle = DRAWSTYLE_BACKGROUND;
  Subgraph_Background.PrimaryColor = RGB(210,255,210);

  if (TradeSimulationIsOn)
  {
    Subgraph_Background[sc.Index] = 1;
    return;
  }
  else
  {
    Subgraph_Background[sc.Index] = 0;
    return;
  }
}


Date Time Of Last Edit: 2024-05-03 17:50:41