全部 智大领峰 TBQuant功能 TBL语言 TB开户 问答专区 高手圈 其他
已解决
请教老师CLOSE为什么回溯一根图上没有信号?
2024-08-05 10:54

简单的四周策略,改成收盘价模型,不回溯一根K的话是正常的,回溯一根K就没有信号,请问老师什么原因?

Param

Numeric length(5);

Vars

   Series<Numeric> upband;

   Series<Numeric> dnband;

   Series<Bool> bool_up;  

   Series<Bool> bool_dn;

   

Events

    OnInit()

{

Range[0:DataCount-1]

{

AddDataFlag(Enum_Data_RolloverBackWard()); //设置后复权

AddDataFlag(Enum_Data_RolloverRealPrice()); //设置映射真实价格

               AddDataFlag(Enum_Data_AutoSwapPosition()); //设置自动换仓

      AddDataFlag(Enum_Data_IgnoreSwapSignalCalc()); //设置忽略换仓信号计算

}

}

  OnBar(ArrayRef<Integer> indexs)

   {

    upband = Highest(high[1],length);

       dnband = Lowest(Low[1],length);    

PlotNumeric(\"upband\",upband);

PlotNumeric(\"dnband\",dnband);

   

bool_up = CrossOver(Close[1],upband) ;

bool_dn = CrossUnder(Close[1],dnband);

If(MarketPosition<>1 and bool_up )

       {

           Buy(1,O);

       }

If(MarketPosition<>-1 and bool_dn )

       {

           SellShort(1,O);

       }

   }


kyover

你可以在图上自己找一找

你用的是上一根bar的收盘价要比当前bar的上轨要高

图上找得到这种案例吗?

2024-08-05 11:24
您未登录,请先 登录注册 后发表评论
顶部