Login Page - Create Account

Support Board


Date/Time: Fri, 19 Apr 2024 02:52:06 +0000



[User Discussion] - Custom scale for each instrument

View Count: 1731

[2014-08-01 00:34:06]
User52538 - Posts: 11
I have one QuoteBoard linked "by symbol" to the chart window.
How can I set up individual scale for each instrument(I mean "scale increment" and "horizontal grid line increment")?
I want see grid line increment on GOLD FUTURE as 1.0 and on 6E FUTURE as 0.001, for example.

Thank you.
[2014-08-01 17:51:34]
Sierra Chart Engineering - Posts: 104368
This is not supported. You need to use separate charts for this and keep the symbol the same for those charts.
Sierra Chart Support - Engineering Level

Your definitive source for support. Other responses are from users. Try to keep your questions brief and to the point. Be aware of support policy:
https://www.sierrachart.com/index.php?l=PostingInformation.php#GeneralInformation

For the most reliable, advanced, and zero cost futures order routing, *change* to the Teton service:
Sierra Chart Teton Futures Order Routing
[2014-08-04 08:02:46]
User52538 - Posts: 11
Too pity. Cause you have option for showing drawings for each instrument, this could be as another option - save scale settings for each instrument on the particular chart on changing symbol event (system knows when sym is changing, and with loadind drawings and prices could load a scale values).

Being experienced(more than 15 years) in programming, I dont see any difficulties to add some new data structure, save it on chaning event and loading when symbol activated. Small detail, but it could improve usability a lot)

If you dont want to do this, please tell me if it is possible to make some script using your lang? If possible, I'll make it myself.

I need to:
-know when sym is changing and make some action befote it(save current scale for current sym)
-access to files or any structures to save/load data
-change scale values with scripts

If all those actions are available for me, I'll study your script lang)

Thank you
[2014-08-06 05:46:37]
vegasfoster - Posts: 444
I'm gonna try this, maybe couple days if you don't do it first.
[2014-08-06 07:49:06]
vegasfoster - Posts: 444
I pretty much have this done, but in order to provide up to x number of symbols, e.g. 10, but not all of the symbols are used, e.g. only 4, I need my function to return false if the symbol field is blank, but it is giving me an error when I try to evaluate an empty string. It says it is empty and I say I know it is, it's supposed to be, but it's not listening to me. I have to figure another way.
Date Time Of Last Edit: 2014-08-06 07:49:30
[2014-08-06 09:55:19]
Sierra Chart Engineering - Posts: 104368
Use ACSIL to do this. Refer to ACSIL here:
https://www.sierrachart.com/index.php?page=doc/doc_CreatingDLLs.html

You can control the chart scale increment:
http://www.sierrachart.com/index.php?page=doc/doc_ACSIL_Members_Variables_And_Arrays.html#scBaseGraphScaleIncrement

It is not possible to set the horizontal grid line increment from ACSIL but we can add this if you require it.
Sierra Chart Support - Engineering Level

Your definitive source for support. Other responses are from users. Try to keep your questions brief and to the point. Be aware of support policy:
https://www.sierrachart.com/index.php?l=PostingInformation.php#GeneralInformation

For the most reliable, advanced, and zero cost futures order routing, *change* to the Teton service:
Sierra Chart Teton Futures Order Routing
Date Time Of Last Edit: 2014-08-06 09:58:08
[2014-08-06 17:20:46]
vegasfoster - Posts: 444
At the bottom is what I have so far. It is designed so you enter "6E" and it will return the scale setting for any symbol containing 6E, e.g. 6EU4. It works fine if the 10 symbol input fields are completed, but if you only want to evaluate 3 symbols and leave the other 7 fields blank, for example, then it is returning the blank field as true because of the wildcard function and using the default scale setting of 50.

It gives me an error if I try to use something like,

if (*first == '')
return false;
I was searching a little bit and tried a couple suggestions such as,

std::string s;
if (s.empty())
but those aren't working for me either.

I also tried evaluating after the function with,

SCString sym1 = sc.Input[i].GetString() == "" ? "zzzzzzzzzzzzzzzz" : sc.Input[i].GetString();
I'll keep working on it, but any suggestions anyone might have would be appreciated.

#include "sierrachart.h"
#include <stdio.h>
#include <stdbool.h>

SCDLLName("ChartScale")

bool match(const char *first, const char *second)
  {
    //if (*first == '')
    //  return false;
    
    if (*first == '\0' && *second == '\0')
      return true;

    if (*first == '*' && *(first+1) != '\0' && *second == '\0')
      return false;

    if (*first == '?' || *first == *second)
      return match(first+1, second+1);

    if (*first == '*')
      return match(first+1, second) || match(first, second+1);
    return false;
  }

/*==========================================================================*/
SCSFExport scsf_ChartScale(SCStudyInterfaceRef sc)
{
  if (sc.SetDefaults)
  {
    sc.GraphName = "ChartScale";
    sc.GraphRegion  = 0;            
    sc.AutoLoop = true;
    sc.FreeDLL = 1;
        
    sc.Input[0].Name = "Symbol 1";
    sc.Input[0].SetString("");
    
    sc.Input[1].Name = "Symbol 1 - Scale in Ticks";
    sc.Input[1].SetInt(50);
        
    sc.Input[2].Name = "Symbol 2";
    sc.Input[2].SetString("");
    
    sc.Input[3].Name = "Symbol 2 - Scale in Ticks";
    sc.Input[3].SetInt(50);
    
    sc.Input[4].Name = "Symbol 3";
    sc.Input[4].SetString("");
    
    sc.Input[5].Name = "Symbol 3 - Scale in Ticks";
    sc.Input[5].SetInt(50);
    
    sc.Input[6].Name = "Symbol 4";
    sc.Input[6].SetString("");
    
    sc.Input[7].Name = "Symbol 4 - Scale in Ticks";
    sc.Input[7].SetInt(50);
    
    sc.Input[8].Name = "Symbol 5";
    sc.Input[8].SetString("");
    
    sc.Input[9].Name = "Symbol 5 - Scale in Ticks";
    sc.Input[9].SetInt(50);
    
    sc.Input[10].Name = "Symbol 6";
    sc.Input[10].SetString("");
    
    sc.Input[11].Name = "Symbol 6 - Scale in Ticks";
    sc.Input[11].SetInt(50);
        
    sc.Input[12].Name = "Symbol 7";
    sc.Input[12].SetString("");
    
    sc.Input[13].Name = "Symbol 7 - Scale in Ticks";
    sc.Input[13].SetInt(50);
    
    sc.Input[14].Name = "Symbol 8";
    sc.Input[14].SetString("");
    
    sc.Input[15].Name = "Symbol 8 - Scale in Ticks";
    sc.Input[15].SetInt(50);
    
    sc.Input[16].Name = "Symbol 9";
    sc.Input[16].SetString("");
    
    sc.Input[17].Name = "Symbol 9 - Scale in Ticks";
    sc.Input[17].SetInt(50);
    
    sc.Input[18].Name = "Symbol 10";
    sc.Input[18].SetString("");
    
    sc.Input[19].Name = "Symbol 10 - Scale in Ticks";
    sc.Input[19].SetInt(50);
    
    return;
  }
  // Do data processing
  
  for (int i = 0; i<20; i = i+2)
  {
    //SCString sym1 = sc.Input[i].GetString() == "" ? "zzzzzzzzzzzzzzzz" : sc.Input[i].GetString();
    SCString sym1 = sc.Input[i].GetString();
    SCString sym2 = "*";
    SCString sym3 = sym1 + sym2;
  
    if(match(sym3, sc.Symbol))    
      sc.BaseGraphScaleIncrement = sc.Input[i+1].GetInt()*sc.TickSize;
  }  
}

[2014-08-06 17:28:38]
vegasfoster - Posts: 444
Maybe what I need is to stop once it finds the first match. Have to learn how to do that.
[2014-08-06 17:44:41]
vegasfoster - Posts: 444
Ok, I tried this but crashing SierraChart every time, hmmmm


int i=0;
  while(i<20)
    {
      SCString sym1 = sc.Input[i].GetString();
      SCString sym2 = "*";
      SCString sym3 = sym1 + sym2;
    
      if(match(sym3, sc.Symbol))    
      {
        sc.BaseGraphScaleIncrement = sc.Input[i+1].GetInt()*sc.TickSize;
        break;    
      }  
    i+2;
    }


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

Login

Login Page - Create Account