Login Page - Create Account

Support Board


Date/Time: Mon, 13 May 2024 10:09:29 +0000



Post From: Flex Renko High and Low and sc.High and sc.Low do not match

[2018-09-24 21:42:26]
bradh - Posts: 857
I want to draw Arrows above and below the high and the low of a Flex Renko Bar. I am using sc.Low and sc.High, but sc.BaseDataIn[SC_LOW] and sc.BaseDataIn[SC_HIGH] produce the same results.

When I do that I get some of the arrows inside the body of the candle:
http://www.sierrachart.com/image.php?Image=1537824174727.png

It only seems to happen on Flex Renko. If I add the Heiken Ashi study, set it to region 1 and check Display as Main Graph, then the arrows appear in the right places. I haven't seen the issue on any other bar type, but I have not tested them all.

// The top of every source code file must include this line
#include "sierrachart.h"

// For reference, refer to this page:
// Advanced Custom Study Interface and Language (ACSIL)

// This line is required. Change the text within the quote
// marks to what you want to name your group of custom studies.
SCDLLName("TestArrow")

//This is the basic framework of a study function. Change the name 'TemplateFunction' to what you require.
SCSFExport scsf_TestArrow(SCStudyInterfaceRef sc)
{
  SCSubgraphRef ArrowUp = sc.Subgraph[0];
  SCSubgraphRef ArrowDown = sc.Subgraph[1];
  
  SCInputRef TickOffset = sc.Input[0];
  
  // Section 1 - Set the configuration variables and defaults
  if (sc.SetDefaults)
  {
    sc.GraphName = "Test High and Low with Flex Renko";
    
    // 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.FreeDLL = 1;

    sc.AutoLoop = 1; //Automatic looping is enabled.
    
    sc.GraphRegion = 0;
    
    ArrowUp.Name = "Arrow Up";
    ArrowUp.DrawStyle = DRAWSTYLE_ARROWUP;
    ArrowUp.PrimaryColor = RGB (0, 255, 0);
    
    ArrowDown.Name = "Arrow Down";
    ArrowDown.DrawStyle = DRAWSTYLE_ARROWDOWN;
    ArrowDown.PrimaryColor = RGB (255, 0, 0);
    
    TickOffset.Name = "Tick Offset";
    TickOffset.SetInt(1);
    
    
    
    
    return;
  }
  
  
  // Section 2 - Do data processing here
    
    ArrowUp[sc.Index] = sc.Low[sc.Index] - sc.TickSize * TickOffset.GetFloat();
    ArrowDown[sc.Index] = sc.High[sc.Index] + sc.TickSize * TickOffset.GetFloat();
}