請問各位高手,關於預估量函數的寫法
各位高手,小弟最近剛入手AB,想請教關於預估量函數的寫法,就是把現在的總交易量(V)透過給定該時間的轉換倍數得到預估交易量(PV),例如:09:05PV=15*V,09:06PV=14*V ........一直到 13:30 PV = 1*V。該怎麼寫呢?謝謝各位高手啊~~ 我是這樣寫…//=================================================================================================================
SetForeign( "TWSE" );
TWSE = TimeFrameGetPrice( "C", in1Minute );
RestorePriceArrays();
TWSE_SUM_VOL = GetRTDataForeign("TotalVolume", "TWSE" );
TWSE_V_sum = TWSE_SUM_VOL;
if (SecNumberTime <= 32700) { TWSE_V_est = TWSE_V_sum * 14.99; }
if (SecNumberTime > 32700 and SecNumberTime <= 33000) { TWSE_V_est = TWSE_V_sum * 9.48; }
if (SecNumberTime > 33000 and SecNumberTime <= 33300) { TWSE_V_est = TWSE_V_sum * 7.12; }
if (SecNumberTime > 33300 and SecNumberTime <= 33600) { TWSE_V_est = TWSE_V_sum * 5.83; }
if (SecNumberTime > 33600 and SecNumberTime <= 33900) { TWSE_V_est = TWSE_V_sum * 4.99; }
if (SecNumberTime > 33900 and SecNumberTime <= 34200) { TWSE_V_est = TWSE_V_sum * 4.42; }
if (SecNumberTime > 34200 and SecNumberTime <= 34500) { TWSE_V_est = TWSE_V_sum * 3.99; }
if (SecNumberTime > 34500 and SecNumberTime <= 34800) { TWSE_V_est = TWSE_V_sum * 3.66; }
if (SecNumberTime > 34800 and SecNumberTime <= 35100) { TWSE_V_est = TWSE_V_sum * 3.39; }
if (SecNumberTime > 35100 and SecNumberTime <= 35400) { TWSE_V_est = TWSE_V_sum * 3.18; }
if (SecNumberTime > 35400 and SecNumberTime <= 35700) { TWSE_V_est = TWSE_V_sum * 2.99; }
if (SecNumberTime > 35700 and SecNumberTime <= 36000) { TWSE_V_est = TWSE_V_sum * 2.83; }
if (SecNumberTime > 36000 and SecNumberTime <= 36300) { TWSE_V_est = TWSE_V_sum * 2.7; }
if (SecNumberTime > 36300 and SecNumberTime <= 36600) { TWSE_V_est = TWSE_V_sum * 2.58; }
if (SecNumberTime > 36600 and SecNumberTime <= 36900) { TWSE_V_est = TWSE_V_sum * 2.48; }
if (SecNumberTime > 36900 and SecNumberTime <= 37200) { TWSE_V_est = TWSE_V_sum * 2.39; }
if (SecNumberTime > 37200 and SecNumberTime <= 37500) { TWSE_V_est = TWSE_V_sum * 2.3 ; }
if (SecNumberTime > 37500 and SecNumberTime <= 37800) { TWSE_V_est = TWSE_V_sum * 2.23; }
if (SecNumberTime > 37800 and SecNumberTime <= 38100) { TWSE_V_est = TWSE_V_sum * 2.15; }
if (SecNumberTime > 38100 and SecNumberTime <= 38400) { TWSE_V_est = TWSE_V_sum * 2.09; }
if (SecNumberTime > 38400 and SecNumberTime <= 38700) { TWSE_V_est = TWSE_V_sum * 2.03; }
if (SecNumberTime > 38700 and SecNumberTime <= 39000) { TWSE_V_est = TWSE_V_sum * 1.97; }
if (SecNumberTime > 39000 and SecNumberTime <= 39300) { TWSE_V_est = TWSE_V_sum * 1.92; }
if (SecNumberTime > 39300 and SecNumberTime <= 39600) { TWSE_V_est = TWSE_V_sum * 1.87; }
if (SecNumberTime > 39600 and SecNumberTime <= 39900) { TWSE_V_est = TWSE_V_sum * 1.83; }
if (SecNumberTime > 39900 and SecNumberTime <= 40200) { TWSE_V_est = TWSE_V_sum * 1.79; }
if (SecNumberTime > 40200 and SecNumberTime <= 40500) { TWSE_V_est = TWSE_V_sum * 1.75; }
if (SecNumberTime > 40500 and SecNumberTime <= 40800) { TWSE_V_est = TWSE_V_sum * 1.71; }
if (SecNumberTime > 40800 and SecNumberTime <= 41100) { TWSE_V_est = TWSE_V_sum * 1.67; }
if (SecNumberTime > 41100 and SecNumberTime <= 41400) { TWSE_V_est = TWSE_V_sum * 1.63; }
if (SecNumberTime > 41400 and SecNumberTime <= 41700) { TWSE_V_est = TWSE_V_sum * 1.6 ; }
if (SecNumberTime > 41700 and SecNumberTime <= 42000) { TWSE_V_est = TWSE_V_sum * 1.57; }
if (SecNumberTime > 42000 and SecNumberTime <= 42300) { TWSE_V_est = TWSE_V_sum * 1.54; }
if (SecNumberTime > 42300 and SecNumberTime <= 42600) { TWSE_V_est = TWSE_V_sum * 1.51; }
if (SecNumberTime > 42600 and SecNumberTime <= 42900) { TWSE_V_est = TWSE_V_sum * 1.48; }
if (SecNumberTime > 42900 and SecNumberTime <= 43200) { TWSE_V_est = TWSE_V_sum * 1.46; }
if (SecNumberTime > 43200 and SecNumberTime <= 43500) { TWSE_V_est = TWSE_V_sum * 1.43; }
if (SecNumberTime > 43500 and SecNumberTime <= 43800) { TWSE_V_est = TWSE_V_sum * 1.41; }
if (SecNumberTime > 43800 and SecNumberTime <= 44100) { TWSE_V_est = TWSE_V_sum * 1.38; }
if (SecNumberTime > 44100 and SecNumberTime <= 44400) { TWSE_V_est = TWSE_V_sum * 1.36; }
if (SecNumberTime > 44400 and SecNumberTime <= 44700) { TWSE_V_est = TWSE_V_sum * 1.34; }
if (SecNumberTime > 44700 and SecNumberTime <= 45000) { TWSE_V_est = TWSE_V_sum * 1.32; }
if (SecNumberTime > 45000 and SecNumberTime <= 45300) { TWSE_V_est = TWSE_V_sum * 1.3 ; }
if (SecNumberTime > 45300 and SecNumberTime <= 45600) { TWSE_V_est = TWSE_V_sum * 1.28; }
if (SecNumberTime > 45600 and SecNumberTime <= 45900) { TWSE_V_est = TWSE_V_sum * 1.25; }
if (SecNumberTime > 45900 and SecNumberTime <= 46200) { TWSE_V_est = TWSE_V_sum * 1.23; }
if (SecNumberTime > 46200 and SecNumberTime <= 46500) { TWSE_V_est = TWSE_V_sum * 1.21; }
if (SecNumberTime > 46500 and SecNumberTime <= 46800) { TWSE_V_est = TWSE_V_sum * 1.19; }
if (SecNumberTime > 46800 and SecNumberTime <= 47100) { TWSE_V_est = TWSE_V_sum * 1.17; }
if (SecNumberTime > 47100 and SecNumberTime <= 47400) { TWSE_V_est = TWSE_V_sum * 1.14; }
if (SecNumberTime > 47400 and SecNumberTime <= 47700) { TWSE_V_est = TWSE_V_sum * 1.12; }
if (SecNumberTime > 47700 and SecNumberTime <= 48000) { TWSE_V_est = TWSE_V_sum * 1.09; }
if (SecNumberTime > 48000 and SecNumberTime <= 48300) { TWSE_V_est = TWSE_V_sum * 1.06; }
if (SecNumberTime > 48300 and SecNumberTime <= 48600) { TWSE_V_est = TWSE_V_sum * 1 ; }
if (SecNumberTime < 32700) { TWSE_V_est = TWSE_V_sum * 1 ; }
if (SecNumberTime > 48600) { TWSE_V_est = TWSE_V_sum * 1 ; }
TWSE_EST_VOL = TWSE_V_est/10000;
//=================================================================================================================
感謝antony大大熱心幫忙。
kuolung大大,可以用內插法補齊各個時間點的倍數?
頁:
[1]