以文本方式查看主题

-  金字塔客服中心 - 专业程序化交易软件提供商  (http://weistock.com/bbs/index.asp)
--  公式模型编写问题提交  (http://weistock.com/bbs/list.asp?boardid=4)
----  有个问题想来想去想不懂怎样写  (http://weistock.com/bbs/dispbbs.asp?boardid=4&id=57185)

--  作者:ailegrasper
--  发布时间:2013/9/30 17:43:55
--  有个问题想来想去想不懂怎样写
请问求开仓以来最高点和最低点,到平仓就停止,应该怎样写?求指教,想疯了。。。。
--  作者:自渔自乐
--  发布时间:2013/9/30 19:27:15
--  

HHV(H,ENTERBARS+1);
LLV(L,ENTERBARS+1);

--  作者:fly
--  发布时间:2013/10/8 16:13:52
--  如果市价比5*mindiff个点低,则直接买入要如何表达

开仓以来最高点和最低点,到平仓就停止.

 

此处以多头开仓以来最高点为例,最低价请自行补充完善

 

variable:h1=drawnull;//开多后最高价

 

ma5:ma(c,5);
ma20:ma(c,20);

if cross(ma5,ma20) and holding=0 then
 begin
 buy(1,1,marketr);
 h1:=high;
 end

if holding>0 and high>h1 then h1:=high;//开仓后的最高价

 

if cross(ma20,ma5) and holding>0 then
 begin
 sell(1,1,marketr);
 end
 
hh:h1;