- UID
- 2
- 积分
- 2874674
- 威望
- 1387366 布
- 龙e币
- 1487308 刀
- 在线时间
- 13156 小时
- 注册时间
- 2009-12-3
- 最后登录
- 2024-11-24
|
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. |
|