Login Page - Create Account

Support Board


Date/Time: Sat, 05 Jul 2025 18:21:20 +0000



[Programming Help] - Region Regen or similar solution?

View Count: 570

[2020-06-03 07:04:19]
Giovanni II - Posts: 25
Hi,
I have done a new Volume indicator with more informations. I can choose what information the indicator should display for not having too much information on the screen.

The problem I have is that if I decide to remove an information from the menu, the indicator continues to show it for the previous candles.. to remove the information from the region of the indicator I have to give the command Chart -> Reload and Recalculate..
Is there one more quick way to get the same result without having to manually run the command every time I want to add or remove informations from the indicator?

//This is the basic framework of a study function. Change the name 'TemplateFunction' to what you require.
SCSFExport scsf_Volume2(SCStudyInterfaceRef sc)
{
  SCSubgraphRef Subgraph_Volume = sc.Subgraph[0];
  SCSubgraphRef Subgraph_Delta = sc.Subgraph[1];
  SCSubgraphRef Subgraph_MediaVolumi = sc.Subgraph[2];
  SCSubgraphRef Subgraph_MediaDelta = sc.Subgraph[3];
  SCSubgraphRef Subgraph_MoltDelta = sc.Subgraph[4];
  SCSubgraphRef Subgraph_MoltVolumi = sc.Subgraph[5];
  SCSubgraphRef Subgraph_MoltDelta2 = sc.Subgraph[6];
  SCSubgraphRef Subgraph_MediaAsk = sc.Subgraph[7];
  SCSubgraphRef Subgraph_MediaBid = sc.Subgraph[8];
  SCSubgraphRef Subgraph_MoltAsk = sc.Subgraph[9];
  SCSubgraphRef Subgraph_MoltBid = sc.Subgraph[10];

  SCInputRef BarreV_Si = sc.Input[1];  
  SCInputRef BarreD_Si = sc.Input[2];  
  SCInputRef MediaV_Si = sc.Input[3];
  SCInputRef Media_Volumi = sc.Input[4];
  SCInputRef Molti_Volumi = sc.Input[5];
  SCInputRef MediaD_Si = sc.Input[6];
  SCInputRef Media_Delta = sc.Input[7];
  SCInputRef Molti_Delta = sc.Input[8];
  SCInputRef MediaAsk_Si = sc.Input[9];
  SCInputRef Media_Ask = sc.Input[10];
  SCInputRef Molti_Ask = sc.Input[11];
  SCInputRef MediaBid_Si = sc.Input[12];
  SCInputRef Media_Bid = sc.Input[13];
  SCInputRef Molti_Bid = sc.Input[14];
  
  if (sc.SetDefaults)
  {
    sc.GraphName = "Volume 2";

    sc.ValueFormat = 0;
    sc.AutoLoop = true;
    sc.ScaleRangeType = SCALE_ZEROBASED;

    Subgraph_Volume.Name = "Volume";
    Subgraph_Volume.DrawStyle = DRAWSTYLE_BAR;
    Subgraph_Volume.AutoColoring = AUTOCOLOR_BASEGRAPH;
    Subgraph_Volume.PrimaryColor = RGB(0, 128, 0);
    Subgraph_Volume.SecondaryColor = RGB(147, 0, 0);
    Subgraph_Volume.DrawZeros = false;
    Subgraph_Volume.LineWidth = 2;

    Subgraph_Delta.Name = "Volume Delta";
    Subgraph_Delta.DrawStyle = DRAWSTYLE_BAR;
    Subgraph_Delta.AutoColoring = AUTOCOLOR_POSNEG;//in funzione del valore negativo o positivo
    Subgraph_Delta.PrimaryColor = RGB(0, 255, 0);
    Subgraph_Delta.SecondaryColor = RGB(255, 0, 0);
    Subgraph_Delta.DrawZeros = false;
    Subgraph_Delta.LineWidth = 2;
    
    Subgraph_MediaVolumi.Name = "Media Volumi";
    Subgraph_MediaVolumi.DrawStyle = DRAWSTYLE_DASH;
    Subgraph_MediaVolumi.PrimaryColor = RGB(0, 128, 255);
    Subgraph_MediaVolumi.DrawZeros = false;
    Subgraph_MediaVolumi.LineWidth = 2;    

    Subgraph_MediaDelta.Name = "Media Delta";
    Subgraph_MediaDelta.DrawStyle = DRAWSTYLE_DASH;
    Subgraph_MediaDelta.PrimaryColor = RGB(255, 128, 0);
    Subgraph_MediaDelta.DrawZeros = false;
    Subgraph_MediaDelta.LineWidth = 2;  

    Subgraph_MediaAsk.Name = "Media Ask";
    Subgraph_MediaAsk.DrawStyle = DRAWSTYLE_LINE;
    Subgraph_MediaAsk.PrimaryColor = RGB(0, 250, 0);
    Subgraph_MediaAsk.DrawZeros = false;
    Subgraph_MediaAsk.LineWidth = 2;  

    Subgraph_MediaBid.Name = "Media Bid";
    Subgraph_MediaBid.DrawStyle = DRAWSTYLE_LINE;
    Subgraph_MediaBid.PrimaryColor = RGB(250, 0, 0);
    Subgraph_MediaBid.DrawZeros = false;
    Subgraph_MediaBid.LineWidth = 2;  
    
    Media_Volumi.Name = "Periodo Media Volumi";
    Media_Volumi.SetInt(5);

    Media_Delta.Name = "Periodo Media Delta";
    Media_Delta.SetInt(5);

    Molti_Delta.Name = "Moltiplicatore Media Delta";
    Molti_Delta.SetInt(3);

    Molti_Volumi.Name = "Moltiplicatore Media Volumi";
    Molti_Volumi.SetInt(1);
    
    MediaV_Si.Name = "Media Mobile Volumi?";
    MediaV_Si.SetYesNo(1);//1 = Yes, 0 = No  

    MediaD_Si.Name = "Media Mobile Delta?";
    MediaD_Si.SetYesNo(1);//1 = Yes, 0 = No  

    BarreV_Si.Name = "Barre Volume?";
    BarreV_Si.SetYesNo(1);//1 = Yes, 0 = No  

    BarreD_Si.Name = "Barre Delta?";
    BarreD_Si.SetYesNo(1);//1 = Yes, 0 = No  

    MediaAsk_Si.Name = "Media Mobile Ask?";
    MediaAsk_Si.SetYesNo(1);//1 = Yes, 0 = No  

    MediaBid_Si.Name = "Media Mobile Bid?";
    MediaBid_Si.SetYesNo(1);//1 = Yes, 0 = No  
    
    Media_Ask.Name = "Periodo Media Ask";
    Media_Ask.SetInt(5);    

    Media_Bid.Name = "Periodo Media Bid";
    Media_Bid.SetInt(5);  
    
    Molti_Ask.Name = "Moltiplicatore Media Ask";
    Molti_Ask.SetInt(1);    

    Molti_Bid.Name = "Moltiplicatore Media Ask";
    Molti_Bid.SetInt(1);
    return;
  }

Date Time Of Last Edit: 2020-06-03 07:05:01
imagevolume2_a.jpg / V - Attached On 2020-06-03 07:04:39 UTC - Size: 53.53 KB - 248 views
imagevolume2_b.jpg / V - Attached On 2020-06-03 07:04:53 UTC - Size: 65.23 KB - 196 views

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

Login

Login Page - Create Account