關于平倉后再次開倉問題 [開拓者 TB]
-
咨詢內容:
雙均線交易系統帶有固定點位止損止盈
有以下幾個問題:
1.比方均線金叉進多,達到止盈目標止盈后形態上仍然是多頭趨勢,如何限制繼續開倉?
2.如果前一次止損,后面再次開倉加一個突破過濾條件?
現在代碼如下:
Params
? ?? ???Numeric length(10);
? ? ? ? ? ? ? ? Numeric length1(20);
? ? ? ? ? ? ? ? Numeric TakeProfitSet(50);
? ?? ???Numeric StopLossSet(30);
? ?? ???Numeric Lots(3);
Vars
? ? ? ? ? ? ? ? NumericSeries AvgValue;
? ?? ???NumericSeries AvgValue1;
? ? ? ? ? ? ? ? Numeric MyEntryPrice;
? ? ? ?? ???Numeric myexitprice;
? ? ? ? ? ? ? ? Numeric Minpoint;
Begin
? ?? ?? ?AvgValue = AverageFC(C,Length);
? ?? ?? ?AvgValue1= AverageFC(C,Length1);
? ?? ???If(MarketPosition <>1 and? ?AvgValue[1]> AvgValue1[1])
? ? ? ? {
? ? ? ???myentryprice=open;
? ? ? ???Buy(LOTS,myentryprice);
? ? ? ???}
? ? ? ???
? ? ? ? If(MarketPosition <>-1? ? and??AvgValue[1]< AvgValue1[1] )
? ? ? ? {
? ? ? ???myentryprice=open;
? ? ? ???SellShort(LOTS,open);
? ? ? ???}? ? ? ?
? ? ? ? /////
? ? ? ? If(MarketPosition==1) // 有多倉的情況
? ? {
? ?? ?? ?if(high>=(myentryprice+TakeProfitSet*MinPoint))
? ? ? ?? ? {
? ? ? ?? ???myexitprice=(myentryprice+TakeProfitSet*MinPoint);
? ? ? ?? ? if(open>myexitprice)myexitprice=open;
? ? ? ?? ? Sell(0,myexitprice);
? ? ? ?? ? }Else if(low<=(myentryprice-StopLossSet*MinPoint))
? ? ? ?? ? {
? ? ? ?? ???myexitprice=(myentryprice-StopLossSet*MinPoint);
? ? ? ? ? ? ? ? if(open<myexitprice)myexitprice=open;
? ? ? ? ? ? ? ? Sell(0,myexitprice);
? ? ? ? ? ? ? ? }
? ? ? ?? ?
? ? ? ???}
? ? ? ?? ?if(MarketPosition==-1) // 有空倉的情況
? ? {
? ?? ???if(low<=(myentryprice-TakeProfitSet*MinPoint))
? ? ? ?? ? {
? ? ? ?? ???myexitprice=(myentryprice-TakeProfitSet*MinPoint);
? ? ? ?? ? if(open<myexitprice)myexitprice=open;
? ? ? ?? ? BuyToCover(0,myexitprice);
? ? ? ?? ? }Else if(High>=(myentryprice+StopLossSet*MinPoint))
? ? ? ?? ? {
? ? ? ?? ???myexitprice=(myentryprice+StopLossSet*MinPoint);
? ? ? ? ? ? ? ? if(open>myexitprice)myexitprice=open;
? ? ? ? ? ? ? ? BuyToCover(0,myexitprice);
? ? ? ? ? ? ? ? }
? ? }
? ? ? ?
? ? ? ???End?
?來源:CXH99.COM
-
TB技術人員:
最好只在金叉、死叉出現時開倉,過了就不做了。對第二點,如果出現止損,要再等到新出現交叉再開倉。
If(MarketPosition <>1 and??AvgValue[2] <= AvgValue1[2] and??AvgValue[1]> AvgValue1[1])
? ? Buy();
If(MarketPosition <>-1 and??AvgValue[2] >= AvgValue1[2] and AvgValue[1]< AvgValue1[1])
? ? SellShort();?
-
TB客服:
Yuen_Lee 發表于 2021-8-3 11:44
最好只在金叉、死叉出現時開倉,過了就不做了。對第二點,如果出現止損,要再等到新出現交叉再開倉。
If(Ma ...
謝謝!?
- 網友回復: http://www.wjs7878.com/
有思路,想編寫各種指標公式,交易模型,選股公式,還原公式的朋友
可聯系技術人員 QQ: 262069696 或微信號:cxh99cxh99 進行 有償收費 編寫!
(注:由于人數限制,QQ或微信請選擇方便的一個聯系我們就行,加好友時請簡單備注下您的需求,否則無法通過。謝謝您!)
相關文章
-
沒有相關內容