請教Plot顯示的問題

  •   367 
  • 最後發表   鄭揪  2024 十月 23
鄭揪 發文於   2024/10/22

請教教授、小編以及各位高手

以下是我的程式碼,主要問題是在圖示中數字1表示進單,這有顯示,但對於停損和獲利的plot卻無法顯示,想請教我是哪裡出了問題?請各位解惑,感恩感恩

 

if barfreq <> "Min" or Barinterval <>1 then RaiseRuntimeError("請設定頻率為1分鐘");

 

var:KN(0), count(0), MKP(0), SCost(0), SOut(0), SBuy(0);

var:_PercentageChange(0), _BY(0);

variable:_totalv(0);  //要計算的累計值

var: IntrabarPersist entry_time(0);  // 只觸發一次,進場條件 =0,出場條件 =1

 

_PercentageChange = ((close - GetField("參考價", "D")) / GetField("參考價", "D")) * 100;  // 取得當前漲幅,轉換為百分比

_BY = CountIf(close > close[1] and volume < volume[1], 3);  //計算5期內價量背離的次數

 

//累計每分鐘成交量

if date <> date[1] then // 當不同天期時的第一根要怎麼計算

 _totalv = volume

else    //非當天第一根的累計規則

 _totalv = _totalv[1] + volume;

 

plot91(_totalv,"累積量");

 

// 畫出開盤最大值

if date <> date[1] then begin

KN = 1;

value111 = 0; value222 = 0;

value111 = (C * V); value222 = V;

end else begin

KN = KN+1;

value111 = value111 + (Close * volume) ; value222   = value222 + Volume;

value333 = iff(value222 > 0 , value111 / value222 , Close);

end;

 

 

//=============  條件區  =============

 

condition11 = _PercentageChange > 3;             //開盤後的漲幅大於3%

//condition12 = GetField("成交量", "D") > GetField("成交量", "D")[1] * 0.2;   //自開盤累積的成交量大於昨量的20%

condition13 = _totalv > GetField("成交量", "D")[1] * 0.15;  //累計成交量要達到昨量的20%

 

condition1 = trueall(close > close[1],3);        //連三根K棒都是紅棒

condition2 = volume>average(volume[1],3)*2;      //成交量是過去三根量平均量的兩倍以上

condition3 = close = Highest(High,5);            //收最高

condition4 = Close > Value333;                   //股價大於當沖均價

condition5 = Close > GetField("收盤價", "D")[1]; //股價大於昨收價

condition6 = volume > averageif(Close > Close[1],highest(volume,1),3); //成交量是3個量中最大量

 

 

 

//濾網

condition21 = (getField("收盤價", "1") - getField("參考價", "D")) / getfield("收盤價", "1")[1] < 0.06;  // (今開 - 昨收) / 昨收 小於 6%,符合此條件後才可進場。

 

//=============  交易邏輯  =============

//進場1

if Time > 090300 and Time < 094500 and condition11 and condition13 then begin

if condition1 and condition6 and condition21 then begin

MKP = -1;

SCost = Close;

plot1(Close,"JC-1");

end;

end;

 

// 進場2

if Time > 091500 and condition1 and condition3 and condition4 and condition5 and condition21 then begin

MKP = -1;

SCost = Close;

plot2(Close,"JC-2");

end;

 

 

//停損

if MKP = -1 and Time < 131000 then begin

MKP = 0;

Sout = Close;

Sout = SCost * 1.015;

plot3(SOut,"停損線");

end;

 

//獲利

if MKP = -1 and Time < 131000 then begin

MKP = 0;

SBuy = Close;

SBuy = SCost * 0.983;

plot4(SBuy,"獲利點");

end;

 

附加文件

排序方式: 標準 | 最新
虎科大許教授 發文於   2024/10/22
鄭揪 發文於   2024/10/23

感謝教授,我解決了!!感恩感恩

發表回覆
Close