下面是“多头开仓均价盈利大于100点时,以盈利100点的位置为低点,100+N点为高点,这段距离回落一半止盈
”的代码。
如果改成“由开盘价上行大于100点时,以上行100点的位置为低点,100+N点为高点,这段距离回落一半止盈
”,应该怎么写呢,改了几次好像都有问题
variable:maxprofit=0;//有仓位时最大获利
if 条件 and holding=0 then
begin
buy();
maxprofit:=0;
end
win:=0;
win2:=0;
if holding > 0 and enterbars > 0 then
begin
win:=(high-enterprice); //记录最大盈利
if win > maxprofit then
maxprofit:=win;
win2:=maxprofit-win; //最大盈利后的回调幅度
end
//多头止盈
if maxprofit>=100 and holding>0 then
SELL(win2<100+0.5*(maxprofit-100),1,market);
这个不是一个概念?
把H-enterprice改成open
这个不是一个概念?
把H-enterprice改成open
我没说清楚,是当天日线的开盘价 callstock(stklabel,VTopen,6)
还是一样啊,把这个open替换成日线开盘价
还是一样啊,把这个open替换成日线开盘价
原来是这样啊。。。。我想多了
if 条件 and holding=0 then
begin
buy();
maxprofit:=0;
end
那这一段中的赋值可以删掉了是吗
5分钟周期下,以价格距离当日的开盘价的变化来止盈,这没必要在开仓条件下写个maxprofit:=0 吧,与开仓价没关系啊
不管开仓价的盈亏,而是根据现价与开盘价的差价
variable:n=0;
if h>n then n:=h;
if h-o>100+n and h-o<= (100+n)/2 then sell();
这里的O定义成开盘O还是当前K线O,根据自己的需求来
variable:n=0;
if h>n then n:=h;
if h-o>100+n and h-o<= (100+n)/2 then sell();
这里的O定义成开盘O还是当前K线O,根据自己的需求来
没看明白。。。N是要自动识别的,由当日开盘价上行大于100点后,以上行100点的位置为低点,上行100点后的高点为高点,这段距离回落一半止盈
M是最高价,m-o>100+n表示最高价到达过上行100+n,而H-O<(100+N)/2表示又回落了这一半