期貨期權(quán)交流自己編的mro公式
作者:MC 來源:cxh99.com 發(fā)布時(shí)間:2016年06月25日
- 咨詢內(nèi)容:
感覺我這個(gè)邏輯更簡短和易理解
Input:condition(TrueFalseSeries),period(NumericSimple),times(NumericSimple);
var:record(0);
record=0;
if (times<=period and times>0) then // times就是自己要求的向左邊數(shù)起第幾次條件成立
begin
for value1=0 to (period-1)
begin
if condition[value1] then
begin
value2=value1;//循環(huán)中,每次滿足條件 ,將回溯點(diǎn)存儲(chǔ)起來
record=record+1;//循環(huán)中,每次滿足條件,都加1記錄起來
if record=times then
break; //一旦記錄的次數(shù)達(dá)到參數(shù)指定的times ,中斷循環(huán)
end;
end;
end;
if (record < 1 or record<times) then
mymrotimes=-1 //一旦記錄的次數(shù)小于1 (即一次條件都沒有滿足) 或者小于指定的times時(shí) ,函數(shù)mymrotimes=-1,因?yàn)闆]有 達(dá)到我們想要的要求
else
mymrotimes=value2;
已經(jīng)核對(duì)過 和mro功能一樣 其實(shí)我發(fā)現(xiàn)
-
QQ截圖20150722142637.png
(10.04 KB, 下載次數(shù): 2)
2015-7-22 14:27 上傳
點(diǎn)擊文件名下載附件
- MC技術(shù)部:
感謝分享啊~~