請問如何記錄當天開盤後第一根5分K到第六根分K的收盤價

  •   140 
  • 最後發表   fancky  2022 二月 21
fancky 發文於   2022/02/15

請問如何記錄當天開盤後第一根5分K到第六根分K的收盤價?

排序方式: 標準 | 最新
XQ小幫手 發文於   2022/02/16

Hello fancky,

 

您可以使用 array 來記錄第一根到第六根Bar的價格。

舉例來說:

array: record[6](0);

 

if getfielddate("Date") <> getfielddate("Date")[1] then value1 = 0;

value1 += 1;

 

if record <= 6 then begin

    record[value1] = close;

    end;

這樣record的1到6儲存格就會記錄著當日開盤後6根Bar的收盤價。

fancky 發文於   2022/02/17

編輯出現這行錯誤ㄟ

測試1-1-1ExitCode: 1

StdOut: 

 

StdErr: System\XSSystem\Tmp\45682f8a69f741f3bf66142b798d4277.cpp: In member function 'virtual void DJScript::Indicator::C54235cceab1e4b90bc52250a13413bbb::OnEvalBar()':

System\XSSystem\Tmp\45682f8a69f741f3bf66142b798d4277.cpp:113:24: error: no matching function for call to 'DJScript::Indicator::C54235cceab1e4b90bc52250a13413bbb::LessEq(SysJust::XS::NumericArraySimpleVar&, int)'

   if (LessEq(_record, 6))

                        ^

System\XSSystem\Tmp\45682f8a69f741f3bf66142b798d4277.cpp:113:24: note: candidates are:

In file included from Inc\stdafx.h:42:0:

Inc\ScriptBase.h:271:18: note: bool SysJust::XS::ScriptBase::LessEq(double, double)

Inc\ScriptBase.h:271:18: note:   no known conversion for argument 1 from 'SysJust::XS::NumericArraySimpleVar' to 'double'

Inc\ScriptBase.h:289:18: note: bool SysJust::XS::ScriptBase::LessEq(const string&, const string&)

Inc\ScriptBase.h:289:18: note:   no known conversion for argument 1 from 'SysJust::XS::NumericArraySimpleVar' to 'const string& {aka const std::basic_string<char>&}'

 

 

 

XQ小幫手 發文於   2022/02/21

 Hello fancky,

 

不好意思小幫手打太快有誤。

if record <= 6 then begin

    record[value1] = close;

    end;

應該修改為

if value1 <= 6 then begin

    record[value1] = close;

    end;

才對。

附加文件

發表回覆
Close