Rss & SiteMap

金字塔客服中心 - 专业程序化交易软件提供商 http://www.weistock.com/bbs/

专业程序化软件提供商
共14 条记录, 每页显示 10 条, 页签: [1] [2]
[浏览完整版]

标题:[求助]自定义N分钟线问题

1楼
devshj 发表于:2017/5/24 0:11:01

请教:

min15openB :=  callstockex(stklabel,vtopen,21,90,200); 
min15closeB:= callstockex(stklabel,vtclose,21,90,200); 

min30openB :  callstockex(stklabel,vtopen,21,240,1200); 
min30closeB: callstockex(stklabel,vtclose,21,240,1200); 

min5open:=ref(min5openB,1); 
min5close:=ref(min5closeB,1); 

min15open:=ref(min15openB,1); 
min15close:=ref(min15closeB,1); 

min30open:=ref(min30openB,1); 
min30close:=ref(min30closeB,1); 


本意是想取得90分钟、240分钟线的开盘和收盘价,在5分钟周期里看到的数据有偏差,不知如何确定?或者告知金字塔处理机制如何?
正常情况应该 240/5=48根K线变化一次,但实际上有时候是48根K线,有时不到48根K线就改变数值了,不知为何?





2楼
shq 发表于:2017/5/24 8:53:02
1、先补充数据完整,把1分钟、5分钟都补充上;偏差的话,建议去跟同品种的90min或者240minK线图的价格作对比,以确认是否有误;

2、另,240min周期不是你想象中的切分方式,建议你可以直接观察引用品种的240分钟K线图。
[此贴子已经被作者于2017/5/24 8:54:20编辑过]
3楼
devshj 发表于:2017/5/24 12:32:36
好的,谢谢。请问上述代码中是否存在未来函数的内容?开仓时以当前bar的收盘价计算
4楼
devshj 发表于:2017/5/24 12:34:49
此外,还想请教,如果是90分钟,240分钟,360分钟,金字塔是如何切分的? 有这个规则也可以,这样就知道具体情况,该怎么处理了
5楼
wenarm 发表于:2017/5/24 12:44:16
你可以在k线图上切换到对应周期,然后看下一天中的k线数据划分。更加便于分析
6楼
shq 发表于:2017/5/24 12:54:00
未来函数其实看的是 引用到未来的指标或某项值,目前的公式中,全是向前引用,故没有未来函数情况。
7楼
devshj 发表于:2017/5/24 23:00:57
runmode:0; 
INPUT:M2(90,30,100,10),M3(380,200,600,40);
手数:=1;  //开仓手数

min15openB := callstock(stklabel,vtopen,21,M2); 
min15closeB:= callstock(stklabel,vtclose,21,M2); 

min30openB := callstock(stklabel,vtopen,21,M3); 
min30closeB:= callstock(stklabel,vtclose,21,M3); 

min15open:=ref(min15openB,1); 
min15close:=ref(min15closeB,1); 

min30open:=ref(min30openB,1); 
min30close:=ref(min30closeB,1); 

entrylongcond := (min15close>min15open and min30close>min30open);
entryshortcond:=(min15close<min15open and min30close<min30open);
if holding=0 then begin 
   if entrylongcond then       buy(1,手数,nextopen); 
   if entryshortcond then       buyshort(1,手数,nextopen); 
end 

if holding>0 then begin 
   if time>=(closetime(0)-500)  then sell(1,holding,nextopen);
end 

if holding<0 then begin 
   if time>=(closetime(0)-500) then sellshort(1,holding,nextopen); 
end 
资产:asset,noaxis,coloryellow,linethick1;

请问这段样例代码写法有何问题? 测试实盘交易时,信号有严重漂移现象,明明前面已经开仓了,后面又开仓,而且开盘时明明是开空,走几根k线后信号会变成开多

8楼
shq 发表于:2017/5/25 8:41:10
如果还是5min周期在跑程序化的话,这是典型的“小周期引用大周期”问题,会造成信号闪烁及偏移。详细请看下:http://vip.weistock.com:8081/forum.php?mod=viewthread&tid=2713&extra=page%3D1
9楼
devshj 发表于:2017/5/25 11:58:34
是在5min中运行,但已经引用了前一根大周期信号,不知道为何会如此?如果要修订,应该修改什么地方呢?
10楼
shq 发表于:2017/5/25 12:27:15
思路没错,确实是向前引用,但是引用处有错,正确做法应该是 callstockex(stklabel,vtopen,21,90,-1,200); //具体写法请参考函数说明,不要再用ref。

原因解释下,您的写法代表的是引用上一个5分钟周期K线 的90分钟、240分钟线的开盘和收盘价,这个时候,这些引用还是在闪烁呀。我提供的写法是引用90分钟、240分钟周期下的前一根K线的开盘和收盘价,所以它就固定下来了。
[此贴子已经被作者于2017/5/25 12:27:47编辑过]
共14 条记录, 每页显示 10 条, 页签: [1] [2]


Powered By Dvbbs Version 8.3.0
Processed in 0.03516 s, 2 queries.