CKU2:=(H>賣壓 or barpos=0)-(L<買支 or barpos=0);
CKU3:=(H>壓力 or barpos=0)-(L<支撐 or barpos=0);
強平:=Time=134500;
買1:=買訊 and 強平=0 or barpos=0;
賣1:=賣訊 and 強平=0 or barpos=0;
買賣:=買1-賣1; CC:=C;
進出:C*0 NOAXIS; 多空:=0;
for i=1 to datacount do begin
if 強平[i] then begin
if 多空<>0 then begin
進出[i]:=SGN(多空)*-4; 多空:=0; 強平價:=CC[i];
end;
end else begin
if 買賣[i]<>0 and 買賣[i]<>SGN(多空) then begin
多空:=買賣[i]; 進出[i]:=多空; 進價:=CC[i];
end else if 多空<>0 then begin
if CKU2[i]=-多空 then begin
進出[i]:=-多空*2; 多空:=CKU2[i]*2;
end else if CKU3[i]*2=-多空 then begin
進出[i]:=CKU3[i]*3; 多空:=0;
end;
end;
end;
end;
CKU2:=(H>賣壓 or barpos=0)-(L<買支 or barpos=0);
CKU3:=(H>壓力 or barpos=0)-(L<支撐 or barpos=0);
強平:=Time=134500;
買1:=買訊 and 強平=0 or barpos=0;
賣1:=賣訊 and 強平=0 or barpos=0;
買賣:=買1-賣1; CC:=C;
進出:C*0 NOAXIS; 多空:=0;
for i=1 to datacount do begin
if 強平[i] then begin
if 多空<>0 then begin
進出[i]:=SGN(多空)*-4; 多空:=0; 強平價:=CC[i];
end;
end else begin
if 買賣[i]<>0 and 買賣[i]<>SGN(多空) then begin
多空:=買賣[i]; 進出[i]:=多空; 進價:=CC[i];
end else if 多空<>0 then begin
if CKU2[i]=-多空 then begin
進出[i]:=-多空*2; 多空:=CKU2[i]*2;
end else if CKU3[i]*2=-多空 then begin
進出[i]:=CKU3[i]*3; 多空:=0;
end;
end;
end;
end;
原碼: DECK:=date<>ref(date,1) or barpos=1;
DESP:=barslast(DECK);
強平:=Time=134500;
買1:=買訊 and 強平=0 or barpos=0;
賣1:=賣訊 and 強平=0 or barpos=0;
控反:=(H>賣壓 or barpos=0)-(L<買支 or barpos=0); //CKU2
控平:=(H>壓力 or barpos=0)-(L<支撐 or barpos=0); //CKU3
買賣:=買1-賣1;
進出:C*0 NOAXIS;
多空:=0; 進價:=0; 出價:=0; CC:=C; HH:=H; LL:=L;
for i=1 to datacount do begin
if DECK[i] then 停損次:=0;
if 強平[i] then begin
if 多空<>0 then begin
進出[i]:=SGN(多空)*-4; 多空:=0;
end;
end else begin
if 買賣[i]<>0 and 買賣[i]<>SGN(多空) and 停損次<2 then begin
多空:=買賣[i]; 進出[i]:=多空;
進價:=CC[i]; MaxHLSP:=0; 出價:=進價-SGN(多空)*20;
end else if 多空<>0 then begin
if 控反[i]=-多空 then begin
進出[i]:=-多空*2; 多空:=控反[i]*2;
進價:=CC[i]; MaxHLSP:=0; 出價:=進價-SGN(多空)*20;
end else if 控平[i]*2=-多空 then begin
進出[i]:=控平[i]*3; 多空:=0;
end else begin
盈虧:=(CC[i]-進價)*SGN(多空);
HL:=HH[i]; if 多空<0 then HL:=LL[i];
HLSP:=(HL-進價)*SGN(多空); //Max盈虧
if HLSP>MaxHLSP then MaxHLSP:=HLSP;
if MaxHLSP>80 then begin
出價:=進價+MaxHLSP*(2/3)*SGN(多空);
end else if MaxHLSP>50 then begin
出價:=進價+MaxHLSP*(1/2)*SGN(多空);
end else if MaxHLSP>20 then begin
出價:=進價+(MaxHLSP-30)*SGN(多空);
end else begin
出價:=進價-20*SGN(多空);
end;
if (CC[i]-出價)<0 then begin
進出[i]:=5*SGN(多空); 多空:=0; if 盈虧<0 then 停損次:=停損次+1;
end;
end;
end;
end;
end;
原碼: DECK:=date<>ref(date,1) or barpos=1;
DESP:=barslast(DECK);
強平:=Time=134500;
買1:=買訊 and 強平=0 or barpos=0;
賣1:=賣訊 and 強平=0 or barpos=0;
控反:=(H>賣壓 or barpos=0)-(L<買支 or barpos=0); //CKU2
控平:=(H>壓力 or barpos=0)-(L<支撐 or barpos=0); //CKU3
買賣:=買1-賣1;
進出:C*0 NOAXIS;
多空:=0; 進價:=0; 出價:=0; CC:=C; HH:=H; LL:=L;
for i=1 to datacount do begin
if DECK[i] then 停損次:=0;
if 強平[i] then begin
if 多空<>0 then begin
進出[i]:=SGN(多空)*-4; 多空:=0;
end;
end else begin
if 買賣[i]<>0 and 買賣[i]<>SGN(多空) and 停損次<2 then begin
多空:=買賣[i]; 進出[i]:=多空;
進價:=CC[i]; MaxHLSP:=0; 出價:=進價-SGN(多空)*20;
end else if 多空<>0 then begin
if 控反[i]=-多空 then begin
進出[i]:=-多空*2; 多空:=控反[i]*2;
進價:=CC[i]; MaxHLSP:=0; 出價:=進價-SGN(多空)*20;
end else if 控平[i]*2=-多空 then begin
進出[i]:=控平[i]*3; 多空:=0;
end else begin
盈虧:=(CC[i]-進價)*SGN(多空);
HL:=HH[i]; if 多空<0 then HL:=LL[i];
HLSP:=(HL-進價)*SGN(多空); //Max盈虧
if HLSP>MaxHLSP then MaxHLSP:=HLSP;
if MaxHLSP>80 then begin
出價:=進價+MaxHLSP*(2/3)*SGN(多空);
end else if MaxHLSP>50 then begin
出價:=進價+MaxHLSP*(1/2)*SGN(多空);
end else if MaxHLSP>20 then begin
出價:=進價+(MaxHLSP-30)*SGN(多空);
end else begin
出價:=進價-20*SGN(多空);
end;
if (CC[i]-出價)<0 then begin
進出[i]:=5*SGN(多空); 多空:=0; if 盈虧<0 then 停損次:=停損次+1;
end;
end;
end;
end;
end;