减仓写法
思路 如果在纯碱2900一次性开仓40手,按照一定间隔减仓 直到全平完需要怎么修改间隔为 IntPart(15*1.3^(i-1)),i1 =1 即间隔为【15 ,20,25,33,43,56,以此类推】,手数为 IntPart(1*1.3^(i-1)),i1 =1 即间隔为【1,1,2,2,3,4,5,6,8,11以此类推】即第一次平仓价格为【2900-15】 平1手第二次为【2900-15-20】 平1手第三次为【2900-15-20-25】 平2手第四次为【2900-15-20-25-33】平2手第五次为【2900-15-20-25-33-43】平3手----------------------------------------------------------If(MarketPosition == 0 && FirstEntryCon) //开仓 { FirstPrice = Open; LastPrice = FirstPrice; SellShort(Lots,FirstPrice); } If(MarketPosition == -1 ) { For i =1 To 10 { MinPoint = MinMove*PriceScale; TakeProfitSet = IntPart((firststep * (1-Power(1.3,i)))/(-0.3))*MinPoint; //间隔 TakeProfitTrades = IntPart((firstTrades * (1-Power(1.3,i)))/(-0.3))*MinPoint; //手数 While( CurrentEntries>0 && Low <= FirstPrice - TakeProfitSet ) //平仓 { FirstPrice = FirstPrice - TakeProfitSet; BuyToCover(TakeProfitTrades, max(open,FirstPrice)); }