要求:如果14:30后日线上的收盘价格(A)小于前两周周K线的最低价的时候,如果有多单,平调所有多单,开(N)手空单,如果有空单,不继续开空。
如果14:30后日线上的收盘价格(A)大于前两周周K线的最高价的时候,如果有空单,平调所有空单,开(N)手多单,如果有多单,不继续开多。
请问怎么编写?如果想在图标显示怎么弄?
现建一个指标
高低指标
HH:HHV(H,2);
LL:LLV(L,2);
============
再调用高低指标
HH2:” 高低指标.HH##WEEK”;
LL2:” 高低指标.LL##WEEK”;
sell(holding>0 and low< LL2,0,market);
sellshort(holding<0 and high> HH2,0, market);
buy(holding=0 and high> HH2,N, market);
buyshort(holding=0 and low< LL2,N , market);
HH:ref(HHV(H,2),1);
LL:ref(LLV(L,2),1);
hh2:"HH##WEEK";
LL2:"LL##WEEK";
sell(holding>0 and c< LL2,0,market);//C<ll2,如果有多单全部平掉,
sellshort(holding<0 and c> HH2,0, market);//c>hh2,如果有空单全部平掉
buy(holding=0 and c> HH2,N, market);//如果没单,c>hh2,开N手多单
buyshort(holding=0 and c< LL2,N , market);//如果没单,c<ll2,开n手空单
CURRENTTIME>=145000;
如何在图表显示?
条件是 CURRENTTIME>=145000
下午试就知道有没有用了
单独建一个指标
高低指标
HH:HHV(H,2);
LL:LLV(L,2);
上面的指标名称:高低指标,需建在技术指标类
在交易系统类,建立下面的
input: N(2,1,30);
HH2:” 高低指标.HH##WEEK”;
LL2:” 高低指标.LL##WEEK”;
TT:=CURRENTTIME>=145000;
sellshort(TT and holding<0 and c> HH2,0, market);//c>hh2,如果有空单全部平掉
buy(TT and holding=0 and c> HH2,N, market);//如果没单,c>hh2,开N手多单
buyshort(TT and holding=0 and c< LL2,N , market);//如果没单,c<ll2,开n手空单
自动交易改为:
input: N(2,1,30);
HH2:”
高低指标.HH##WEEK”;LL2:” 高低指标.LL##WEEK”;
TT:=CURRENTTIME>=145000;
tsell(TT and tholding>0 and c< LL2,0,mkt);//C<ll2,如果有多单全部平掉,
tsellshort(TT and tholding<0 and c> HH2,0, mkt);//c>hh2,如果有空单全部平掉
tbuy(TT and tholding=0 and c> HH2,N, mkt);//如果没单,c>hh2,开N手多单
tbuyshort(TT and tholding=0 and c< LL2,N , mkt);//如果没单,c<ll2,开n手空单