源码分享:
分段
{简睿余玉 -之- 指标模拟训练----理想论坛壹瓣杺埖编写,副图指标}
{余玉等于2时无偏移,大于2向左偏移,小于2向右偏移}
LL:=IF(指标=1,"KDJ.J",IF(指标=2,"MACD.DIF",IF(指标=3,CCI,IF(指标=4,"WR.WR1",
IF(指标=5,"RSI.RSI1",IF(指标=6,"BIAS.BIAS1",IF(指标=7,ROC,IF(指标=8,OSC,OBV))))))));
OO:=IF(指标=1,"KDJ.K",IF(指标=2,"MACD.DEA",IF(指标=3,100,IF(指标=4,"WR.WR2",
IF(指标=5,"RSI.RSI2",IF(指标=6,"BIAS.BIAS2",IF(指标=7,MA(ROC,6),IF(指标=8,EXPMEMA(OSC,6),MA(OBV,7)))))))));
HH:=IF(指标=1,"KDJ.D",IF(指标=2,"MACD.MACD",IF(指标=3,-100,IF(指标=4,100,
IF(指标=5,"RSI.RSI3",IF(指标=6,"BIAS.BIAS3",IF(指标=7,MA(ROC,30),IF(指标=8,EXPMEMA(OSC,30),MA(OBV,30)))))))));
CUR:=CURRBARSCOUNT;
DRAWTEXT(指标=1&&CUR=18,OO,'K`DJ'); DRAWTEXT(指标=2&&CUR=18,OO,'MAC`D');
DRAWTEXT(指标=3&&CUR=18,OO,'CC`I'); DRAWTEXT(指标=4&&CUR=18,OO,'W`R');
DRAWTEXT(指标=5&&CUR=18,OO,'R`SI'); DRAWTEXT(指标=6&&CUR=18,OO,'B`IAS');
DRAWTEXT(指标=7&&CUR=18,OO,'R`OC'); DRAWTEXT(指标=8&&CUR=18,OO,'OS`C');
DRAWTEXT(指标=9&&CUR=18,OO,'OB`V');
TL0:=CONST(LL);TL1:=CONST(REF(LL,BARSLAST(CUR=1)+1));
TL2:=CONST(REF(LL,BARSLAST(CUR=2)+1));TL3:=CONST(REF(LL,BARSLAST(CUR=3)+1));
TL4:=CONST(REF(LL,BARSLAST(CUR=4)+1));TL5:=CONST(REF(LL,BARSLAST(CUR=5)+1));
TL6:=CONST(REF(LL,BARSLAST(CUR=6)+1));TL7:=CONST(REF(LL,BARSLAST(CUR=7)+1));
TL8:=CONST(REF(LL,BARSLAST(CUR=8)+1));TL9:=CONST(REF(LL,BARSLAST(CUR=9)+1));
TL10:=CONST(REF(LL,BARSLAST(CUR=10)+1));TL11:=CONST(REF(LL,BARSLAST(CUR=11)+1));
TL12:=CONST(REF(LL,BARSLAST(CUR=12)+1));TL13:=CONST(REF(LL,BARSLAST(CUR=13)+1));
TL14:=CONST(REF(LL,BARSLAST(CUR=14)+1));TL15:=CONST(REF(LL,BARSLAST(CUR=15)+1));
TL16:=CONST(REF(LL,BARSLAST(CUR=16)+1));TL17:=CONST(REF(LL,BARSLAST(CUR=17)+1));
TL18:=CONST(REF(LL,BARSLAST(CUR=18)+1));TL19:=CONST(REF(LL,BARSLAST(CUR=19)+1));
TL20:=CONST(REF(LL,BARSLAST(CUR=20)+1));TL21:=CONST(REF(LL,BARSLAST(CUR=21)+1));
TL22:=CONST(REF(LL,BARSLAST(CUR=22)+1));TL23:=CONST(REF(LL,BARSLAST(CUR=23)+1));
TL24:=CONST(REF(LL,BARSLAST(CUR=24)+1));TL25:=CONST(REF(LL,BARSLAST(CUR=25)+1));
TL26:=CONST(REF(LL,BARSLAST(CUR=26)+1));TL27:=CONST(REF(LL,BARSLAST(CUR=27)+1));
TL28:=CONST(REF(LL,BARSLAST(CUR=28)+1));TL29:=CONST(REF(LL,BARSLAST(CUR=29)+1));
TL30:=CONST(REF(LL,BARSLAST(CUR=30)+1));TL31:=CONST(REF(LL,BARSLAST(CUR=31)+1));
TL32:=CONST(REF(LL,BARSLAST(CUR=32)+1));TL33:=CONST(REF(LL,BARSLAST(CUR=33)+1));
TL34:=CONST(REF(LL,BARSLAST(CUR=34)+1));TL35:=CONST(REF(LL,BARSLAST(CUR=35)+1));
TL36:=CONST(REF(LL,BARSLAST(CUR=36)+1));TL37:=CONST(REF(LL,BARSLAST(CUR=37)+1));
TL38:=CONST(REF(LL,BARSLAST(CUR=38)+1));TL39:=CONST(REF(LL,BARSLAST(CUR=39)+1));
TL40:=CONST(REF(LL,BARSLAST(CUR=40)+1));TL41:=CONST(REF(LL,BARSLAST(CUR=41)+1));
TL42:=CONST(REF(LL,BARSLAST(CUR=42)+1));TL43:=CONST(REF(LL,BARSLAST(CUR=43)+1));
TL44:=CONST(REF(LL,BARSLAST(CUR=44)+1));TL45:=CONST(REF(LL,BARSLAST(CUR=45)+1));
TL46:=CONST(REF(LL,BARSLAST(CUR=46)+1));TL47:=CONST(REF(LL,BARSLAST(CUR=47)+1));
TL48:=CONST(REF(LL,BARSLAST(CUR=48)+1));TL49:=CONST(REF(LL,BARSLAST(CUR=49)+1));
TL50:=CONST(REF(LL,BARSLAST(CUR=50)+1));TL51:=CONST(REF(LL,BARSLAST(CUR=51)+1));
TL52:=CONST(REF(LL,BARSLAST(CUR=52)+1));TL53:=CONST(REF(LL,BARSLAST(CUR=53)+1));
TL54:=CONST(REF(LL,BARSLAST(CUR=54)+1));TL55:=CONST(REF(LL,BARSLAST(CUR=55)+1));
TL56:=CONST(REF(LL,BARSLAST(CUR=56)+1));TL57:=CONST(REF(LL,BARSLAST(CUR=57)+1));
TL58:=CONST(REF(LL,BARSLAST(CUR=58)+1));TL59:=CONST(REF(LL,BARSLAST(CUR=59)+1));
TL60:=CONST(REF(LL,BARSLAST(CUR=60)+1));TL61:=CONST(REF(LL,BARSLAST(CUR=61)+1));
TL62:=CONST(REF(LL,BARSLAST(CUR=62)+1));TL63:=CONST(REF(LL,BARSLAST(CUR=63)+1));
TL64:=CONST(REF(LL,BARSLAST(CUR=64)+1));TL65:=CONST(REF(LL,BARSLAST(CUR=65)+1));
TL66:=CONST(REF(LL,BARSLAST(CUR=66)+1));TL67:=CONST(REF(LL,BARSLAST(CUR=67)+1));
TL68:=CONST(REF(LL,BARSLAST(CUR=68)+1));
TO0:=CONST(OO);TO1:=CONST(REF(OO,BARSLAST(CUR=1)+1));
TO2:=CONST(REF(OO,BARSLAST(CUR=2)+1));TO3:=CONST(REF(OO,BARSLAST(CUR=3)+1));
TO4:=CONST(REF(OO,BARSLAST(CUR=4)+1));TO5:=CONST(REF(OO,BARSLAST(CUR=5)+1));
TO6:=CONST(REF(OO,BARSLAST(CUR=6)+1));TO7:=CONST(REF(OO,BARSLAST(CUR=7)+1));
TO8:=CONST(REF(OO,BARSLAST(CUR=8)+1));TO9:=CONST(REF(OO,BARSLAST(CUR=9)+1));
TO10:=CONST(REF(OO,BARSLAST(CUR=10)+1));TO11:=CONST(REF(OO,BARSLAST(CUR=11)+1));
TO12:=CONST(REF(OO,BARSLAST(CUR=12)+1));TO13:=CONST(REF(OO,BARSLAST(CUR=13)+1));
TO14:=CONST(REF(OO,BARSLAST(CUR=14)+1));TO15:=CONST(REF(OO,BARSLAST(CUR=15)+1));
TO16:=CONST(REF(OO,BARSLAST(CUR=16)+1));TO17:=CONST(REF(OO,BARSLAST(CUR=17)+1));
TO18:=CONST(REF(OO,BARSLAST(CUR=18)+1));TO19:=CONST(REF(OO,BARSLAST(CUR=19)+1));
TO20:=CONST(REF(OO,BARSLAST(CUR=20)+1));TO21:=CONST(REF(OO,BARSLAST(CUR=21)+1));
TO22:=CONST(REF(OO,BARSLAST(CUR=22)+1));TO23:=CONST(REF(OO,BARSLAST(CUR=23)+1));
TO24:=CONST(REF(OO,BARSLAST(CUR=24)+1));TO25:=CONST(REF(OO,BARSLAST(CUR=25)+1));
TO26:=CONST(REF(OO,BARSLAST(CUR=26)+1));TO27:=CONST(REF(OO,BARSLAST(CUR=27)+1));
TO28:=CONST(REF(OO,BARSLAST(CUR=28)+1));TO29:=CONST(REF(OO,BARSLAST(CUR=29)+1));
TO30:=CONST(REF(OO,BARSLAST(CUR=30)+1));TO31:=CONST(REF(OO,BARSLAST(CUR=31)+1));
TO32:=CONST(REF(OO,BARSLAST(CUR=32)+1));TO33:=CONST(REF(OO,BARSLAST(CUR=33)+1));
TO34:=CONST(REF(OO,BARSLAST(CUR=34)+1));TO35:=CONST(REF(OO,BARSLAST(CUR=35)+1));
TO36:=CONST(REF(OO,BARSLAST(CUR=36)+1));TO37:=CONST(REF(OO,BARSLAST(CUR=37)+1));
TO38:=CONST(REF(OO,BARSLAST(CUR=38)+1));TO39:=CONST(REF(OO,BARSLAST(CUR=39)+1));
TO40:=CONST(REF(OO,BARSLAST(CUR=40)+1));TO41:=CONST(REF(OO,BARSLAST(CUR=41)+1));
TO42:=CONST(REF(OO,BARSLAST(CUR=42)+1));TO43:=CONST(REF(OO,BARSLAST(CUR=43)+1));
TO44:=CONST(REF(OO,BARSLAST(CUR=44)+1));TO45:=CONST(REF(OO,BARSLAST(CUR=45)+1));
TO46:=CONST(REF(OO,BARSLAST(CUR=46)+1));TO47:=CONST(REF(OO,BARSLAST(CUR=47)+1));
TO48:=CONST(REF(OO,BARSLAST(CUR=48)+1));TO49:=CONST(REF(OO,BARSLAST(CUR=49)+1));
TO50:=CONST(REF(OO,BARSLAST(CUR=50)+1));TO51:=CONST(REF(OO,BARSLAST(CUR=51)+1));
TO52:=CONST(REF(OO,BARSLAST(CUR=52)+1));TO53:=CONST(REF(OO,BARSLAST(CUR=53)+1));
TO54:=CONST(REF(OO,BARSLAST(CUR=54)+1));TO55:=CONST(REF(OO,BARSLAST(CUR=55)+1));
TO56:=CONST(REF(OO,BARSLAST(CUR=56)+1));TO57:=CONST(REF(OO,BARSLAST(CUR=57)+1));
TO58:=CONST(REF(OO,BARSLAST(CUR=58)+1));TO59:=CONST(REF(OO,BARSLAST(CUR=59)+1));
TO60:=CONST(REF(OO,BARSLAST(CUR=60)+1));TO61:=CONST(REF(OO,BARSLAST(CUR=61)+1));
TO62:=CONST(REF(OO,BARSLAST(CUR=62)+1));TO63:=CONST(REF(OO,BARSLAST(CUR=63)+1));
TO64:=CONST(REF(OO,BARSLAST(CUR=64)+1));TO65:=CONST(REF(OO,BARSLAST(CUR=65)+1));
TO66:=CONST(REF(OO,BARSLAST(CUR=66)+1));TO67:=CONST(REF(OO,BARSLAST(CUR=67)+1));
TO68:=CONST(REF(OO,BARSLAST(CUR=68)+1));
TH0:=CONST(HH);TH1:=CONST(REF(HH,BARSLAST(CUR=1)+1));
TH2:=CONST(REF(HH,BARSLAST(CUR=2)+1));TH3:=CONST(REF(HH,BARSLAST(CUR=3)+1));
TH4:=CONST(REF(HH,BARSLAST(CUR=4)+1));TH5:=CONST(REF(HH,BARSLAST(CUR=5)+1));
TH6:=CONST(REF(HH,BARSLAST(CUR=6)+1));TH7:=CONST(REF(HH,BARSLAST(CUR=7)+1));
TH8:=CONST(REF(HH,BARSLAST(CUR=8)+1));TH9:=CONST(REF(HH,BARSLAST(CUR=9)+1));
TH10:=CONST(REF(HH,BARSLAST(CUR=10)+1));TH11:=CONST(REF(HH,BARSLAST(CUR |