Board logo

标题: [TS源码] Simple binary trend indicator [打印本页]

作者: 龙听    时间: 2020-11-28 07:45     标题: Simple binary trend indicator

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

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

his indictor decides the "binary trend"  which means it converts it to a number. Thus uptrend =1 downtrend =-1 and the initial value is assigned as 0.

Code tips

If you plot the 80 period moving average and the 12 period moving average on the chart you can check the trend indicator is working.

Using end else statements to reduce code length. EG above assumes that if the trend is not 1 then it must be -1.

Code tricks to try

If you try using another method to assign the trend is up or down and replace the code with your idea. EG. You use the stochastic oscillator with above 50 being uptrend and below 50 being down trend.

The equal to 50 can be caught by saying this. If stochastic is >=50 then count as uptrend ( psuedo code)
作者: 阿土伯    时间: 2020-12-3 16:05

学习




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