有無函數能滿足這樣的需要? [金字塔]
- 咨詢內容:
多:多條件1-對應止損多止損條件1,多條件2-對應多止損條件2,多條件3-對應多止損條件3 多止盈條件
比如在滿足多條件1(或者2或者3)的情況下,開倉,止盈或者止損
請教如何能記錄下,在開倉到平倉之間是不是滿足過,條件2或者條件3,或者條件23都滿足過 - 金字塔客服:
variable:n=0;
if 開倉條件1 and holding=0 then begin
下單語句;
n:=1;
end
if 開倉條件2 and holding=0 then begin
下單語句;
n:=2;
end
if 開倉條件3 and holding=0 then begin
下單語句;
n:=3;
end
if 平倉語句1 and n=1 then 平倉語句;
if 平倉語句2 and n=2 then 平倉語句;
if 平倉語句3 and n=3 then 平倉語句;
- 用戶回復:
這樣的寫法,如果在第一次開倉之后,持倉量>0,在沒有平倉之前,N的值始終是1,沒機會變成2或者3
- 網友回復:
不會,改變的條件不僅是要開倉條件成立,還要持倉=0
- 網友回復:
variable:n=0;
if 開倉條件1 and holding=0 then begin
下單語句;
n:=1;
end
假定成立,開倉了,持倉量就大于0了
if 開倉條件2 and holding=0 then begin
下單語句;
n:=2;
end
但因為持倉量大于0,不滿足HOLDING=0,所以不會有開倉動作,即不滿足IF的判斷,那N如何得到賦值2?
if 開倉條件3 and holding=0 then begin
下單語句;
n:=3;
end
if 平倉語句1 and n=1 then 平倉語句;
if 平倉語句2 and n=2 then 平倉語句;
if 平倉語句3 and n=3 then 平倉語句;
有思路,想編寫各種指標公式,程序化交易模型,選股公式,預警公式的朋友
可聯系技術人員 QQ: 1145508240 進行 有償 編寫!(不貴!點擊查看價格!)
相關文章
-
沒有相關內容