以下是同花顺量能分析趋势公式
同花顺量能分析趋势公式
源码
// 1m,5m,15m,
IF (周期类型==1)// 短线观察
{
sumup_time_1M:=242;
sumup_time_2M:=30*4*5;//短线观察,日滤波
sumup_time_15M:=4*4;//中线观察,周滤波
sumup_time_1H:=1;
}
ELSE IF (周期类型==2)
{
sumup_time_1M:=242*5;
sumup_time_2M:=30*4*5;//短线观察,日滤波
sumup_time_15M:=4*4*5;//中线观察,周滤波
sumup_time_1H:=1*4*5;
}
ELSE
{
sumup_time_1M:=1;
sumup_time_2M:=1;//短线观察,日滤波
sumup_time_15M:=1;//中线观察,周滤波
sumup_time_1H:=1;
}
IF (PERIODNAME==”1momi”){
v_total_inc_k:=100;
delta_inc_k:=5;
}
ELSE IF (PERIODNAME==”2m”){
v_total_inc_k:=50;
delta_inc_k:=3;
}
ELSE;
sumup_time:=IF(PERIODNAME==”1momi”,sumup_time_1M,IF(PERIODNAME==”2m”(sumur_dime_2M,IF(PERIODNAME==”15m”,sumup_time_15M,IF(PERIODNAME==”1h”,sumup_time_1H,IF(PERIODNAME==”1m”,0,1)))));
// ———- 成交量分析
//v_total:=SUM(VOL,sumup_time);//总量
//v_total_ema:=EMA(v_total,100);//总量均值
IF (CODETYPE==0)//指数
{
v_rise:=IF(CLOSE>REF(CLOSE,1),VOL,0);//涨成交量
v_fall:=IF(CLOSE<REF(CLOSE,1),VOL,0);
}
ELSE //个股
{
v_rise:=IF(CLOSE>REF(CLOSE,1),VOL/SHGZG*100,0);//涨成交量与总流通股比值,不适用于板块
v_fall:=IF(CLOSE<REF(CLOSE,1),VOL/SHGZG*100,0);
}
v_rise_sum:=SUM(v_rise,sumup_time),colorred,LINETHICK2;//指定周期内的增减总量
v_fall_sum:=SUM(v_fall,sumup_time),colorgreen,LINETHICK2;
v_rise_sum_ema:EMA(v_rise_sum,6),colorred,LINETHICK1;//增减总量的平滑滤波
v_fall_sum_ema:EMA(v_fall_sum,6),colorgreen,LINETHICK1;
v_total_ema_mid:(v_rise_sum_ema+v_fall_sum_ema)/2,colorblue,LINETHICK1;//增减量中值,也就是平衡点
v_delta:=EMA(v_rise_sum_ema-v_fall_sum_ema,2),colorblue;//总差量;大于0代表涨动力强于跌动力
v_delta_emv:=(EMA(v_rise_sum_ema-v_fall_sum_ema,9)),colorgray,LINETHICK2;//总差量均值
v_delta_delay:=(REF(v_delta,CHANGE_PERIOD));//总差量滞后值
v_delta_emv_delay:=(REF(v_delta_emv,CHANGE_PERIOD));
v_delta_speed_ema:MA(-ABS(v_delta_emv-v_delta_emv_delay),120)*delta_inc_k,colorwhite;
// ———- 价格分析
//p_rise:=IF(CLOSE>=REF(CLOSE,1),CLOSE-REF(CLOSE,1),0);//价格增量
//p_fall:=IF(CLOSE< REF(CLOSE,1),-CLOSE+REF(CLOSE,1),0);//价格减量
//p_abs:=IF(CLOSE< REF(CLOSE,1),-CLOSE+REF(CLOSE,1),CLOSE-REF(CLOSE,1));//价格绝对增量
// ———- 图形显示
//涨跌量差值
STICKLINE(v_delta_emv>=0,0,v_delta_emv,3,0),colorred;
STICKLINE(v_delta_emv<0,0,-v_delta_emv,3,0),colorgreen;
//总成交量在涨跌中的表现
IF (CODETYPE==0)//指数
{
v_total_inc:=EMA((v_total_ema_mid-REF(v_total_ema_mid,1)),10)*v_total_inc_k;//总成交量增量
//STICKLINE((v_delta_emv-v_delta_emv_delay)>0 AND v_total_inc>0,v_rise_sum_ema,v_rise_sum_ema+v_total_inc,1,1),colorlired;//总差量值在上升,情况正在好转;且成交量上升
//STICKLINE((v_delta_emv-v_delta_emv_delay)>0 AND v_total_inc<0,v_rise_sum_ema,v_rise_sum_ema-v_total_inc,1,1),colorlired;
//STICKLINE((v_delta_emv-v_delta_emv_delay)<0 AND v_total_inc>0,v_fall_sum_ema,v_fall_sum_ema-v_total_inc,1,1),colorligreen;//总差量值下降,空军力量增强;且成交量上升
//STICKLINE((v_delta_emv-v_delta_emv_delay)<0 AND v_total_inc<0,v_fall_sum_ema,v_fall_sum_ema+v_total_inc,1,1),colorligreen;
STICKLINE(v_delta_emv>0 AND v_total_inc>0,v_rise_sum_ema,v_rise_sum_ema+v_total_inc,1,1),colorlired;// 差量大于0,多方市场;且总成交量上升;表明情况好转
STICKLINE(v_delta_emv>0 AND v_total_inc<0,v_fall_sum_ema,v_fall_sum_ema+v_total_inc,1,1),colorligreen;
STICKLINE(v_delta_emv<0 AND v_total_inc>0,v_fall_sum_ema,v_fall_sum_ema+v_total_inc,1,1),colorligreen;// 差量小于0,空方市场;且总成交量上升;表明情况恶化
STICKLINE(v_delta_emv<0 AND v_total_inc<0,v_rise_sum_ema,v_rise_sum_ema+v_total_inc,1,1),colorlired;
}
ELSE IF (CODETYPE==1)
{
v_total_inc:=EMA((v_total_ema_mid-REF(v_total_ema_mid,1)),10)*v_total_inc_k/2;
STICKLINE(v_delta_emv>0 AND v_total_inc>0,v_rise_sum_ema,v_rise_sum_ema+v_total_inc,1,1),colorlired;
STICKLINE(v_delta_emv>0 AND v_total_inc<0,v_fall_sum_ema,v_fall_sum_ema+v_total_inc,1,1),colorligreen;
STICKLINE(v_delta_emv<0 AND v_total_inc>0,v_fall_sum_ema,v_fall_sum_ema+v_total_inc,1,1),colorligreen;
STICKLINE(v_delta_emv<0 AND v_total_inc<0,v_rise_sum_ema,v_rise_sum_ema+v_total_inc,1,1),colorlired;
}
ELSE;
//涨跌速度
STICKLINE(v_delta_emv>=0 AND v_delta_emv>=v_delta_emv_delay AND HIGH>LOW,0,-delta_inc_k*(v_delta_emv-v_delta_emv_delay),5,0),coloryellow;
STICKLINE(v_delta_emv>=0 AND v_delta_emv<v_delta_emv_delay AND HIGH>LOW, 0, delta_inc_k*(v_delta_emv-v_delta_emv_delay),5,0),colorblue;
STICKLINE(v_delta_emv<0 AND v_delta_emv>=v_delta_emv_delay AND HIGH>LOW,0,-delta_inc_k*(v_delta_emv-v_delta_emv_delay),5,0),coloryellow;
STICKLINE(v_delta_emv<0 AND v_delta_emv<v_delta_emv_delay AND HIGH>LOW, 0, delta_inc_k*(v_delta_emv-v_delta_emv_delay),5,0),colorblue;
//时间点
STICKLINE(HOUR==10 AND MINUTE==30,0,v_total_ema_mid/2,1,0),colorgray;//每日记号线
STICKLINE(HOUR==11 AND MINUTE==30,0,v_total_ema_mid/2,1,0),colorgray;//每日记号线
STICKLINE(HOUR==14 AND MINUTE==0 ,0,v_total_ema_mid/2,1,0),colorgray;//每日记号线
STICKLINE(HOUR==15 AND MINUTE==0 ,0,v_total_ema_mid/2,1,0),colorgray;//每日记号线
STICKLINE(HOUR==14 AND MINUTE>=30,0,v_total_ema_mid/2,1,1),colorgray;//每日记号线
//变盘提示
/*
v_rise_sum_ema_delay:=REF(v_rise_sum_ema,CHANGE_PERIOD);//分析变盘的间隔
v_fall_sum_ema_delay:=REF(v_fall_sum_ema,CHANGE_PERIOD);
v_rise_sum_ema_delay_delta:=(v_rise_sum_ema-v_rise_sum_ema_delay)/ABS(v_rise_sum_ema_delay);
v_fall_sum_ema_delay_delta:=(v_fall_sum_ema-v_fall_sum_ema_delay)/ABS(v_rise_sum_ema_delay);
//涨放量,跌缩量
IF (v_rise_sum_ema_delay_delta/ABS(v_fall_sum_ema_delay_delta)>ALARM_PERCENT)//涨量放大速度明显快于跌量放大速度
rise_alarm:=1;
ELSE IF (v_fall_sum_ema_delay_delta/ABS(v_rise_sum_ema_delay_delta)<-ALARM_PERCENT)//跌量缩小速度明显快于涨量缩小速度
rise_alarm:=2;
ELSE IF (v_rise_sum_ema_delay_delta>ALARM_VALUE AND v_fall_sum_ema_delay_delta<-ALARM_VALUE)//跌缩量而涨放量
rise_alarm:=3;
ELSE
rise_alarm:=0;
STICKLINE(rise_alarm==1,v_rise_sum_ema,v_fall_sum_ema,1,1),coloryellow;
STICKLINE(rise_alarm==2,v_rise_sum_ema,v_fall_sum_ema,1,1),colormagenta;
STICKLINE(rise_alarm==3,v_rise_sum_ema,v_fall_sum_ema,1,1),colorred;
*/
评论(0)