移動式停利

  •   469 
  • 最後發表   小梯子  2024 十二月 17
小梯子 發文於   2024/12/15

移動式停利 : 紅K站上20ma買進後,創新高後回檔20% 停利

指標腳本

input:ratio(20);

 

condition1=false;

 

if close > open and close cross over average(c,20) 

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 cross under value1 then plot1(close,"移動式停利");

我把XQ範本改寫成指標腳本,跑不出來,請問要如何修改 ?

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

(1)value1與value3都是K棒相對距離,拿來判斷黃金交叉及死亡交叉不合適。

(2)你看看以下的停損出場指標是否符合你的需求:

input:ratio(20,"停損趴數");
var: hasPlot(false);
if close > open and close cross over average(c,20) then
    begin
        condition1=true;
        hasPlot=false;
    end
else condition1=false;
value1=barslast(condition1=true);
value2=highest(high,value1);
if close*(1+ratio/100)<value2
    then condition2=true
else condition2=false;
if condition2=true and hasPlot=false then 
    begin
        plot1(c,"停損價位");
        hasPlot=true;
    end;

小梯子 發文於   2024/12/17

虎科大許教授 : 感謝您的回覆,我來試試 .

小梯子 發文於   2024/12/17

虎科大許教授 : 是的, 停損出場指標是符合我的需求.

請問這停損出場指標在技術分析圖上,要如何寫成移動停損線 ?

小梯子 發文於   2024/12/17

虎科大許教授 : 我想表達的是當股價創新高後回檔20%停利, 要如何再技術線圖上畫出移動停利線 ?

 

 

 

小梯子 發文於   2024/12/17

虎科大許教授 : 更正 :當股價從高點(不一定創新高)回檔20%停利, 要如何再技術線圖上畫出移動停利線 ?

虎科大許教授 發文於   2024/12/17

input:ratio(20,"停損趴數");
var: hasPlot(false);
if close > open and close cross over average(c,20) then
    begin
        condition1=true;
        hasPlot=false;
    end
else condition1=false;
value1=barslast(condition1=true);
value2=highest(high,value1);
if close*(1+ratio/100)<value2
    then condition2=true
else condition2=false;
if condition2=true and hasPlot=false then 
    begin
        plotLine(1,currentBar,c,currentBar,c,"停損價位");
        hasPlot=true;
    end;

發表回覆
Close