|
发表于 2011-4-14 13:12:00
|
显示全部楼层
不明你第2條想問的問題?
是否類似以下問題:
只要第一個信號,該如何寫
http://www.bp-system.com/discuz/viewthread.php?tid=3636&page=1#pid25835
比較買入 及沽出的訊號出現於前面第幾次 Bar
將兩 bar 相比較便可以只得出一個訊號,
亦即規定了, 只要出了一次買入, 就要等另一次沽出訊號後才能再出現買入訊號 !!
利用 Bars Since
SYNTAX barssince( DATA ARRAY )
FUNCTION Calculates the number of bars (time periods) that have passed since DATA ARRAY was true.
Important: When using the barssince() function in an exploration, you must choose the "Load ___ Records" button in the Explorer Options dialog (see Explorer Options) and specify a value equal to the number of bars loaded in your chart; otherwise, the exploration results may not be accurate.
EXAMPLE barssince( macd() < 0 )
e.g:
buysignal := Cross(C, mov(C,10,S);
Sellsignal := Cross( mov(C,20,S), mov(C,10,S));
BuyBar:=barsince(buysignal); {上次買入訊號與現在距離幾多支燭}
SellBar:=barsince(Sellsignal); {上次沽出訊號與現在距離幾多支燭}
SellBar > BuyBar and Sellsignal; {即沽出訊號燭要大於買入訊號燭, 最近出現的便是買入訊號燭, 而下次要出現的只能是 沽出訊號 }
BuyBar > SellBar and Buysignal; {即買入訊號燭要大於沽出訊號燭, 最近出現的便是沽出訊號燭, 而下次要出現的只能是 買入訊號 }
|
|