新建一个被引用指标。指标名:VAR。
T1:=C>MA(C,120)&&C>MA(C,240)&&MA(C,120)>REF(MA(C,120),1)&&MA(C,240)>REF(MA(C,240),1)&&MA(C,120)>MA(C,240);
T3:=C<MA(C,120)&&C<MA(C,240)&&MA(C,120)<REF(MA(C,120),1)&&MA(C,240)<REF(MA(C,240),1)&&MA(C,120)<MA(C,240);
跨周期使用:
T11:= STKINDI(STKLABEL,'VAR.T1',0,4);
T33:=STKINDI(STKLABEL,'VAR.T3',0,4);
T1:MA(C,30)>=MA(C,120);
买开:buy(T1 and T11 and holding=0,1,market);
T2:=MA(C,30)<=MA(C,120);
平多:sell(T2,holding,market);
T3:=MA(C,30)<=MA(C,120);
开空:buyshort(T3 and T33 and holding=0,1,market);
T4:=MA(C,30)>=MA(C,120);
平空:SELLSHORT(T4 and holding=0,holding,market);