形态判断
//------------------------------------------------------------------------ // 简称: function1 // 名称: // 类别: 用户函数 // 类型: 用户函数 // 输出: 数值型 //------------------------------------------------------------------------ Params integer length(20); Vars numeric aa; numeric up; numeric dn; Begin aa = open; up = aa*(1+2/100); dn = aa*(1-2/100); PlotNumeric("up",up); PlotNumeric("dn",dn); numeric i; numeric M1; numeric M2; numeric M3; numeric M4; numeric M; for i = 1 to length { If(low[i]<up and low[i]>dn) { M1 = M1 + 1; } If(high[i]<up and high[i]>dn) { M2 = M2 + 1; } If(low[i]<up and low[i]>dn and high[i]<up and high[i]>dn) { M3 = M3 + 1; } If(low[i]<dn and high[i]>up) { M4 = M4 + 1; } } M = (M1+M2+M3+M4)/80*100; Commentary("M1:"+text(M1)); Commentary("M2:"+text(M2)); Commentary("M3:"+text(M3)); Commentary("M4:"+text(M4)); Commentary("M:"+text(M)); Return M; End //------------------------------------------------------------------------ // 编译版本 2025/11/27 160633 // 版权所有 kyover // 更改声明 TradeBlazer Software保留对TradeBlazer平台 // 每一版本的TradeBlazer策略修改和重写的权利 //------------------------------------------------------------------------