請問今日盤中股價若有上5日均線就畫一條水平線並這一條水平線只延續到下3根K棒為止,
若之後盤中股價又上5日均線,就重新再畫一條水平線並只延續到下3根K棒為止,請問要怎麼寫.
程式如下
value1 = average(close,5);
If close cross over value1 then plotLine(1,currentBar,c,currentBar,c,"上5日均");
請指教.
請問今日盤中股價若有上5日均線就畫一條水平線並這一條水平線只延續到下3根K棒為止,
若之後盤中股價又上5日均線,就重新再畫一條水平線並只延續到下3根K棒為止,請問要怎麼寫.
程式如下
value1 = average(close,5);
If close cross over value1 then plotLine(1,currentBar,c,currentBar,c,"上5日均");
請指教.
感謝虎科大許教授,我來試試.
Hello 小梯子,
小編補充,如果您只希望該橫線在條件符合後向後延伸3根K棒的話,可以加上條件:
value1=barsLast(c cross over average(close,5));
value2=c[value1];
if value1 <= 3 then plotline(1,currentBar-value1,value2,currentBar,value2,"上5日均",add:=1);
3 評論