Alex, 我的意思是查從上周到之前104周之內有上漲超過68周的搜尋程式,可以幫我寫出來嗎? [MC]
-
MC用戶求助:
inputs:? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?
PeriodsAgo( numericsimple ), maxindex(numericsimple);
variables:
var0( 0 ), flag(-1), varopen(0);
arrays: arr0[](0) ;
array_setmaxindex(arr0,maxindex);
condition1 = (DayOfWeek( Date )=5 and time[1]<=1500 and time>1500) or (datetojulian(date)-datetojulian(date[1]))>=3 ;
{condition1這個條件,請參考帖子https://forum.multicharts.cn/forum/cat/0/thread/497}
if condition1 then begin
varopen=open;
flag=flag+1;
end;
if flag>=0 then begin
if close>varopen then
arr0[mod(flag,maxindex+1)]=1
else
arr0[mod(flag,maxindex+1)]=0;
if periodsago<=mod(flag,maxindex+1) then
_calvinsvaco=array_sum(arr0,mod(flag-periodsago,maxindex+1),mod(flag-1,maxindex+1))
else if periodsago>mod(flag,maxindex+1) and flag>=1 then
_calvinsvaco=array_sum(arr0,maxindex-(periodsago-mod(flag,maxindex+1)),maxindex)+array_sum(arr0,0,mod(flag-1,maxindex+1));
end;
這個函數返回的是過去PeriodsAgo個星期中上漲周K線的個數(可以用于“周”周期、“日”周期,以小于“日”周期的圖表周期)
//測試信號
input: length(150);
value1=_calvinsvaco(104,length);
{調用上面的函數,返回104個周期中上漲周K線的個數;這里另外設置一個參數length,這個參數來自于初始參數(不可以動態更改),為的是使該函數_calvinsvaco的第一個參數可以動態變化,但是第一個參數必須小于第二個參數}
if value1>68 then
print(true);
?
-
MC回復討論一:
這個已經幫您寫出來的,函數_calvinsvaco(104,length)的返回結果是過去104周中上漲周K線的數量,然后將這個返回結果與68進行比較,就可以輸出一個true或者false的結果;如果這不是您的需求,那么您希望的輸出結果是?請詳細敘述一下
有思路,想編寫各種指標公式,程序化交易模型,選股公式,預警公式的朋友
可聯系技術人員 QQ: 511411198 進行 有償 編寫!(不貴!點擊查看價格!)
相關文章
-
沒有相關內容