我在作寶塔紅翻綠的計算時,設定settotalbar(80)來作小幫手之前提供的寶塔定義計算。
但發現有的股票無法用取得80天,只能取得五天,但從K線圖 上來看又有超過80天的交易資料,請問是什麼原因呢?
我這裡同一批跑出結果的
有問題的例如2070, 精湛
沒問題的如:3176, 基亞
此為修改此篇大大的寫法
https://forum.xq.com.tw/thread/%E5%A6%82%E4%BD%95%E8%87%AA%E8%A1%8C%E6%92%B0%E5%AF%AB%E5%AF%B6%E5%A1%94%E7%B7%9A%E6%8C%87%E6%A8%99/?order=all#comment-e887ee40-d82f-4086-81f8-a8d6006d60e2
程式碼如下:
input:TWR(3);
variable:HH(0),LL(0),Color("");
settotalbar(80);
HH = highest(close,TWR+1)[1];
LL = lowest(close,TWR+1)[1];
if close > HH then
begin
value1 = 1;
end
else if close < LL then
begin
value1 = -1;
end;
if value1[1]=-1 and value1 = 1
then begin
Color = "翻紅";
end
else if value1[1]=1 and value1 = 1
then begin
Color = "續紅";
end
else if value1[1]=1 and value1 = -1
then begin
Color = "翻黑";
end
else if value1[1]=-1 and value1 = -1
then begin
Color = "續黑";
end;
print("close: " , close);
print("HH: " , HH);
print("LL: " , LL);
print("Color: " , Color);
print("Color[1]: " , Color[1]);
print(" ");
if Color = "翻黑" and (Color[1] = "翻紅" or Color[1] = "續紅") then ret = 1;

2 評論