Login Page - Create Account

Support Board


Date/Time: Fri, 03 May 2024 08:13:32 +0000



Getting error messages all over the place.

View Count: 1068

[2017-06-24 19:36:32]
Ernest - Posts: 10
Hello, I am very very new to this platform so help me out.

I am starting to learn to programm in Sierra and this is probably a very stupid error but I just can't figuri out. What I am trying to do is draw a ractangle on the actual index bar if the previous bar high is less that the actual bar close with the condition that the actual bar high > actual bar close (bullish). I copied some code from the study.cpp file.. The error I am getting I think it has to do with the data type "float". I dont know what is going on here. Thanks



//Start checking the bars behind
  
  if (sc.Close > sc.Open)
  {
    if (sc.High[sc.Index-1] < sc.Close[])
    {
      Tool.BeginDateTime = sc.BaseDateTimeIn[];
      Tool.EndDateTime = sc.BaseDateTimeIn[];
      Tool.BeginValue = sc.GetHighest(sc.Low, sc.Index, 10);
      Tool.EndValue = sc.GetLowest(sc.Low, sc.Index, 10);
      Tool.Color = RGB(255,0,0); // Red
      Tool.LineWidth = 1; //To see the outline this must be 1 or greater.
      Tool.SecondaryColor = RGB(0,255,0);
      Tool.TransparencyLevel = 75;
      Tool.AddMethod = UTAM_ADD_OR_ADJUST;

      sc.UseTool(Tool);
      LineNumber12 = Tool.LineNumber;//Remember line number which has been automatically set  
      

      LineNumber12 = Tool.LineNumber;//Remember line number which has been automatically set

      // Change rectangle highlight
      
      Tool.Clear(); // reset tool structure for our next use
      Tool.ChartNumber = sc.ChartNumber;
      Tool.LineNumber = LineNumber12;
      Tool.Color = RGB(255,200,0);
      Tool.LineWidth = 3;
      Tool.SecondaryColor = RGB(0,0,255);
      Tool.AddMethod = UTAM_ADD_OR_ADJUST;

      sc.UseTool(Tool);
    }    
  }
[2017-06-24 21:04:12]
Sierra Chart Engineering - Posts: 104368
A Rectangle from a drawing tool cannot just simply span one bar.

It has to be multiple bars.

We strongly recommend not using the drawing tools. They are more advanced.

You should just pick one of the standard Subgraph Draw Styles and use those:
ACSIL Interface Members - sc.Subgraph Array: sc.Subgraph[].DrawStyle

For example something like Point on High.
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
[2017-06-24 22:36:54]
Ernest - Posts: 10
Thank you, The actuall problem was that I was not being very explicit, I thought that Sierra will assume that when I was writing Tool.BeginDateTime = sc.BaseDateTimeIn[], I had to especify the index Tool.BeginDateTime = sc.BaseDateTimeIn[sc.Index]



Now I get my rectangle but is not looping thru the chart, actually it is not even starting where I am telling to start



// The top of every source code file must include this line

#include "sierrachart.h"

SCDLLName("highvolumearea") // Name of the Study


SCSFExport scsf_highvolumearea(SCStudyInterfaceRef sc)
{
  // Section 1 - Set the configuration variables and defaults
  if (sc.SetDefaults)
  {
    sc.GraphName = "highvolumearea";
  
  sc.StudyDescription = "This indicator Will draw rectangles on High Volume Areas"; // Brief Study Description
    
    sc.GraphRegion = 0; // This sets the main area to the main graph
    
    sc.FreeDLL = 1; // During development set this flag to 1, so the DLL can be rebuilt without restarting Sierra Chart. When development is completed, set it to 0 to improve performance.
  
    sc.AutoLoop = 1; //Automatic looping is enable.

    return;
  }
   int LookBackBars; //Variable that holds Bars to look back
sc.Input[0].Name = "LookBackBars"; //Set the input name
   sc.Input[0].SetIntLimits(1, 300); //Set limits to this Input
   //sc.Input[0].SetInt(50); //Set initial Value
   LookBackBars = sc.Input[0].GetInt(); //Get the value if user change it
  
   sc.DataStartIndex = (LookBackBars + 4); //THIS IS WHERE I AM SPECIFING THE START INDEX


The code is actually painting a rectangle but only on the first bar which is not even close to the 50 bars i set as an starting point. Why is not picking the DataStartIndex??

Also, the if condition is not working at all, do you see anything wrong? I know it is very basic but I have to start for the easy ones.


if (sc.Close[sc.Index] > sc.Open[sc.Index])
  {
    if (sc.High[sc.Index-1] < sc.Close[sc.Index])
    {



Just to be sure, when I write sc.High[sc.Index-1], I am refering to the previous bar high, right??? My condition is that



Thanks
Date Time Of Last Edit: 2017-06-24 22:42:18
[2017-06-25 02:38:27]
Ernest - Posts: 10
Ok, I modified the IF statement to this


  if (sc.BaseData[SC_LAST][sc.Index] > sc.BaseData[SC_OPEN][sc.Index])
  {
    if (sc.BaseData[SC_HIGH][sc.Index-1] < sc.BaseData[SC_LAST][sc.Index])
    {

Yet is not looping, not even one rectangle. I am installing Visual Studio, I need to debug and see what is going on with this code. Any help will be appreciated. Thanks
[2017-06-25 03:47:12]
Sierra Chart Engineering - Posts: 104368
We recommend reading through this page first to understand how array indexing and looping works:
Working with ACSIL Arrays and Understanding Looping
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
[2017-06-25 05:56:17]
Ernest - Posts: 10
Thank you. This is very weird. I installed Visual Studio, set up the platform as you show in the help and after compiling everything again from visual studio the study is working as expected. I wonder why?
[2017-06-25 12:55:38]
Ernest - Posts: 10
Ok, everything looks perfect now I would like to move one step forward. I would like the rectangle to draw up to where price overlap the rectangle. Can you give me a HINT, not the solution but a HINT
[2017-06-25 14:21:16]
Ernest - Posts: 10
Ok, I have read about Tool and I think I am into something here. i just need a little push.

I know that Tool.LineNumber stores the ID of drawn objects. I have, on each new index, iterate Tool.LineNumber and see if there has been a price interception with any of those. My question is, how can I iterate Tool.LineNumber. I know how to use the FOR, WHILE, eyc, I just dont know how to ask Tool.LineNumber for every single drawing added.
[2017-06-27 07:47:27]
Sierra Chart Engineering - Posts: 104368
If you want to iterate the existing Chart Drawings added by a custom study, we need to add a function for that. We will do that. Give us until the end of the day.

We also want to modify one of the related functions and do some documentation updates.
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
[2017-06-28 19:08:56]
Sierra Chart Engineering - Posts: 104368
We added the new functions to ACSIL to support what you want to do. And we updated one of the functions. We are going to work on documentation for them today and put them out.

This is in prerelease version 1577.
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
[2017-06-29 03:58:35]
Sierra Chart Engineering - Posts: 104368
This is the function that you will want to use to iterate through ACSIL added Chart Drawings:
Using Drawing Tools From an Advanced Custom Study: sc.GetACSDrawingByIndex()


Update to prerelease 1577 following these instructions:
Software Download: Fast Update
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
[2017-07-01 01:08:20]
Ernest - Posts: 10
Thank you
[2017-07-01 02:21:07]
Sierra Chart Engineering - Posts: 104368
The next release coming out within a few hours or early morning, this function has an additional parameter on it:

Using Drawing Tools From an Advanced Custom Study: sc.GetACSDrawingByIndex()

And is also more efficient.

We will have documentation updates out next week. Just keep that in mind, because when you update again, the recompiling of your source code will be necessary.
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

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

Login

Login Page - Create Account