写了个止损系统,为何出现这种问题? - TradeBlazer公式 [开拓者 TB]
- 咨询内容:
- Params
- Numeric Length1(10);
- Numeric Length2(60);
- Vars
- NumericSeries ma1;
- NumericSeries ma2;
- Numeric MinPoint;
- Numeric MyEntryPrice;
- Numeric StopLossSet(100);
- Numeric MyExitPrice;
- Begin
- MinPoint=MinMove*PriceScale;
- MyEntryPrice = AvgEntryPrice;
- ma1=Average(c,Length1);
- ma2=Average(c,Length2);
- if(marketposition!=1)
- {
- If(crossover(ma1[1],ma2[1]))
- buy(1,o);
- }
- if(marketposition!=-1)
- {
- If(crossunder(ma1[1],ma2[1]))
- sellshort(1,o);
- }
- If(MarketPosition==1)
- {
- if(Low <= MyEntryPrice - StopLossSet*MinPoint)
- {
- MyExitPrice = MyEntryPrice - StopLossSet*MinPoint;
- if(Open < MyExitPrice) MyExitPrice = Open;
- Sell(0,MyExitPrice);
- }
- }
- if(MarketPosition==-1)
- {
- If(High >= MyEntryPrice + StopLossSet*MinPoint)
- {
- MyExitPrice = MyEntryPrice + StopLossSet*MinPoint;
- If(Open > MyExitPrice) MyExitPrice = Open;
- BuyToCover(0,MyExitPrice);
- }
- }
- end
- Params
- TB技术人员:
问题已经解决,只需将MyEntryPrice换成AvgEntryPrice即可
If(MarketPosition==1)
{
if(Low <= MyEntryPrice - StopLossSet*MinPoint)
{
MyExitPrice = MyEntryPrice - StopLossSet*MinPoint;
if(Open < MyExitPrice) MyExitPrice = Open;
Sell(0,MyExitPrice);
}
}
如果以上指标公式不适用于您常用的行情软件
或者您想改编成选股公式,以便快速选出某种形态个股的话,
- 上一篇:捡到一个金蛋
- 下一篇:程序设计中如何实现延时下单? - TradeBl…
相关文章
-
没有相关内容