以文本方式查看主题

-  金字塔客服中心 - 专业程序化交易软件提供商  (http://weistock.com/bbs/index.asp)
--  公式模型编写问题提交  (http://weistock.com/bbs/list.asp?boardid=4)
----  [求助]修改公式,先谢谢!!!  (http://weistock.com/bbs/dispbbs.asp?boardid=4&id=2152)

--  作者:wzywzy292
--  发布时间:2010/7/17 1:10:22
--  [求助]修改公式,先谢谢!!!
VARIABLE: aspect多=0; //初始化假定做多头
VARIABLE: stopprice多=0;//止损价格变量
VARIABLE: stopnum多 = 10; //止损价差
 
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


VARIABLE: aspect空=1; //初始化假定做多头
VARIABLE: stopprice空=0;//止损价格变量
VARIABLE: stopnum空 = 10; //止损价差

if barpos = 0 then
  stopprice空 := h + stopnum空;

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));

上式是根据移动止损范例(http://www.weistock.com/bbs/dispbbs.asp?BoardID=4&ID=1900&replyID=&skin=1)改成的两个独立(分别为多和空)的移动止损公式,但问题是图上没有显示,请领导帮忙解决,谢谢!!!