以文本方式查看主题

-  金字塔客服中心 - 专业程序化交易软件提供商  (http://weistock.com/bbs/index.asp)
--  公式模型编写问题提交  (http://weistock.com/bbs/list.asp?boardid=4)
----  谁来帮我解释解释这个交易指标  (http://weistock.com/bbs/dispbbs.asp?boardid=4&id=33819)

--  作者:tyq988
--  发布时间:2012/12/20 11:43:41
--  谁来帮我解释解释这个交易指标

//移动止损范移
VARIABLE: aspect=0;//初始化假定做多头
VARIABLE: stopprice=0;//止损价格变量
VARIABLE: stopnum=0;//止损价差
RUNMODE:0;//工作于逐周期模式

if barpos = 0 then
  stopprice := l - stopnum;
 if aspect = 0 then
 begin
 //多头处理
 if l <= stopprice then
 begin
 //多反空
 aspect:=1;
 stopprice := h+stopnum;
 end
 
 //处理移动的底部
 if l - stopnum > stopprice then
 stopprice := l - stopnum;
 end
 
 if aspect = 1 then
 begin
 //空头处理
 if h >= stopprice then
 begin
 //空反多
 aspect:=0;
 stopprice:=l-stopnum;
 end
 
 //处理移动的底部
 if h + stopnum < stopprice then
  stopprice := h+stopnum;
 end
 
 //画线
 PARTLINE( aspect =0,stopprice,colorrgb(255,0,0));
 PARTLINE( aspect =1,stopprice,colorrgb(0,255,0));


--  作者:jinzhe
--  发布时间:2012/12/20 13:20:32
--  

移动止损,全局变量来记录变化的价差。


--  作者:tyq988
--  发布时间:2012/12/20 14:09:42
--  
能讲的祥细点吗?就是把公式的原理讲一下!怎么实现的止损,我就是看不太懂公式!还有上面一个全局变量写错了,是VARIABLE: stopnum=10;//止损价差   
谢谢
--  作者:tyq988
--  发布时间:2012/12/20 15:02:17
--  
有人讲讲吗?
--  作者:jinzhe
--  发布时间:2012/12/20 15:19:16
--  

弄个简单的

variable:a=0;//设置全局变量

if H>a then a:=H;//当H大于a时,把close赋值给a

此步骤就能记录历史上出现的最高价


--  作者:tyq988
--  发布时间:2012/12/20 15:22:04
--  
以下是引用jinzhe在2012-12-20 15:19:16的发言:

弄个简单的

variable:a=0;//设置全局变量

if H>a then a:=H;//当H大于a时,把close赋值给a

此步骤就能记录历史上出现的最高价

你这不是把H赋值给a吗,怎么把close赋值给a了!


--  作者:jinzhe
--  发布时间:2012/12/20 15:47:34
--  

解释错了,close写顺手了

把close改成high