被 語法 即將擊斃離場 誰來救

  •   104 
  • 最後發表   XQYi  2024 二月 02
XQYi 發文於   2023/12/19

如下程式碼,為何 B、S在指標的價格都一樣?

var: intrabarpersist _priceB(0) ,intrabarpersist _priceS(0);

if condition92 then begin

_priceB =GetField("Close","tick");

plot92(_priceB,"92");

value92=_priceB;

end;

if condition93  then begin

 _priceS = GetField("Close","tick");

plot93( _priceS ,"93");

value93=_priceS;

end;

 

B腳本如下程式碼,為何 B、S在指標的說不出的怪?

input:length(30,"期數");

variable:up1(0),down1(0),mid1(0),bbandwidth(0);

variable:dayprofit(0),accprofit(0);

up1 = bollingerband(Close[1], Length, 2);

down1 = bollingerband(Close[1], Length, -2 );

 

var: intrabarpersist _priceB(0) ,intrabarpersist _priceS(0);

 

if  open < down1*1.01 then begin 

if _priceB=0 then  _priceB=close

else if _priceB<>0 and open < down1*1.01 then 

_priceB =close;

value1=_priceB; 

 plot1(value1,"B");

end;

  

if  open*1.01 > up1 then begin

if _priceS=0 then _priceS =close

else if _priceS<>0 and  open*1.01 > up1 then 

_priceS =close;

value2=_priceS; 

 plot2(value2,"S");

end;

 

 

附加文件

XQ小幫手 發文於   2024/02/02

Hello, xqyi.

第一個腳本condition92``condition93預設都是0,所以不會印出任何東西。

第二個腳本小幫手不知道您所表示的怪是指什麼意思,若您能簡單說明一下腳本想要呈獻的目的,小幫手也許可以幫您調整,

input:length(30,"期數");
variable:up1(0),down1(0),mid1(0),bbandwidth(0);
variable:dayprofit(0),accprofit(0);
up1 = bollingerband(Close[1], Length, 2);
down1 = bollingerband(Close[1], Length, -2 );

var: intrabarpersist _priceB(0) ,intrabarpersist _priceS(0);

if  
    open < down1 * 1.01 
then begin 
    if 
        _priceB = 0 
    then  
        _priceB = close
    else if 
        _priceB <> 0 
        and open < down1 * 1.01 
    then 
        _priceB = close;

    value1 = _priceB; 
    plot1(value1,"B");
end;

if 
    open * 1.01 > up1 
then begin
    if 
        _priceS = 0 
    then 
        _priceS = close
    else if 
        _priceS <> 0 
        and open * 1.01 > up1 
    then 
        _priceS = close;

    value2 =_priceS; 
    plot2(value2,"S");
end;

 

謝謝。

發表回覆
Close