Board logo

标题: [TS源码] Simple length adjusting algorithm [打印本页]

作者: 龙听    时间: 2020-11-28 07:46     标题: Simple length adjusting algorithm

本帖隐藏的内容需要回复才可以浏览

作者: 龙听    时间: 2020-11-28 07:46

This is the first stage of making an algorithm to control length applied to an indicator.

You can see that if you plot this indicator in subgraph 2 it ranges between 50 and 10 which are the max and min lengths allowed. ( But these are adjustable inputs )

If the price is making a new high or low for the basic length period it will slow down by 1 length increment for each bar that the condition is true.

If the price not making a new high or low for the same period it will reduce length by 0.5 length increment for each bar the condition is true.

Code tricks to try

If you try changing the values of the -1 and the 0.5 to larger or smaller amounts you can tune it to suit your requirements.

Below I will show you how to build this code into a length changing indicator.




欢迎光临 龙听期货论坛 (http://www.qhlt.cn/) Powered by Discuz! 7.2