以文本方式查看主题

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

--  作者:Mikewang
--  发布时间:2015/12/14 13:43:49
--  求改写金字塔模型
 C>=BKPRICE+3&&C<=BKPRICE+5&&(CROSSDOWN(C,BKPRICE+1)),SP;
C>=BKPRICE+6&&C<=BKPRICE+7&&(CROSSDOWN(C,BKPRICE+3)),SP;
C>=BKPRICE+8&&C<=BKPRICE+9&&(CROSSDOWN(C,BKPRICE+5)),SP;
C>=BKPRICE+10&&(CROSSDOWN(C,H1-3)||EVERY(C<H1,2)),SP;
C<=SKPRICE-3&&C>=SKPRICE-5&&(CROSS(C,SKPRICE-1)),BP;
C<=SKPRICE-6&&C>=SKPRICE-7&&(CROSS(C,SKPRICE-3)),BP;
C<=SKPRICE-8&&C>=SKPRICE-9&&(CROSS(C,SKPRICE-5)),BP;
C<=SKPRICE-10&&(CROSS(C,H1+3)||EVERY(C>H1,2)),BP;
BKHIGH>BKPRICE+20&&BKHIGH<BKPRICE+23&&CROSSDOWN(C,BKPRICE-2),SP;
SKLOW<SKPRICE-20&&SKLOW>SKPRICE-23&&CROSS(C,SKPRICE+2),BP;

 上述思路是:
1、白线上穿黄线出现买入信号,立即以最新价下单,执行买入开仓或买入平仓,不进行复核,若有持仓,不得再开仓;在盈利3跳至5跳的前提条件下,当最新价回落至成本价与1跳之和(即成本价+1跳)时,以对手价卖出平仓;在盈利6跳至7跳的前提条件下,当最新价回落至成本价与3跳之和(即成本价+3跳)时,以对手价卖出平仓;在盈利8跳至9跳的前提条件下,当最新价回落至成本价与5跳之和(即成本价+5跳)时,以对手价卖出平仓;在盈利10跳及以上的前提条件下,当单个K线回落(是最新价,非收盘价)白线下3跳时,或连续两根K线的收盘价回落白线下时以对手价卖出平仓;在盈利10跳及以上的前提条件下,同时执行最新价从上一次高点回落3跳时,以对手价卖出平仓;
  2、在白线下穿黄线出现卖出信号,立即以最新价下单,执行卖出平仓或卖出开仓,不进行复核,若有持仓,不得再开仓;在盈利3跳至5跳的前提条件下,当最新价上涨至成本价与1跳之差(即成本价-1跳)时,以对手价买入平仓;在盈利6跳至7跳的前提条件下,当最新价上涨至成本价与3跳之差(即成本价-3跳)时,以对手价买入平仓;在盈利8跳至9跳的前提条件下,当最新价上涨至成本价与5跳之差(即成本价-5跳)时,以对手价买入平仓;在盈利10跳及以上的前提条件下,当单个K线上涨(是最新价,非收盘价)白线上3跳时,或连续两根K线的收盘价回落白线上时以对手价买入平仓;在盈利10跳及以上的前提条件下,同时执行最新价从上一次低点上涨3跳时,以对手价买入平仓;
3、最新价跌至开仓价下6跳,多单止损;买开仓后最新价达到止赢点差(20跳)但未达到追踪点差(23跳,20+3)就开始回撤,则最新价回撤到止赢点差下2跳,多单止赢;买开仓后最新价超出追踪点差,则最新价从上一次高点回撤3跳,多单止赢;//空单止赢止损与多单原理相同。

--  作者:Mikewang
--  发布时间:2015/12/14 13:44:49
--  
 另下午15:15前2分钟,若无亏损,立即平仓
怎么编写

--  作者:jinzhe
--  发布时间:2015/12/14 14:03:54
--  

C>=BKPRICE+3&&C<=BKPRICE+5&&(CROSSDOWN(C,BKPRICE+1)),SP;
C>=BKPRICE+6&&C<=BKPRICE+7&&(CROSSDOWN(C,BKPRICE+3)),SP;
C>=BKPRICE+8&&C<=BKPRICE+9&&(CROSSDOWN(C,BKPRICE+5)),SP;
C>=BKPRICE+10&&(CROSSDOWN(C,H1-3)||EVERY(C<H1,2)),SP;
C<=SKPRICE-3&&C>=SKPRICE-5&&(CROSS(C,SKPRICE-1)),BP;
C<=SKPRICE-6&&C>=SKPRICE-7&&(CROSS(C,SKPRICE-3)),BP;
C<=SKPRICE-8&&C>=SKPRICE-9&&(CROSS(C,SKPRICE-5)),BP;
C<=SKPRICE-10&&(CROSS(C,H1+3)||EVERY(C>H1,2)),BP;

BKHIGH>BKPRICE+20&&BKHIGH<BKPRICE+23&&CROSSDOWN(C,BKPRICE-2),SP;
SKLOW<SKPRICE-20&&SKLOW>SKPRICE-23&&CROSS(C,SKPRICE+2),BP;
15:15前2分钟,若无亏损,立即平仓

 

上述语句编写澄金字塔的代码为:

if c>=enterprice+3 and c<=enterprice+5 and cross(enterprice+1,c) then sell(1,0,market);

if c>=enterprice+6 and c<=enterprice+7 and cross(enterprice+3,c) then sell(1,0,market);

if c>=enterprice+8 and c<=enterprice+9 and cross(enterprice+5,c) then sell(1,0,market);
if c<=enterprice-3 and c>=enterprice-5 and cross(c,enterprice-1) then sellshort(1,0,market);

if c<=enterprice-6 and c>=enterprice-7 and cross(c,enterprice-3) then sellshort(1,0,market);

if c<=enterprice-38 and c>=enterprice-9and cross(c,enterprice-5) then sellshort(1,0,market);

if hhv(h,enterbars+1)>enterprice+20 and hhv(h,enterbars+1)+23 and cross(enterprice-2,close) then sell(1,0,market);

if llv(l,enterbars+1)<enterprice-20 and llv(l,enterbars+1)-23 and cross(c,enterprice+2) then sellshort(1,0,market);

if openprofit>=0 and time0>=timetot0(closetime(0))-60*2 then begin

    sell(1,0,market);

    sellshort(1,0,market);

end


 


--  作者:Mikewang
--  发布时间:2015/12/16 12:59:51
--  

为何下列程序止损不起作用,好像没有一样?
//止损1:sell(C<ENTERPRICE-12*MINDIFF,holding,marketr);
//止损2:sellshort(C>ENTERPRICE+12*MINDIFF,holding,marketr)
if c>=enterprice+3 and c<=enterprice+5 and cross(enterprice+1,c) then sell(1,0,market);
if c>=enterprice+6 and c<=enterprice+7 and cross(enterprice+3,c) then sell(1,0,market);
if c>=enterprice+8 and c<=enterprice+9 and cross(enterprice+5,c) then sell(1,0,market);
if c<=enterprice-3 and c>=enterprice-5 and cross(c,enterprice-1) then sellshort(1,0,market);
if c<=enterprice-6 and c>=enterprice-7 and cross(c,enterprice-3) then sellshort(1,0,market);
if c<=enterprice-3 and c>=enterprice-9 and cross(c,enterprice-5) then sellshort(1,0,market);
if hhv(h,enterbars+1)>enterprice+20 and hhv(h,enterbars+1)+23 and cross(enterprice-2,close) then sell(1,0,market);
if llv(l,enterbars+1)<enterprice-20 and llv(l,enterbars+1)-23 and cross(c,enterprice+2) then sellshort(1,0,market);
if openprofit>=0 and time0>=timetot0(closetime(0))-60*2 then begin
    sell(1,0,market);
    sellshort(1,0,market);
end

--  作者:jinzhe
--  发布时间:2015/12/16 13:12:22
--  
说明你讲的这些条件都不能成立
--  作者:Mikewang
--  发布时间:2015/12/16 13:59:18
--  
上述思路是:
1、白线上穿黄线出现买入信号,立即以最新价下单,执行买入开仓或买入平仓,不进行复核,若有持仓,不得再开仓;在盈利3跳至5跳的前提条件下,当最新价回落至成本价与1跳之和(即成本价+1跳)时,以对手价卖出平仓;在盈利6跳至7跳的前提条件下,当最新价回落至成本价与3跳之和(即成本价+3跳)时,以对手价卖出平仓;在盈利8跳至9跳的前提条件下,当最新价回落至成本价与5跳之和(即成本价+5跳)时,以对手价卖出平仓;在盈利10跳及以上的前提条件下,当单个K线回落(是最新价,非收盘价)白线下3跳时,或连续两根K线的收盘价回落白线下时以对手价卖出平仓;在盈利10跳及以上的前提条件下,同时执行最新价从上一次高点回落3跳时,以对手价卖出平仓;
  2、在白线下穿黄线出现卖出信号,立即以最新价下单,执行卖出平仓或卖出开仓,不进行复核,若有持仓,不得再开仓;在盈利3跳至5跳的前提条件下,当最新价上涨至成本价与1跳之差(即成本价-1跳)时,以对手价买入平仓;在盈利6跳至7跳的前提条件下,当最新价上涨至成本价与3跳之差(即成本价-3跳)时,以对手价买入平仓;在盈利8跳至9跳的前提条件下,当最新价上涨至成本价与5跳之差(即成本价-5跳)时,以对手价买入平仓;在盈利10跳及以上的前提条件下,当单个K线上涨(是最新价,非收盘价)白线上3跳时,或连续两根K线的收盘价回落白线上时以对手价买入平仓;在盈利10跳及以上的前提条件下,同时执行最新价从上一次低点上涨3跳时,以对手价买入平仓;
3、最新价跌至开仓价下6跳,多单止损;买开仓后最新价达到止赢点差(20跳)但未达到追踪点差(23跳,20+3)就开始回撤,则最新价回撤到止赢点差下2跳,多单止赢;买开仓后最新价超出追踪点差,则最新价从上一次高点回撤3跳,多单止赢;//空单止赢止损与多单原理相同。


--  作者:Mikewang
--  发布时间:2015/12/16 13:59:55
--  
谢谢帮助修改一下吧
--  作者:jinzhe
--  发布时间:2015/12/16 14:11:19
--  
if c>=enterprice+3 and c<=enterprice+5 and cross(enterprice+1,c) then sell(1,0,market);
if c>=enterprice+6 and c<=enterprice+7 and cross(enterprice+3,c) then sell(1,0,market);
if c>=enterprice+8 and c<=enterprice+9 and cross(enterprice+5,c) then sell(1,0,market);
if c<=enterprice-3 and c>=enterprice-5 and cross(c,enterprice-1) then sellshort(1,0,market);
if c<=enterprice-6 and c>=enterprice-7 and cross(c,enterprice-3) then sellshort(1,0,market);
if c<=enterprice-3 and c>=enterprice-9 and cross(c,enterprice-5) then sellshort(1,0,market);
if hhv(h,enterbars+1)>enterprice+20 and hhv(h,enterbars+1)<enterprice+23 and cross(enterprice-2,close) then sell(1,0,market);
if llv(l,enterbars+1)<enterprice-20 and llv(l,enterbars+1)>enterprice-23 and cross(c,enterprice+2) then sellshort(1,0,market);
if openprofit>=0 and time0>=timetot0(closetime(0))-60*2 then begin
    sell(1,0,market);
    sellshort(1,0,market);
end


--  作者:jinzhe
--  发布时间:2015/12/16 14:11:33
--  
如果还没有信号,请发全部完整的代码
--  作者:客人
--  发布时间:2015/12/16 15:46:31
--  
漏了固定止损12跳,原来程序语句如下,如何与上述联系起来?
谢谢

/止损1:sell(C<ENTERPRICE-12*MINDIFF,holding,marketr);
//止损2:sellshort(C>ENTERPRICE+12*MINDIFF,holding,marketr)