Support Board
Date/Time: Wed, 27 Nov 2024 08:32:48 +0000
[User Discussion] - Could you please add the Half Trend indicator?
View Count: 2887
[2021-08-03 16:54:10] |
User566779 - Posts: 20 |
Here is the code... https://www.tradingview.com/script/U1SJ8ubc-HalfTrend/ |
[2021-08-05 01:23:46] |
SC Support Tom - Posts: 450 |
I am working on translating this into ACSIL now.
|
[2021-08-17 12:07:28] |
SC Support Tom - Posts: 450 |
I am almost finished with this, but I have a question about how Tradingview operates. Specifically, my question pertains to the following part of the Pine Script code. if nextTrend == 1 maxLowPrice := max(lowPrice, maxLowPrice) if highma < maxLowPrice and close < nz(low[1], low) trend := 1 nextTrend := 0 minHighPrice := highPrice In the event that nextTrend == 1, but the condition highma < maxLowPrice and close < nz(low[1], low) is false, the value of minHighPrice is not explicitly updated. What does Tradingview do in that circumstance? My guess is that it retains the previous value of the variable, but since Pine Script has no equivalent of "sc.Index" in its code, I cannot know for sure. If you do not know the answer, then I will update the value as minHighPrice[sc.Index] = minHighPrice[sc.Index - 1] under the above stated conditions. |
[2021-08-18 15:54:22] |
User566779 - Posts: 20 |
Thanks for putting the effort in. Unfortunately I am clueless about coding :(
|
[2021-08-18 17:50:49] |
SC Support Tom - Posts: 450 |
WRT Post #4: Thanks for putting the effort in. Unfortunately I am clueless about coding :( It is ok. The interpretation that I surmised is the only one that makes sense, and so that is what I will program. I will be off for the rest of the day, but I will finish it tomorrow. |
[2021-09-08 09:37:55] |
Marmany - Posts: 307 |
Updated to v2307, not able to find this study in "Studies Available". Has it been released? If so what is it called. Please advise |
[2021-09-10 15:06:35] |
User112730 - Posts: 41 |
I am also interested. Could we please have an update ? Thanks in advance. |
[2021-09-14 06:47:02] |
SC Support Tom - Posts: 450 |
I am still working this out. I an unsure of my translation from Pine Script to ACSIL, and am consulting TradingView's documentation. I will post to this thread when this is done.
|
[2021-10-29 14:53:19] |
User112730 - Posts: 41 |
Still a WIP as I have not done all the checks I want to & that channels are not implemented, but I share the code here so that User566779 and others can have a look and tell if an error is found or a difference is noticed between the behavior of the halftrend in tradingview & in Sierra Chart (I do compare with other platforms) SC Support Tom, if you can have a quick look and tell me if you find some errors or things that could be improved, I would be grateful. I hope to be able to provide a final version in the 2 coming weeks & then be able to give this indicator to the community. Date Time Of Last Edit: 2021-10-31 08:40:35
|
halftrend.cpp - Attached On 2021-10-29 14:51:45 UTC - Size: 5.83 KB - 441 views halftrend_64.dll - Attached On 2021-10-29 14:51:50 UTC - Size: 96.5 KB - 400 views |
[2021-10-30 15:56:34] |
Marmany - Posts: 307 |
Compared Halftrend to Super Trend. Results are similar with Halftrend Amplitude = 9 and Super Trend with default 2/3/3 settings. My initial analysis is that SuperTrend gives signals 2 to 3 bars earlier. Would be interested to learn why 566779 requested development of the study. |
[2021-11-04 15:45:57] |
User112730 - Posts: 41 |
(Hopefully) Final version, except if someone find an issue. @User566779 and other, could you please have a look ? I will soon ask SC support to include it in next release in the user contributed studies. Attached are the source & compiled files, along with an example on the DAX future timeframe 5 minutes. |
halftrend_64.dll - Attached On 2021-11-04 15:43:55 UTC - Size: 900 KB - 699 views halftrend.cpp - Attached On 2021-11-04 15:44:01 UTC - Size: 6.94 KB - 344 views HT_seul.PNG / V - Attached On 2021-11-04 15:44:06 UTC - Size: 80.88 KB - 378 views |
[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. |
$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 - 280 views |
[2022-03-12 03:18:10] |
SC Support Tom - Posts: 450 |
This is done. The HalfTrend study will be available in the next release. WRT Post #12, I have omitted the two lines referred to therein. |
[2022-03-12 19:22:38] |
Ticks - Posts: 183 |
@SC Support Tom Can you provide the .ccp file? So the SC customers who have no need/want to upgrade to the latest SC release. Date Time Of Last Edit: 2022-03-12 19:22:53
|
[2022-03-13 00:30:06] |
SC Support Tom - Posts: 450 |
WRT Post #14 Sure, the code that I submitted to the repository is attached. In the attached file, I added the lines required to build this as an Advanced Custom Study, so you can place this file into your ACS_Source folder as is and build it. |
scsf_HalfTrend.cpp - Attached On 2022-03-13 00:30:03 UTC - Size: 6.41 KB - 296 views |
[2022-03-18 10:39:11] |
User112730 - Posts: 41 |
In reply to post #12 and WRT below lines : 149 Array_up[sc.Index-1]=Array_up[sc.Index];
165 Array_down[sc.Index-1]=Array_down[sc.Index]; I confirm that it is of no use in SC. The original code I used to write Sierrachart's halftrend is mql4 (not the pinescript one above) and these lines made sense in that software. all the other corrections you made are relevant to me as well, thanks for having left the ATR MA type as a parameter so that those who want SMA can select it. Thanks for your work and for the addition of halftrend in SC ! |
[2022-03-23 02:16:09] |
SC Support Tom - Posts: 450 |
WRT Post #16 I confirm that it is of no use in SC. The original code I used to write Sierrachart's halftrend is mql4 (not the pinescript one above) and these lines made sense in that software. all the other corrections you made are relevant to me as well, thanks for having left the ATR MA type as a parameter so that those who want SMA can select it. Thanks for your work and for the addition of halftrend in SC ! OK, good to know. The HalfTrend as I have implemented it will be fine then. Sorry for the delay in responding. I have been out of town. |
[2023-09-12 14:55:40] |
User411320 - Posts: 289 |
is the "length" input for the sierra version equivalent to "amplitude" in the trading view version?
|
To post a message in this thread, you need to log in with your Sierra Chart account: