XQ團隊您好:
我想要寫一個策略是「K值過去十天有3天或3天以上小於20」在這個時候進場,程式碼如下:
input: Length(9) ;
input
ay(10);
input:ratio(0.3);
setinputname(1,"KD期數");
settotalbar(300);
setbarback(50);
variable:rsv1(0),k1(0),d1(0),Kprice(0);//KD
stochastic(length,3,3,rsv1,k1,d1);
value1= k1-20;
variable:count(0);
variable:xi(0);
for xi= 1 to day
begin
//============================================
switch(value1[xi])
begin
case < 0:
count=count+1;
case >0:
count=count;
case 0:
count=count;
end;
//============================================
end;
if day<>0 and count/day>=ratio
then ret=1;
但無法正確的進場,想請問正確的寫法,謝謝。
3 評論