Login Page - Create Account

Support Board


Date/Time: Wed, 27 Nov 2024 08:44:48 +0000



Post From: Could you please add the Half Trend indicator?

[2022-03-10 01:21:55]
SC Support Tom - Posts: 450
Hello, and sorry for the delay on this.

I am working from the code in Post #11, and I made a couple of slight modifications (in addition to changing some Subgraph, Array, and Input names).

* I added an Input for selecting the MA Type for the ATR, and I set the default to EMA (not SMA). That is because Pine Script uses the EMA for the ATR.
* When calculating the Deviation ("dev"), you forgot to divide by 2. I fixed that.

The one question that I have is, why do you include the following lines?


149 Array_up[sc.Index-1]=Array_up[sc.Index];
165 Array_down[sc.Index-1]=Array_down[sc.Index];

These do not appear to be warranted by the code in Post #1, and indeed they appear to make no difference whatsoever. Please see the attached image. In the Subgraph in Region 2, the I omitted the lines. In the Subgraph in Region 3, I included them. The two Subgraphs are identical.
image$INX Daily #1 2022-03-09 19_12_42.994.png / V - Attached On 2022-03-10 01:21:53 UTC - Size: 43.94 KB - 281 views