Login Page - Create Account

Support Board


Date/Time: Tue, 24 Dec 2024 12:38:15 +0000



Post From: ACSIL Drawing Question

[2015-10-23 15:03:09]
User55519 - Posts: 37
Hello,

I'm new to ACSIL and not a serious programmer so please excuse any ridiculous mistake I may have made here. I'm most of the way there, but I'm missing something.

What I'm doing is finding a price bar on a chart that meets certain criteria (call it Bar1), then finding another one nearby that meets other criteria (Bar2). What I want to do, but am struggling with is this:

Bar2 is always going to be older/further left on the chart than Bar1. I want to draw a rectangle from Bar2 to Bar 1.

The code I'm using does this but only for the MOST RECENT instance that Bar2 and Bar1 exist. The code I'm working with below, if I replace it with drawing code that puts an ARROWDOWN on every price bar between Bar2 and Bar1, it works. It works for all instances of Bar2 and Bar 1 on the entire chart. When I use the rectangle code, only the most recent instance is drawn.

Any idea what I'm missing?
I've surrounded the important bit (I think) by slashes below.

Thanks for any help!

  static const int UniqueLineNumber = (sc.ChartNumber+sc.StudyGraphInstanceID)*1000;
  s_UseTool Tool;
  
Tool.Clear();
  Tool.ChartNumber = sc.ChartNumber;
  Tool.DrawingType = DRAWING_RECTANGLEHIGHLIGHT;
  Tool.LineNumber = UniqueLineNumber + 2;

///////////////////////////////////////////////////////  
  Tool.BeginIndex=Bar2;
  Tool.EndIndex=Bar1;
  Tool.BeginValue=Open[Bar2];
  Tool.EndValue=Close[Bar2];
//////////////////////////////////////////////////////
  
  Tool.Color = RGB(255,0,0); // Red
  Tool.LineWidth = 1;
  Tool.SecondaryColor = RGB(0,255,0); // Green
  Tool.TransparencyLevel = 90;
  Tool.AddMethod = UTAM_ADD_OR_ADJUST;
  int res = sc.UseTool(Tool);

This is the code I use to produce the arrow. It technically works, but I think I'm not doing this properly. I just run a for loop for all price bars between Bar2 and Bar1. Looks terrible though and is hard to read, hence the need for a shaded rectangle.

  sc.Subgraph[0].DataColor[BarInterval] = sc.Subgraph[2].PrimaryColor;
  sc.Subgraph[0][BarInterval] = sc.High[BarInterval];
Date Time Of Last Edit: 2015-10-23 15:08:37