以文本方式查看主题 - 金字塔客服中心 - 专业程序化交易软件提供商 (http://weistock.com/bbs/index.asp) -- 公式模型编写问题提交 (http://weistock.com/bbs/list.asp?boardid=4) ---- 有无函数能满足这样的需要? (http://weistock.com/bbs/dispbbs.asp?boardid=4&id=60262) |
|
-- 作者:torowills -- 发布时间:2013/12/24 9:58:02 -- 有无函数能满足这样的需要? 多:多条件1-对应止损多止损条件1,多条件2-对应多止损条件2,多条件3-对应多止损条件3 多止盈条件 比如在满足多条件1(或者2或者3)的情况下,开仓,止盈或者止损 请教如何能记录下,在开仓到平仓之间是不是满足过,条件2或者条件3,或者条件23都满足过
|
|
-- 作者:jinzhe -- 发布时间:2013/12/24 10:04:35 -- variable:n=0; if 开仓条件1 and holding=0 then begin 下单语句; n:=1; end if 开仓条件2 and holding=0 then begin 下单语句; n:=2; end
if 开仓条件3 and holding=0 then begin 下单语句; n:=3; end
if 平仓语句1 and n=1 then 平仓语句;
if 平仓语句2 and n=2 then 平仓语句;
if 平仓语句3 and n=3 then 平仓语句;
|
|
-- 作者:torowills -- 发布时间:2013/12/24 10:08:59 -- 这样的写法,如果在第一次开仓之后,持仓量>0,在没有平仓之前,N的值始终是1,没机会变成2或者3 |
|
-- 作者:jinzhe -- 发布时间:2013/12/24 10:11:48 -- 不会,改变的条件不仅是要开仓条件成立,还要持仓=0 |
|
-- 作者:torowills -- 发布时间:2013/12/24 10:17:12 --
|
|
-- 作者:jinzhe -- 发布时间:2013/12/24 10:25:56 -- variable:n=0;
if 开仓条件1 and holding=0 then begin 下单语句; n:=1; end if 开仓条件2 and holding=0 then begin 下单语句; n:=2; end
if 开仓条件3 and holding=0 then begin 下单语句; n:=3; end if 开仓条件1 then m1:=1; if 开仓条件2 then m2:=1; if 开仓条件3 then m3:=1;
if 平仓语句1 and n=1 then begin 平仓语句; m1:=0; m2:=0; m3:=0; end
if 平仓语句2 and n=2 then begin 平仓语句; m1:=0; m2:=0; m3:=0; end
if 平仓语句3 and n=3 then begin 平仓语句; m1:=0; m2:=0; m3:=0; end n=1 切m2=1,m3=1时,表示条件1开仓时,条件2和条件3成立过, m1=1表示条件1成立过,不管有没有开仓, m1=2表示条件2成立过,不管有没有开仓, m1=3表示条件3成立过,不管有没有开仓, |
|
-- 作者:torowills -- 发布时间:2013/12/24 11:54:23 -- 明白了,谢谢 |
|
-- 作者:torowills -- 发布时间:2013/12/24 15:44:57 -- 还想请问下 在最右侧的K线明显上穿黄色均线 有什么函数能判断图上左侧的若干K线(即开仓后)是不是不碰到黄色均线,随便哪个只要有1根满足即可,只需要判断有没有这样的K线,不需要取值等动作
[此贴子已经被作者于2013/12/24 15:45:23编辑过]
|
|
-- 作者:jinzhe -- 发布时间:2013/12/24 15:57:55 -- enterbars>0 and h<=黄色均线 and l>=黄色均线 |
|
-- 作者:torowills -- 发布时间:2013/12/24 18:49:23 -- aa:=BARSLAST(sellcond); if aa=0 then bb:=0; for i=1 to aa do begin if ref(close,i)<mad and ref(open,i)<mad then bb:=bb+1; if bb>1 then BREAK; end 请教老师哪不对?为什么BB>1之后还在继续计算?怎么样修改能让在BB>1的时候就停下来?
|