Rss & SiteMap

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

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

标题:[求助]这个条件怎么写简明?

1楼
mel_6e 发表于:2011/2/22 12:19:03

我以20均线下穿50均线,并且突破前面10根线的低点开空仓,现在需要写一个条件。要求突破10根之前的n个周期内,10分钟线曾经反翘过,ma10>ref(ma10,1)||ref(ma10,1)<ref(ma10,2)......一直到前n周期吧,如果前n周期内ma10上翘过,那么设置个条件=1后面开仓用。

 

应该需要用if else,写不太好,请帮助。

 

2楼
z7c9 发表于:2011/2/22 13:27:09

runmode:0;

ma1:=ma(close,20);
ma2:=ma(close,50);

shortCond:=cross(ma2,ma1) and close<=ref(llv(close,10),1);

if holding=0 then begin
 if shortCond then
  sellshort(1,1,limitr,close);
end

3楼
mel_6e 发表于:2011/2/22 16:11:48
以下是引用z7c9在2011-2-22 13:27:09的发言:

runmode:0;

ma1:=ma(close,20);
ma2:=ma(close,50);

shortCond:=cross(ma2,ma1) and close<=ref(llv(close,10),1);

if holding=0 then begin
 if shortCond then
  sellshort(1,1,limitr,close);
end

你好,我是想写“ma10在前n个周期曾经上翘过”这个条件,例如n=10,笨一点的方式就是穷举法

Shangqiao:=ma10>ref(ma10,1)||ref(ma10,1)>ref(ma10,2)||ref(ma10,2)>ref(ma10,3)||ref(ma10,3)>ref(ma10,4)||ref(ma10,4)>ref(ma10,5)||ref(ma10,5)>ref(ma10,6)||ref(ma10,6)>ref(ma10,7)||ref(ma10,7)>ref(ma10,8)||ref(ma10,8)>ref(ma10,9)||ref(ma10,9)>ref(ma10,10);

连续10个or,想用n代替10,用if语句来完成。不知道说清楚了没,均线交叉和突破我会写

 

[此贴子已经被作者于2011-2-22 16:14:21编辑过]
4楼
mel_6e 发表于:2011/2/24 14:21:49
以下是引用mel_6e在2011-2-22 16:11:48的发言:

你好,我是想写“ma10在前n个周期曾经上翘过”这个条件,例如n=10,笨一点的方式就是穷举法

Shangqiao:=ma10>ref(ma10,1)||ref(ma10,1)>ref(ma10,2)||ref(ma10,2)>ref(ma10,3)||ref(ma10,3)>ref(ma10,4)||ref(ma10,4)>ref(ma10,5)||ref(ma10,5)>ref(ma10,6)||ref(ma10,6)>ref(ma10,7)||ref(ma10,7)>ref(ma10,8)||ref(ma10,8)>ref(ma10,9)||ref(ma10,9)>ref(ma10,10);

连续10个or,想用n代替10,用if语句来完成。不知道说清楚了没,均线交叉和突破我会写

 

[此贴子已经被作者于2011-2-22 16:14:21编辑过]

快沉了,版主帮忙写下啊,ma10在前10个周期曾经上翘过至少一次,我本来想写,ma10在前10个周期至少上翘过两次的,用穷举法就没法写了。谢谢!

5楼
fly 发表于:2011/2/24 16:05:24

请楼主参考

runmode:1;//运行在序列模式下

num:=0;    //ma10在前10周期上翘次数
ma10:=ma(close,10);


FOR i=DATACOUNT DOWNTO DATACOUNT-10 DO BEGIN
 if ma10[i]>ma10[i-1] then begin     //每记录数增加1
  num:=num+1;
 end
END

 

if num>2 then  //至少上翘过两次
begin

相关操作....

num:=0;  //num恢值为0
end

共5 条记录, 每页显示 10 条, 页签: [1]


Powered By Dvbbs Version 8.3.0
Processed in 0.03125 s, 3 queries.