等级: 免费版
- 注册:
- 2024-10-23
- 曾用名:
|
楼主 |
发表于 2024-11-25 13:47
|
显示全部楼层
DIFF :=EMA(CLOSE,12) - EMA(CLOSE,26);
DEA :=EMA(DIFF,9);
MACD :2*(DIFF-DEA);
if macd<ref(macd,1) then
begin
sell(1,holding,marketr);
buyshort(holding>-1,2,marketr);
end
if macd>ref(macd,1) then
begin
sellshort(1,holding,marketr);
buy(holding<1,2,marketr);
end
if  high<ref(high,1) then
begin
        sell(1,holding,marketr);
        buyshort(holding>-1,2,marketr);
end
if  high>ref(high,1) then
begin
        sellshort(1,holding,marketr);
        buy(holding<1,2,marketr);
end
老师好!我考虑的是下面这个公式是上面这个策略的补充,就是在没有持仓的情况下,触发委托!但通过上午的运行,在已有多仓的情况下,它又开空了。这个怎么修改呢?
补充内容 (2024-11-25 13:48):
if high<ref(high,1) then
begin
sell(1,holding,marketr);
buyshort(holding>-1,2,marketr);
end
if high>ref(high,1) then
begin
sellshort(1,holding,marketr);
buy(holding<1,2,marketr);
end
|
|