Login Page - Create Account

Support Board


Date/Time: Wed, 27 Nov 2024 07:41:17 +0000



Post From: How to code future intersection till cross over?

[2023-09-19 04:12:38]
rajeshh - Posts: 8
Hello, I am trying to code a variation of the the AddLineUntilFutureIntersection whereby the line drawn does not stop at any intersection, but at the intersection after a crossover ( up or down indicated by the parameter). So the idea of this to be in cases, where the line was originally support, but now is resistance, I want the line to continue till it reaches a bar that is crossing it from below. I am doing this in ACSIL. I wanted to get your general sense if the approach below makes sense -

I am using autoloop. Essentially, in the subgraph which is drawing the lines, I also store a value in one if its internal arrays to indicate if it has crossed over already, so I can skip the checks in the future. So in each call of my study, I go backwards through the subgraph, check if its a non-zero value, check if not crossed over, and then call the sc.crossover(sc.High,new array with the constant value corresponding to that subgraph). If its None, then set set subgraph for the most recent bar to the value, and keep going on. If it has crossed over, then set subgraph value to zero, and the internal array value tracking crossover to true.

Will this be OK from a performance point of view? I am hoping most of these crossover within 10-15 bars, so they dont need the cross over check past that?

I have attached an image to make it clear.

I see there is sc.AddLineUntilFutureIntersectionEx() which gives the ability for providing the end index. Is there any advantange to using this instead of the above? It looks like I would have to do most of the work above anyways to determine the ending index based on whether the cross over has happened or not?

p.s - This would be a nice enhancement to the Ex() function above.
Date Time Of Last Edit: 2023-09-19 04:17:01
imagecrossover check.JPG / V - Attached On 2023-09-19 04:10:16 UTC - Size: 16.65 KB - 93 views