龙听期货论坛's Archiver






 微信: QQ:

龙听 发表于 2020-11-28 07:45

Simple binary trend indicator

**** Hidden Message *****

龙听 发表于 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

学习

页: [1]
渠道·推广(20年运营值得信赖!)▼:温馨提示:期货论坛稳定、流畅的访问体验有赖于赞助商的广告支持,赞助商业务内容非本站官方业务,期货、证券及外汇投资均有亏损的风险,访问赞助商广告即代表您已了解其中的风险。欢迎意向赞助商联系客服或管理员咨询相关事宜。
                     
❤️2025年通过期货论坛开户享受如下优惠政策:政策一:手续费最低交易所+1分起,政策二:日内炒单及大资金享更高比率返还,政策三:保证金可申请交易所标准+0,政策四:开户即享有论坛Prime会员资格(价值199元/年);有意开户咨询管理员或右侧客服! 🚀 论坛付费Prime会员(199元/年或800元/永久)免回复查看下载权限255及以下所有文档(包括但不限于策略、公式、源码、杂志); 😋欧美期货杂志购买、下载与中文翻译:/thread-10603-1-1.html |TB/MC开户优惠政策:/thread-5986-1-1.html;2025年最新交易所手续费表/thread-7537-1-1.html 2025年最全的Python编程与程序化(量化)教程、视频、源码、课件、资源汇总贴:/thread-152864-1-1.html 2025年最全的MultiCharts程序化(量化)教程、视频、源码、课件、资源汇总贴:/thread-88129-1-1.html❤️ 期货论坛与mc合作,通过使用期货论坛优惠码在mc官网购买mc的VIP会员享受折扣优惠 (点击获得“Multicharts14专策版软件使用授权年度会员购买优惠码” ) mag.png【1981年-2025年欧美期货、程序化、量化杂志、期货电子书等中文翻译目录汇总!】(注册登录后可看!) C__LOGO1.png2025年最全的C++期货程序化(量化)教程、视频、源码、课件、资源汇总贴:/thread-160231-1-1.html C++程序化交易软件2025年C++程序化推荐:C++积木式程序化交易系统(简洁、高效、绿色、模块化及最低免费使用),策略模块丰富,绿色安全,使用简单,功能丰富,特别适合定制,推荐有成熟交易系统者及希望低成本长时间实盘客户使用(账户政策、程序化设计及电脑配置等欢迎联系管理员或客服咨询!);( 管理员微信号微信号QQ号QQ电话号码电话号码 );