Login Page - Create Account

Support Board


Date/Time: Sun, 19 May 2024 03:48:13 +0000



Post From: ACSIL Drawing Problem/Question

[2015-03-13 21:04:31]
WarEagle - Posts: 70
Hi,

I am trying to draw a rectangle at various price levels pulled from a text file. I am able to read the file fine and draw the shape at the correct levels. I am using the following code framework:


int Hour, Minute; //These are set to the sc.Index bar hour and minute
if ((Hour == 8) && (Minute = 25) )
{
//Code to read file to get prices
//Code for Tool setup

sc.UseTool(Tool);
}

The problem is that the rectangles are being drawn more than once and on bars that follow the 8:25 bar. I have attached a picture to show the outcome. This is a 5 minute chart and the if statement checks that we are on the 8:25 bar to start the drawing, however I have drawings for several bars after that. Why would the 8:30, 8:35 etc bars trigger a drawing? My theory is that the drawing is trying to draw on the same bar but since another drawing is already there it is pushing the start index out to the next bar, causing the cascading effect. The problem is that there should only be one drawing at each level.

I also have a question that may be related to this problem. I use the message log for debugging and noticed that when I wrote the price levels out to the log before I added the drawing tool portion the message would get repeated 5 or so times each bar that the condition was true. Its like the code is iterating more than once per bar. Is there an obvious solution I am overlooking?

Thanks!

imagemultiplerectangles.jpg / V - Attached On 2015-03-13 20:38:30 UTC - Size: 11.09 KB - 374 views