I am new to coding as of a few days ago and just downloaded my trial of NT. So far having fun trying to create indicators but am getting caught up in various places.
Could someone help me with the below code? The first part of the code works fine. It's when I add the 2nd paragraph, with red highlighted number, when it stops producing values on the chart.
I'm trying to count the number of Williams Bars under -89.5 in a row. The first paragraph does that well. I want to ultimately find the max of the number in row at time 0 and the number in row at time t-1. Clearly, my syntax is wrong. Could someone help me with how to make this work?
Also, if I want to limit it to only look back say a maximum of 3 periods is there an easy way to do that? Thanks so much!!
{if (WilliamsR(10)[0] < -89.5)
{williamsvariable = williamsvariable + 1;}
else
{williamsvariable = 0;}
{if (WilliamsR(10)[1] < -89.5)
{williamsvariablebef = williamsvariablebef + 1;}
else
{williamsvariablebef = 0;}
{finalwilliams = Math.Max(williamsvariable, williamsvariablebef);}
{Value[0] = finalwilliams;}
}}


Comment