以文本方式查看主题

-  金字塔客服中心 - 专业程序化交易软件提供商  (http://weistock.com/bbs/index.asp)
--  公式模型编写问题提交  (http://weistock.com/bbs/list.asp?boardid=4)
----  [求助]请帮忙写一个例子  (http://weistock.com/bbs/dispbbs.asp?boardid=4&id=152845)

--  作者:yohooo00
--  发布时间:2017/5/12 9:10:18
--  [求助]请帮忙写一个例子
满足条件A时,为买入参考信号,出现信号时的价位为参考信号价位1。当价格自参考信号价位1回落X价位时买入,止损幅度为实际买入价和参考信号价1的价差。
满足条件B时,为卖出参考信号,出现信号时的价位为参考信号价位2.当价格自参考信号价位2上升X价位时卖出,止损幅度为实际卖出价和参考信号价2的价差。
这实际上是一个回调买入的策略思路。搜了一下论坛没有找到类似的参考,所以想麻烦你们给写一个作为参考。谢谢。

--  作者:pyd
--  发布时间:2017/5/12 9:25:21
--  
图表交易吗?图表取不到实际买入价,只能取图上虚拟买入价位enterprice
--  作者:yohooo00
--  发布时间:2017/5/12 9:28:02
--  
enterprice即可。仅作参考。

--  作者:pyd
--  发布时间:2017/5/12 9:58:33
--  
VARIABLE:n=0,m=0;
if a then n:=c;
if n-l>=x and holding=0 then buy(1,1,marketr);
if enterprice-c>=abs(enterprice-n) and holding>0 then sell(1,1,marketr);
if b then m:=c;
if h-m>=x and holding=0 then buyshort(1,1,marketr);
if c-enterprice>=abs(enterprice-m) and holding<0 then sellshort(1,1,marketr)