创意电子

标题: RENKO 砖形图 通达信源码 [打印本页]

作者: 宇峻1976    时间: 2021-8-28 22:07
标题: RENKO 砖形图 通达信源码

                               
登录/注册后可看大图

通达信指标:
BOXV:=ATR.ATR(14);
RA:=TDXDLL1(1,O,C,BOXV);
RB:TDXDLL1(2,O,C,BOXV);
R1:IF(RARB,RA,DRAWNULL),COLORBLUE,LINETHICK3;


DLL 源码:
procedure TestPlugin1(DataLen: Integer; pfOUT: ArraySingle; pfINa: ArraySingle;
pfINb: ArraySingle; pfINc: ArraySingle); cdecl;
var
i, n: Integer;
prev, refprev, boxv: double;
up, dn: boolean;
begin
up := false;
dn := false;
prev := pfINa[0];
i := 0;
repeat
boxv := pfINc;
refprev := prev;
if (not dn) and (pfINb > prev) then
begin
up := true;
n := trunc((pfINb - prev) / boxv);
prev := prev + boxv * n;
end;
if dn and (pfINb > prev) then
begin
n := trunc((pfINb - prev) / boxv);
if n > 1 then
begin
up := true;
dn := false;
prev := prev + boxv * n;
end
else
prev := prev;
end;
if (not up) and (pfINb < prev) then
begin
dn := true;
n := trunc((prev - pfINb) / boxv);
prev := prev - boxv * n;
end;
if up and (pfINb < prev) then
begin
n := trunc((prev - pfINb) / boxv);
if n > 1 then
begin
dn := true;
up := false;
prev := prev - boxv * n;
end
else
prev := prev;
end;
if prev < refprev then
pfOUT := prev + pfINc
else if prev > refprev then
pfOUT := prev - pfINc
else
pfOUT := pfOUT[i - 1];
i := i + 1;
until i = DataLen;
end;

                               
登录/注册后可看大图


                               
登录/注册后可看大图





欢迎光临 创意电子 (https://wxcydz.cc/) Powered by Discuz! X3.4