奇狐社區論壇
在這個頁面顯示本主題全部的 5 個文章

奇狐社區論壇 (http://www.chiefox.com.tw/bbs/index.php)
- 問題交流 (http://www.chiefox.com.tw/bbs/forumdisplay.php?forumid=28)
-- [問題] 求最低值 (http://www.chiefox.com.tw/bbs/showthread.php?threadid=17878)


由 yoson168 在 2013-07-26 15:39 發表:

[問題] 求最低值

當在2012/12/24時,次畫面程式中的一個變數GREEN_P2_LOW 的值應是580 (2012/10/01),但卻顯示587 (2012/10/24),不知問題出在哪裡?

以下是次畫面程式的最後二行的程式碼
aalow:= llv(low,r2) colorwhite linethick0;
green_p2_low: ref(aalow,f2) colorwhite linethick0;

而於2012/12/24時,F2等於 43 , R2等於 25
故最低值應是580,而不是587才對



主畫面程式:
m5:=ma(c,5) colormagenta;
m10:=ma(c,10) colorcyan;
m21:=ma(c,21) colorred;
a1:=c>m5;
ff1:=m10<m21;
YY1:=a1 and not(ff1);
b1:=c<m5;
gg1:=m10>m21;
xx1:=b1 and not(gg1);
STICKLINE(c>=o,high, low, 0.1,1),colorGray;
STICKLINE(c>=o,close,open,8 ,1),colorGray;
STICKLINE(c< o,high, low, 0.1,1),colorGray;
STICKLINE(c< o,close,open,8 ,0),colorGray;
STICKLINE(c>=o AND YY1,high, low, 0.1,1),colorred;
STICKLINE(c>=o AND YY1,close,open,8 ,1),colorred;
STICKLINE(c< o AND YY1,high, low, 0.1,1),colorred;
STICKLINE(c< o AND YY1,close,open,8 ,0),colorred;
STICKLINE(c>=o AND xx1,high, low, 0.1,1),color009900;
STICKLINE(c>=o AND xx1,close,open,8 ,1),color009900;
STICKLINE(c< o AND xx1,high, low, 0.1,1),color009900;
STICKLINE(c< o AND xx1,close,open,8 ,0),color009900;





次畫面程式:
m5:=ma(c,5);
m10:=ma(c,10);
m21:=ma(c,21);
a1:=c>m5;
ff1:=m10<m21;
YY1:=a1 and not(ff1);
b1:=c<m5;
gg1:=m10>m21;
xx1:=b1 and not(gg1);
//
green_bar:=if(xx1,1,0);
red_bar:=if(not(xx1) and yy1,1,0);
red_cnt:=sumbars(red_bar,1) colorred linethick0;
green_cnt:=sumbars(green_bar,1) colorgreen linethick0;
ps1:=red_cnt>green_cnt and green_bar;
paint_green:backset(green_bar,red_cnt-1);
paint_red:=backset(red_bar,green_cnt-1);
green_end:=paint_green and not(refx(paint_green,1));
green_start:=paint_green and not(ref(paint_green,1));
//
green_1s:=sumbars(green_start,1) colorred linethick0;
green_1e:=sumbars(green_end,1) colorred linethick0;
green_2s:=sumbars(green_start,2) colorwhite linethick0;
green_2e:=sumbars(green_end,2) colorwhite linethick0;
green_3s:=sumbars(green_start,3) colorgreen linethick0;
green_3e:=sumbars(green_end,3) colorgreen linethick0;
//
green_u2s:=green_2s colorred linethick0;
green_u2e:=if(green_1s<green_1e,green_1e,green_2e) colorred linethick0;
green_u3s:=green_3s colorwhite linethick0;
green_u3e:=if(green_1s<green_1e,green_2e,green_3e) colorwhite linethick0;

f2: green_u2e-1 coloryellow linethick0;
r2: green_u2s-green_u2e+1 coloryellow linethick0;
aalow:= llv(low,r2) colorwhite linethick0;
green_p2_low: ref(aalow,f2) colorwhite linethick0;


由 cgjj 在 2013-07-26 16:06 發表:

回覆: [問題] 求最低值

引用:
最初由 yoson168 發表
當在2012/12/24時,次畫面程式中的一個變數GREEN_P2_LOW 的值應是580 (2012/10/01),但卻顯示587 (2012/10/24),不知問題出在哪裡?

以下是次畫面程式的最後二行的程式碼
aalow:= llv(low,r2) colorwhite linethick0;
green_p2_low: ref(aalow,f2) colorwhite linethick0;

而於2012/12/24時,F2等於 43 , R2等於 25
故最低值應是580,而不是587才對

........略..........



請說明您用哪個商品哪個週期測試
以及算甚麼東西, 才能協助您唷


由 yoson168 在 2013-07-26 18:20 發表:

商品:大立光(3008)
周期: 日線

是要請大大幫忙看看次畫面程式中的一個變數GREEN_P2_LOW 的值。問題如下:

程式碼:(次畫面程式的最後二行的程式碼)
-------------------------------------------------------------
aalow:= llv(low,r2) colorwhite linethick0;
green_p2_low: ref(aalow,f2) colorwhite linethick0;
-------------------------------------------------------------
以上二行程式碼,在2012/12/24的當下,等同為
aalow:= llv(low,25) colorwhite linethick0;
green_p2_low: ref(aalow,43) colorwhite linethick0;

可得在2012/12/24的當下變數GREEN_P2_LOW 的值為587 (即2012/10/24的最低值),
但是我希望是這個時段的最低值,應是580 (即2012/10/01的最低值),
,不知問題出在哪裡?


由 cgjj 在 2013-07-29 09:30 發表:

引用:
最初由 yoson168 發表
商品:大立光(3008)
周期: 日線

是要請大大幫忙看看次畫面程式中的一個變數GREEN_P2_LOW 的值。問題如下:

程式碼:(次畫面程式的最後二行的程式碼)
-------------------------------------------------------------
aalow:= llv(low,r2) colorwhite linethick0;
green_p2_low: ref(aalow,f2) colorwhite linethick0;
-------------------------------------------------------------
以上二行程式碼,在2012/12/24的當下,等同為
aalow:= llv(low,25) colorwhite linethick0;
green_p2_low: ref(aalow,43) colorwhite linethick0;

可得在2012/12/24的當下變數GREEN_P2_LOW 的值為587 (即2012/10/24的最低值),
但是我希望是這個時段的最低值,應是580 (即2012/10/01的最低值),
,不知問題出在哪裡?



2012/12/24 位在 第 2693 根k棒, 該根的 f2=43, r2=25 沒錯
但別忘了, 您用 ref(aalow,43) , 是要求往前數第43根的 aalow 值
也就是第 2650 根的 aalow 值 (2693-43=2650)
而第 2650 根的 r2 值是 12
也就是第 2650 根的 aalow 是算 llv(low,12)
所得的結果就是 587

故並無算錯唷, 就是得到 587 這組數字


由 yoson168 在 2013-07-29 11:35 發表:

TKS .


全部時間均為台灣時間, 現在時間為03:55
在這個頁面顯示本主題全部的 5 個文章


Powered by: vBulletin Version 2.3.0 - Copyright©2000-, Jelsoft Enterprises Limited.

簡愛洋行 製作 Copyright 2003-. All Rights Reserved.