全部 智大领峰 TBQuant功能 TBL语言 TB开户 问答专区 高手圈 其他
挂单交易
2024-08-06 15:51

例如:满足5日线上传10日线后,当前K线的开盘价格下方10个点买多,如何实现

wangkaiming

if(满足){

buy(1,open-10);}

根据字面意思翻译

另外补充一下,要实现挂单不能开下单偏移

2024-08-07 08:59
zouyan123456

Params

Numeric length1(1);// 短期指数平均线参数

Numeric length2(5);// 长期指数平均线参数

Numeric length3(1.002);// 小上涨涨幅

Numeric length4(1.006);// 大上涨涨幅

Numeric length5(1.0025);// 破位涨幅

Numeric length7(2500);// 区间高位

Numeric length6(2000);// 区间低位

Numeric length8(35);// 止损点位

Numeric length9(100);// 止盈点位

Numeric length10(1);// 手数

Numeric length11(5);// 回调点位

Vars

series<Numeric> ma1;

series<Numeric> ma2;

series<Numeric> my_entryprice;


series<Bool> bool_crossover;

series<Bool> bool_crossunder;

Events

OnBar(ArrayRef<Integer> indexs)

{

   ma1 = Average(close, length1);

   ma2 = Average(close,length2);

   //PlotNumeric(\"ma1\",ma1);

   PlotNumeric(\"ma2\",ma2);

//金叉

   // bool_crossover = ma1[1] <= ma2[1] and ma1 > ma2;

   // bool_crossunder = ma1[1] >= ma2[1] and ma1 < ma2;

   

      bool_crossover = close[1] > ma2[1]  and ma2[1] >Low[1] and close[2] < ma2[2] and  (close[1]/close[2]) > length3 and   (close[1]/close[2]) < length4 and length7 > low[2] and low[2] >length6 ;//and (low[2] >length6 and length7 > low[2])

     

     bool_crossunder = close[1] < ma2[1] and close[2] > ma2[2]  and (close[2]/close[1]) > length5;

If(bool_crossover)

{

    Buy(length10,open-length11);

    my_entryprice=open-length11;

}

if(MarketPosition>0 and low< my_entryprice-length8)//止损条件满足亏1oa0,EntryPrice,my_entryprice-low>1g

{

sell(0,min(o,my_entryprice -length8));





}

else if(MarketPosition>0 and high>my_entryprice+length9)//止损条件满足亏loa8,EntryPrice,my_entryprice-low>

{

sell(0,max(o,my_entryprice +length9));

}

If(bool_crossunder)

{

   Sell(length10,open[1]);

}

}

我也是这样,为何不执行,还是现价执行

2024-08-07 10:59
您未登录,请先 登录注册 后发表评论
顶部