多谢 周易2000 分享思路.
指标公式原版是飞狐与大智慧源码!现在发的是通达信版本的,必须使用新版通达信才可以编辑成公式
个人说明一下:
1` 本指标是专门应用于上证数的月周期。
2` 本指标以后是要自己动手进行数据输入的。
{上证平均市盈率历史 _[通达信版] 壹瓣杺埖 }
{N取值随数据添加改变(添加1个等于1` 添加2个等于2)以此类推!}
N:=0;
DRAWBAND(80,RGB(225,200,190),10,RGB(225,200,190));
STICKLINE(8=8,10,10,1,0);
STICKLINE(8=8,20,20.5,10,0),COLOR007700;
STICKLINE(8=8,30,30,1,0);
STICKLINE(8=8,40,40,1,0);
STICKLINE(8=8,50,50.3,10,0),COLORBROWN;
STICKLINE(8=8,60,60,1,0);
STICKLINE(8=8,70,70,1,0);
STICKLINE(8=8,80,80,1,0);
CURR:=CURRBARSCOUNT;
A98:=34.03; A99:=34.03; A100:=34.30;A101:=34.39;A102:=35.30;A103:=45.37;
A104:=43.93;A105:=43.89;A106:=42.52;A107:=40.84;A108:=40.09;A109:=38.14;
A110:=42.82;A111:=47.99;A112:=49.92;A113:=51.13;A114:=54.02;A115:=55.22;
A116:=58.21;A117:=58.13;A118:=54.83;A119:=56.31;A120:=59.89;A121:=59.14;
A122:=59.39;A123:=56.82;A124:=60.88;A125:=60.99;A126:=55.92;A127:=56.55;
A128:=49.26;A129:=42.14;A130:=40.61;A131:=38.84;A132:=40.08;A133:=37.59;
A134:=34.31;A135:=35.11;A136:=37.16;A137:=39.08;A138:=38.75;A139:=44.47;
A140:=42.40;A141:=43.02;A142:=40.40;A143:=38.23;A144:=36.46;A145:=34.50;
A146:=37.92;A147:=38.20;A148:=38.20;A149:=38.54;A150:=38.28;A151:=36.11;
A152:=35.78;A153:=34.37;A154:=32.97;A155:=32.51;A156:=34.00;A157:=36.64;
A158:=38.91;A159:=40.89;A160:=42.49;A161:=38.95;A162:=28.73;A163:=26.65;
A164:=26.49;A165:=25.68;A166:=26.75;A167:=25.34;A168:=25.69;A169:=24.29;
A170:=22.87;A171:=24.99;A172:=22.63;A173:=22.28;A174:=15.66;A175:=15.98;
A176:=16.05;A177:=16.92;A178:=16.78;A179:=15.72;A180:=15.63;A181:=16.38;
A182:=17.61;A183:=18.00;A184:=17.72;A185:=19.42;A186:=19.69;A187:=19.91;
A188:=20.03;A189:=20.38;A190:=21.41;A191:=22.86;A192:=26.13;A193:=33.38;
A194:=38.36;A195:=39.62;A196:=44.36;A197:=53.33;A198:=43.42;A199:=42.74;
A200:=50.59;A201:=59.24;A202:=63.74;A203:=69.64;A204:=53.79;A205:=59.24;
A206:=49.40;A207:=49.21;A208:=39.45;A209:=42.06;A210:=25.89;A211:=20.64;
A212:=20.93;A213:=18.13;A214:=18.68;A215:=14.09;A216:=15.23;A217:=14.86;
A218:=16.26;A219:=17.01;A220:=19.37;A221:=20.21;A222:=22.47;A223:=25.36;
A224:=29.47;A225:=23.04;A226:=24.12;A227:=26.03;A228:=27.93;A229:=28.78;
A230:=26.24;A231:=26.91;A232:=27.54;A233:=25.42;A234:=19.93;A235:=18.47;
A236:=19.86;A237:=19.85;A238:=20.00;A239:=22.61;A240:=21.51;A241:=21.60;
A242:=21.63;A243:=22.56;A244:=22.77;A245:=22.74;A246:=16.34;A247:=16.49;
A248:=16.14;A249:=15.42;A250:=14.19;A251:=14.96;A252:=15.21;A253:=15.21;
率0:=IF(CURR=151,A103,IF(CURR=152,A102,IF(CURR=153,A101,IF(CURR=154,A100,IF(CURR=155,A99,
IF(CURR=156,A98,DRAWNULL))))));
率1:=IF(CURR=101,A153,IF(CURR=102,A152,IF(CURR=103,A151,IF(CURR=104,A150,IF(CURR=105,A149,
IF(CURR=106,A148,IF(CURR=107,A147,IF(CURR=108,A146,IF(CURR=109,A145,IF(CURR=110,A144,
IF(CURR=111,A143,IF(CURR=112,A142,IF(CURR=113,A141,IF(CURR=114,A140,IF(CURR=115,A139,
IF(CURR=116,A138,IF(CURR=117,A137,IF(CURR=118,A136,IF(CURR=119,A135,IF(CURR=120,A134,
IF(CURR=121,A133,IF(CURR=122,A132,IF(CURR=123,A131,IF(CURR=124,A130,IF(CURR=125,A129,
IF(CURR=126,A128,IF(CURR=127,A127,IF(CURR=128,A126,IF(CURR=129,A125,IF(CURR=130,A124,
IF(CURR=131,A123,IF(CURR=132,A122,IF(CURR=133,A121,IF(CURR=134,A120,IF(CURR=135,A119,
IF(CURR=136,A118,IF(CURR=137,A117,IF(CURR=138,A116,IF(CURR=139,A115,IF(CURR=140,A114,
IF(CURR=141,A113,IF(CURR=142,A112,IF(CURR=143,A111,IF(CURR=144,A110,IF(CURR=145,A109,
IF(CURR=146,A108,IF(CURR=147,A107,IF(CURR=148,A106,IF(CURR=149,A105,IF(CURR=150,A104,
率0))))))))))))))))))))))))))))))))))))))))))))))))));
率2:=IF(CURR=51,A203,IF(CURR=52,A202,IF(CURR=53,A201,IF(CURR=54,A200,IF(CURR=55,A199,
IF(CURR=56,A198,IF(CURR=57,A197,IF(CURR=58,A196,IF(CURR=59,A195,IF(CURR=60,A194,
IF(CURR=61,A193,IF(CURR=62,A192,IF(CURR=63,A191,IF(CURR=64,A190,IF(CURR=65,A189,
IF(CURR=66,A188,IF(CURR=67,A187,IF(CURR=68,A186,IF(CURR=69,A185,IF(CURR=70,A184,
IF(CURR=71,A183,IF(CURR=72,A182,IF(CURR=73,A181,IF(CURR=74,A180,IF(CURR=75,A179,
IF(CURR=76,A178,IF(CURR=77,A177,IF(CURR=78,A176,IF(CURR=79,A175,IF(CURR=80,A174,
IF(CURR=81,A173,IF(CURR=82,A172,IF(CURR=83,A171,IF(CURR=84,A170,IF(CURR=85,A169,
IF(CURR=86,A168,IF(CURR=87,A167,IF(CURR=88,A166,IF(CURR=89,A165,IF(CURR=90,A164,
IF(CURR=91,A163,IF(CURR=92,A162,IF(CURR=93,A161,IF(CURR=94,A160,IF(CURR=95,A159,
IF(CURR=96,A158,IF(CURR=97,A157,IF(CURR=98,A156,IF(CURR=99,A155,IF(CURR=100,A154,
率1))))))))))))))))))))))))))))))))))))))))))))))))));
率3:=IF(CURR=4,A250,IF(CURR=5,A249,IF(CURR=6,A248,IF(CURR=7,A247,IF(CURR=8,A246,
IF(CURR=9,A245,IF(CURR=10,A244,IF(CURR=11,A243,IF(CURR=12,A242,IF(CURR=13,A241,
IF(CURR=14,A240,IF(CURR=15,A239,IF(CURR=16,A238,IF(CURR=17,A237,IF(CURR=18,A236,
IF(CURR=19,A235,IF(CURR=20,A234,IF(CURR=21,A233,IF(CURR=22,A232,IF(CURR=23,A231,
IF(CURR=24,A230,IF(CURR=25,A229,IF(CURR=26,A228,IF(CURR=27,A227,IF(CURR=28,A226,
IF(CURR=29,A225,IF(CURR=30,A224,IF(CURR=31,A223,IF(CURR=32,A222,IF(CURR=33,A221,
IF(CURR=34,A220,IF(CURR=35,A219,IF(CURR=36,A218,IF(CURR=37,A217,IF(CURR=38,A216,
IF(CURR=39,A215,IF(CURR=40,A214,IF(CURR=41,A213,IF(CURR=42,A212,IF(CURR=43,A211,
IF(CURR=44,A210,IF(CURR=45,A209,IF(CURR=46,A208,IF(CURR=47,A207,IF(CURR=48,A206,
IF(CURR=49,A205,IF(CURR=50,A204,率2)))))))))))))))))))))))))))))))))))))))))))))));
率4:=IF(CURR>N,REFX(REF(IF(ISLASTBAR,A253,IF(CURR=2,A252,IF(CURR=3,A251,率3))),1),N),DRAWNULL);
{新数据}
{A254:= ; A255:= ; A256:= ; A257:= ; A258:= ; A259:= ; A260:= ;}
上证平均市盈率:=IF(PERIOD=7,率4,DRAWNULL);
{例式1:
率5:=IF(ISLASTBAR,A254,DRAWNULL);
上证平均市盈率:=IF(PERIOD=7,率5,DRAWNULL)+率4;}
{例式2:
率5:=IF(ISLASTBAR,A255,IF(CURR=2,A254,DRAWNULL));
上证平均市盈率:=IF(PERIOD=7,率5,DRAWNULL)+率4;}
DRAWBAND(上证平均市盈率,RGB(180,0,0),上证平均市盈率,RGB(180,0,0));
上证指数:=IF(PERIOD=7,C/100+10,DRAWNULL);
DRAWBAND(上证指数,RGB(22,20,190),上证指数,RGB(22,20,190));
DRAWTEXT(上证平均市盈率=A203,上证平均市盈率,'←69。64'),COLOR223388;
DRAWTEXT(上证平均市盈率=A215,上证平均市盈率,'←14。09'),COLOR223388;
DRAWTEXT_FIX(8=8,0.5,0,0,'上证指数历史平均市盈率'),COLOR2D4045;
DRAWTEXT_FIX(8=8,0,0.1,0,'■平均市盈率'),COLOR0000AA;
DRAWTEXT_FIX(8=8,0,0.2,0,'■上证指数'),COLOR8F0000;
DRAWTEXT_FIX(8=8,0.3,0.15,0,'高风险区域'),COLOR2D4045;
DRAWTEXT_FIX(8=8,0.3,0.85,0,'低风险区域'),COLOR2D4045;
DRAWTEXT_FIX(8=8,0,0.9,0,'上证指数月周期专用'),COLOR0000FF;
必须使用新版通达信才可以编辑成公式,本人没安装,所以请大家自己编辑成公式吧 |