大家?guī)兔纯催@段代碼有沒(méi)有未來(lái)函數(shù)? [開(kāi)拓者 TB]
-
咨詢內(nèi)容:
AvgValue1 = AverageFC(Close,FastLength);
AvgValue2 = AverageFC(Close,SlowLength);
Hitoday = High;
Lotoday =Low;
MinPoint = MinMove*PriceScale;
? ? AvgTR = XAverage(TrueRange,ATRLength);
N = AvgTR[1];
? ? TotalEquity = Portfolio_CurrentCapital() + Portfolio_UsedMargin();
? ? TurtleUnits = (TotalEquity*RiskRatio/100) /(N * ContractUnit()*BigPointValue());
? ? TurtleUnits = IntPart(TurtleUnits); // 對(duì)小數(shù)取整
Buy_signal = AvgValue1[1]??> AvgValue2[1]? ?&& Lotoday>AvgValue1[1] ;
Sell_signal = AvgValue1[1] < AvgValue2[1]??&& Hitoday<AvgValue1[1];
??
If(MarketPosition ==0 && TurtleUnits>=1 && (TotalTrades()==0||(TotalTrades()>0 && BarsSinceExit>0)) )
{??If (Buy_signal )
? ? {
? ?? ?? ?? ?? ???
? ? ? ? ? ? ? ???Buy(TurtleUnits,Open);
? ?
? ? }Else
? ? If(Sell_signal)
? ? {
? ? ? ? ? ? ? ? SellShort(TurtleUnits,OPEN);;
? ?
? ? }
}Else
? ?
If(MarketPosition == 1) // 有多倉(cāng)的情況
{? ?
? ?? ? If(Sell_signal && TurtleUnits>=1) //如果有空信號(hào),平掉多單并開(kāi)空
? ?? ? {
? ?? ?? ?SellShort(TurtleUnits,OPEN);
? ?? ?? ?
? ?? ? }Else
? ?? ? {
? ?? ?? ?If( ((CurrentEntries()>=2 && Hitoday < LastEntryPrice()-N ) ||(CurrentEntries()>=3 && Lotoday-LastEntryPrice()>TP*N) ) && MarketPosition == 1)
? ?? ?? ?{
? ?? ?? ?? ?Sell(0,OPEN);
? ?
? ?? ?? ? }Else
? ? ? ?? ?? ? {
? ?? ?? ?? ?? ?? ?? ?
? ?? ?? ?? ?If ( Hitoday <= LastEntryPrice() - 2* N && SendOrderThisBar == false && MarketPosition == 1) Sell(0,OPEN);// 止損指令
? ?? ?
? ? ? ?? ?? ?? ?If( CurrentEntries()<=4 && TurtleUnits >= 1??&& Buy_signal? ?&& MarketPosition == 1)
? ? ? ? ? ? ? ?? ? {
? ?? ?? ?? ?? ? If(Lotoday >= LastEntryPrice() + 0.5*N)? ? // 如果開(kāi)盤就超過(guò)設(shè)定的1/2N,則直接用開(kāi)盤價(jià)增倉(cāng)。
? ?? ?? ?? ?? ? {
? ?? ?? ?? ?? ?? ?
? ?? ?? ?? ?? ?? ? Buy(TurtleUnits,OPEN);? ?
? ?? ???
? ?? ?? ?? ?? ? }
? ?? ?? ?? ?}? ?
? ? ? ? ? ? ? ?? ?}??
? ?? ???}? ? ? ? ? ? ? ?? ?
? ?? ?? ???
??}???
- TB技術(shù)人員: 有未來(lái)。你預(yù)先知道了High
有思路,想編寫各種指標(biāo)公式,程序化交易模型,選股公式,預(yù)警公式的朋友
可聯(lián)系技術(shù)人員 QQ: 511411198 進(jìn)行 有償 編寫!(不貴!點(diǎn)擊查看價(jià)格!)
相關(guān)文章
-
沒(méi)有相關(guān)內(nèi)容