 |
lxfyyylrx
中級會員
註冊日期: Jun 2010
來 自:
文章數量: 46 |
|
[求救]请教版主和各位高手,谢谢!!!!!
请把下面这段源码里的红绿竖线去掉,如图所示,谢谢!
input:kv(0.382,0,5),lenth(20,5,20),risk(3,1,20),money(2,1,20);
smax:=0*c;smin:=0*c;bsmax:=0*c;bsmin:=0*c;
HI:=0*h;LO:=0*l;Range1:=0*c;Range2:=0*c;
fc:=c; UpTrendBuffer:=0*c;DownTrendBuffer:=0*c;
m:=max(108,datacount-1000);
HI:=hhv(h,9);
LO:=llv(l,9);
Range1:=ma(tr,lenth);
Range2:=ma(tr,100);
for i=m to datacount do
begin
if Range1[i]< Range2[i] then Range1[i]:= Range2[i];
smin[i]:=LO[i] + 0.1*(HI[i]-LO[i]);
smax[i]:=HI[i]- 0.1*(HI[i]-LO[i]);
bsmax[i]:=HI[i]+(1.0+0.1*Risk)*Range1[i];////max=hi+1.3range
bsmin[i]:=LO[i]-(1.0+0.1*Risk)*Range1[i];///min=lo-1.3range
if fc[i]>smax[i] then trend:=1;
if fc[i]<smin[i] then trend:=-1;
if trend>0 then
begin
if LO[i]-Kv*Money*Range1[i]<bsmin[i] then bsmin[i]:=LO[i]-Kv*Money*Range1[i];///min=lo-0.764range;
if bsmin[i]<bsmin[i-1] then bsmin[i]:=bsmin[i-1];
end;
if trend<0 then
begin
if bsmax[i]<HI[i]+Kv*Money*Range1[i] then bsmax[i]:=HI[i]+Kv*Money*Range1[i] ;///max=hi+0.764range;
if bsmax[i]>bsmax[i-1] then bsmax[i]:=bsmax[i-1];
end ;
if trend>0 then
begin
if UpTrendBuffer[i-1]=-1.0 then
begin
bsmin[i]:=LO[i]-0.1*Risk*Range1[i];
UpTrendBuffer[i]:=bsmin[i];
end;
else UpTrendBuffer[i]:=bsmin[i];
DownTrendBuffer[i]:=-1.0;
end;
if trend<0 then
begin
if DownTrendBuffer[i-1]=-1.0 then
begin
bsmax[i]:=HI[i]+0.1*Risk*Range1[i];
DownTrendBuffer[i]:=bsmax[i];
end;
else DownTrendBuffer[i]:=bsmax[i];
UpTrendBuffer[i]:=-1.0;
end;
end;
stops:=if(UpTrendBuffer>0,UpTrendBuffer,DownTrendBuffer);
PARTLINE(stops>c,DownTrendBuffer),pointdot,linethick1,colorgreen;
PARTLINE(stops<c,UpTrendBuffer),pointdot,linethick2,colorred;
lxfyyylrx 附帶上了此圖片:
|
|
向版主報告此篇 |  |
|
2011-02-15 04:59 |
|
|
|  |
 |
cgjj
總版主

註冊日期: Oct 2003
來 自:
文章數量: 18237 |
|
回覆: [求救]请教版主和各位高手,谢谢!!!!!
引用: 最初由 lxfyyylrx 發表
请把下面这段源码里的红绿竖线去掉,如图所示,谢谢!
input:kv(0.382,0,5),lenth(20,5,20),risk(3,1,20),money(2,1,20);
smax:=0*c;smin:=0*c;bsmax:=0*c;bsmin:=0*c;
HI:=0*h;LO:=0*l;Range1:=0*c;Range2:=0*c;
fc:=c; UpTrendBuffer:=0*c;DownTrendBuffer:=0*c;
m:=max(108,datacount-1000);
HI:=hhv(h,9);
LO:=llv(l,9);
Range1:=ma(tr,lenth);
Range2:=ma(tr,100);
for i=m to datacount do
begin
if Range1[i]< Range2[i] then Range1[i]:= Range2[i];
smin[i]:=LO[i] + 0.1*(HI[i]-LO[i]);
smax[i]:=HI[i]- 0.1*(HI[i]-LO[i]);
bsmax[i]:=HI[i]+(1.0+0.1*Risk)*Range1[i];////max=hi+1.3range
bsmin[i]:=LO[i]-(1.0+0.1*Risk)*Range1[i];///min=lo-1.3range
if fc[i]>smax[i] then trend:=1;
if fc[i]<smin[i] then trend:=-1;
if trend>0 then
begin
if LO[i]-Kv*Money*Range1[i]<bsmin[i] then bsmin[i]:=LO[i]-Kv*Money*Range1[i];///min=lo-0.764range;
if bsmin[i]<bsmin[i-1] then bsmin[i]:=bsmin[i-1];
end;
if trend<0 then
begin
if bsmax[i]<HI[i]+Kv*Money*Range1[i] then bsmax[i]:=HI[i]+Kv*Money*Range1[i] ;///max=hi+0.764range;
if bsmax[i]>bsmax[i-1] then bsmax[i]:=bsmax[i-1];
end ;
if trend>0 then
begin
if UpTrendBuffer[i-1]=-1.0 then
begin
bsmin[i]:=LO[i]-0.1*Risk*Range1[i];
UpTrendBuffer[i]:=bsmin[i];
end;
else UpTrendBuffer[i]:=bsmin[i];
DownTrendBuffer[i]:=-1.0;
end;
if trend<0 then
begin
if DownTrendBuffer[i-1]=-1.0 then
begin
bsmax[i]:=HI[i]+0.1*Risk*Range1[i];
DownTrendBuffer[i]:=bsmax[i];
end;
else DownTrendBuffer[i]:=bsmax[i];
UpTrendBuffer[i]:=-1.0;
end;
end;
stops:=if(UpTrendBuffer>0,UpTrendBuffer,DownTrendBuffer);
PARTLINE(stops>c,DownTrendBuffer),pointdot,linethick1,colorgreen;
PARTLINE(stops<c,UpTrendBuffer),pointdot,linethick2,colorred;
PARTLINE(stops>c,DownTrendBuffer),pointdot,linethick1,colorgreen;
PARTLINE(stops<c,UpTrendBuffer),pointdot,linethick2,colorred; [/B]
改為
PARTLINE(sum(stops>c,2)=2,DownTrendBuffer),pointdot,linethick1,colorgreen;
PARTLINE(sum(stops<c,2)=2,UpTrendBuffer),pointdot,linethick2,colorred;
|
|
向版主報告此篇 |  |
|
2011-02-15 09:05 |
|
|
|  |
 |
lxfyyylrx
中級會員
註冊日期: Jun 2010
來 自:
文章數量: 46 |
|
回覆: 回覆: [求救]请教版主和各位高手,谢谢!!!!!
引用: 最初由 cgjj 發表
PARTLINE(stops>c,DownTrendBuffer),pointdot,linethick1,colorgreen;
PARTLINE(stops<c,UpTrendBuffer),pointdot,linethick2,colorred;
改為
PARTLINE(sum(stops>c,2)=2,DownTrendBuffer),pointdot,linethick1,colorgreen;
PARTLINE(sum(stops<c,2)=2,UpTrendBuffer),pointdot,linethick2,colorred; [/B]
谢谢版主帮助,但问题没有完全解决,还请费心看看,谢谢!!!
lxfyyylrx 附帶上了此圖片:
|
|
向版主報告此篇 |  |
|
2011-02-15 17:47 |
|
|
|  |
 |
lxfyyylrx
中級會員
註冊日期: Jun 2010
來 自:
文章數量: 46 |
|
回覆: 回覆: 回覆: 回覆: [求救]请教版主和各位高手,谢谢!!!!!
引用: 最初由 cgjj 發表
您的問題可能不是在於 PARTLINE 的處理
而是在於該處 UpTrendBuffer 的數值異常
請 check 有問題的地方, 該處的 UpTrendBuffer 值
看看是否有 UpTrendBuffer <=0 的這種狀況
這應該是此公式本身邏輯造成的結果
要修正請自邏輯下手(可能只依賴 stops<c 來決定畫, 是不足的)
好的,谢谢版主的指导!!!!
|
|
向版主報告此篇 |  |
|
2011-02-15 19:16 |
|
|
|  |
本站所有內容未經作者授權禁止轉貼節錄, 發表言論僅供參考勿作為投資決策依據。瀏覽本站請使用 IE 5.5 以上版本, 最佳瀏覽解析度 1024 x 768 全彩。
|
Powered by: vBulletin Version 2.3.0 - Copyright©2000-, Jelsoft Enterprises Limited.
簡愛洋行 製作 Copyright 2003-. All Rights Reserved. 聯絡我們
|