指標or交易程式裡,當日當條件成立第一次時畫出該指標,第二次以後就不需要再畫出指標

  •   108 
  • 最後發表   eng12345h  2024 六月 04
eng12345h 發文於   2024/05/30

 

如下程式可否指導該如何修改??

 

只要在當日第一根K棒(5分K)發生時出現指標就好,後面的K棒即使條件成立也不要畫出。

 

if condition11 and close > value1 then begin

 

plot5(1) ;

排序方式: 標準 | 最新
虎科大許教授 發文於   2024/05/30

if date<>date[1] then

   if condition11 and close > value1 then plot5(1) ;

XS小編 發文於   2024/06/04

Hello eng12345h,

 

您可以用變數紀錄條件達成的次數,如果超過限定的次數就不要畫出。

舉例來說,在分鐘頻率的狀況下:

var: count(0);

condition1 = ...您的條件...;

 

if issessionfirstbar then count = 0;

 

if condition1 then begin

    count += 1;

    if count < 2 then plot5(1) else noplot(5);

    end;

 

感謝 虎科大許教授 的熱心回覆。

發表回覆
Close