Run a for loop backwards from last date
Author: Hugo3762
Creation Date: 6/26/2020 3:14 PM
profile picture

Hugo3762

#1
HI All,

I am trying to esteblish the last support or resistance.
This is defined as (seen from bar) 2 lower highs in the future and 4 consectutive higher highs in past.
Only the last support and resistance are worthwhile, so I thought to make a for () loop going backwards. Starting from the last till say 50 days ago.
The for statement throws an exception which i do not understand. The loop statement should work according Microsoft C# documentation and other examples from the web.

the code
CODE:
Please log in to see this code.


I need a hint to make this work.
Anyone the help or fix?

thanks in advance
Hugo
profile picture

Cone

#2
The bars in the chart are numbered from 0 to Bars.Count - 1 (typical array indexes in C#). So, bar_begin needs to be Bars.Count - 3 so that you can look ahead 2 bars.

profile picture

Hugo3762

#3
Cone,

thnx for the prompt reply, It works :). I can figure the rest of the code. C# (sharp is really sharp -2 and -3)
This website uses cookies to improve your experience. We'll assume you're ok with that, but you can opt-out if you wish (Read more).