PDA

View Full Version : 如何表达明天收盘买卖


fxj9999
2008-12-27, 10:32
easylanguige里只能今日收盘买卖,明天收盘买卖是个难题。例如,如果想表达如下想法该如何编写程序:

按照今天收盘价买入,明天报出今天的最高价出货,如果没有成交,那么以明天收盘价卖出,连续交易。

试着编写了个公式,插入图中一看,不能很好表达这种想法。

贴出来大家提提宝贵意见:

vars:m1(0);
m1=h;
if m1[1]<m1 {and marketposition=1} then sell this bar close;
//if m1[1]<h and currententries=1 then sell this bar close;
//if marketposition(1)=1 then sell this bar close;
//if currententries=1 then sell this bar close;
buy this bar close;
sell next bar m1 limit;

fxj9999
2008-12-27, 15:57
与此类似的还有不少,举个简单的,明天开盘买入,后天开盘卖出,再次开盘买入,——如此循环。

ts应当有简单的表达方案,要不,真连分析家大智慧都不如了。:rolleyes:

maharaj
2008-12-28, 21:40
如果我理解你的意思没错的话,这个不难。

>> 按照今天收盘价买入,明天报出今天的最高价出货,如果没有成交,那么以明天收盘价卖出

你用日线,
{ SetupBuy 是你买入的条件 }
if SetupBuy then begin
buy this bar at close;
sell next bar at High limit;
end;
if SetupBuy[1] then sell this bar at close; {如果你已经在昨日高卖出,则没可卖的了,这句什么动作也不做}

其他的可以类推。

fxj9999
2008-12-29, 02:55
maharaj:

vars:setupbuy(false);
setupbuy=c>0;
if SetupBuy then begin
buy this bar at close;
sell next bar at High limit;
end;
if SetupBuy[1] then sell this bar at close;


请注意第7根带交易的k线,之前均为今收买入明收卖出,之后均为今收买入今收卖出。

怀疑ts在这个问题上有bug。

maharaj
2008-12-29, 03:15
fxj9999, 在TS里,单日内多笔交易经常是理不清的。我的做法是根据具体情况加条件:

vars:setupbuy(false);
setupbuy=c>0;
if SetupBuy then begin
buy this bar at close;
sell next bar at High limit;
end;
if SetupBuy[1] and H < H[1] then sell this bar at close;

fxj9999
2008-12-29, 16:31
看来是理不清了:o,ts的遗憾!

maharaj
2008-12-29, 19:00
不过,这是个好问题,TS的老手们,neo_cn版主,有何高见?