請教移動停利

  •   685 
  • 最後發表   志杰  2019 六月 27
志杰 發文於   2019/06/23

移動停利

我修改為做空移動停損改為指標顯示,但以下三行這樣修改顯示不出來ㄝ,請指導是否哪邊有誤,感謝 !

value2=lowest(low,value1);

if close*(1-ratio/100)>value2

if value11 crosses over value9 then plot1(1) ;

排序方式: 標準 | 最新
XQ小幫手 發文於   2019/06/25

 Hi 志杰,

您好,請您提供完整的程式碼,以利小幫手查看問題的原因,謝謝。

P.S. 或者將繪圖樣式的「線圖」改為「柱狀圖」加入副圖試試看。

志杰 發文於   2019/06/25

if close > highest(high[1],4) then plot1(1) ;
input:ratio(0.2);
condition1 = false;
if close > highest(high[1],4) then condition1 = true;
value1=barslast(condition1);
value2=highest(high,value1);
if close*(1+ratio/100)<value2 then condition2=true else condition2=false;
value3=barslast(condition2);
if value3 crosses under value1 then plot2(1) ;

在主圖使用指標,以點顯示,上面 plot1與plot2都可以,但下面 plot2 不知哪邊錯誤,無法顯示

if close < lowest(low[1],4) then plot1(1) ;
input:ratio(0.2);
condition1 = false;
if close < lowest(low[1],4) then condition1 = true;
value1=barslast(condition1);
value2=lowest(low,value1);
if close*(1-ratio/100)>value2 then condition2=true else condition2=false;
value3=barslast(condition2);
if value3 crosses over value1 then plot2(1) ;

XQ小幫手 發文於   2019/06/27

Hi 志杰,

您好,因為第 9 行程式碼 value3 crosses over value1 這行判斷式,不會判斷成功,所以 plot2 不會繪出。

 

可以使用 Print 語法將相關數值 Print 出來查看,例如:

print(date,condition2,value3,value1);

就會發現因為第 9 行程式碼不會判斷成功,所以 plot2 不會繪出,

 

請在查看語法與策略想法是否有落差,以上方向供您參考,謝謝。 

發表回覆
Close