V4中追蹤止盈代碼怎么寫? - TradeBlazer公式
作者:開拓者 TB 來源:cxh99.com 發布時間:2012年09月15日
- 咨詢內容:
- Params
- Numeric lots(1);
- Vars
- NumericSeries ma5;
- NumericSeries ma20;
- NumericSeries stopprofit;
- NumericSeries EntryPrice;
- NumericSeries ExitPrice;
- NumericSeries PriceAfterEntry;
- Begin
- ma5=Average(close,5);
- ma20=Average(close,20);
- PlotNumeric("ma5",ma5);
- PlotNumeric("ma20",ma20);
- If(CrossOver(ma5[1],ma20[1]))//Ma5上穿Ma20
- Buy(lots,open);
- Entryprice=open;
- If(marketposition==1&&PositionProfit>5)//盈利大于五點時追蹤止盈
- {stopprofit=EntryPrice+2;//止盈點在進場點上方2點
- ExitPrice=Max(open,stopprofit);
- }
- Sell(lots,ExitPrice);
- End
- TB技術人員: 請參考 幫助文檔 - 公式應用進階
- TB客服: 如果用A指令下單又怎么寫呢?