請問自訂MC指標dpo-singal該如何寫?Thanks!
在下參考
plot1($disparity, "disparity");
另外弄一個dpo
/////////////////////////////
eleader-fucntion
////////////////////////////
def dpo(period) :
return c - ma(c,period)[((period / 2) + 1)]
*********************
inputs:period(36);
vars: $dpo(0);
$dpo = close - average(close,period)[((period / 2) + 1)];
plot1($dpo, "dpo");
*********************
可以用
eleader內dpo
有多一條紅線dpo-singal
ema(dpo(36),3)
請問大大該如何補上這條ema線
感謝您!!
Ema 改為Xaverage 的方式即可 easytrader788 發表於 16-5-22 12:38
Ema 改為Xaverage 的方式即可
感謝您!!
可以用了!
inputs:period(36),period2(3);
vars: $dpo(0),$dpo_singal(0);
$dpo = close - average(close,period)[((period / 2) + 1)];
$dpo_singal = xaverage($dpo,period2);
plot1($dpo, "dpo");
plot2($dpo_singal, "dpo_singal");
感激不盡!!!
{:4_209:}
http://www.moneydj.com/KMDJ/Wiki/wikiViewer.aspx?keyid=358679c7-b45c-48d5-8ef5-07c8e0fef8f8 DPO 非價格趨勢指標 本帖最後由 f29825604 於 16-5-28 10:25 編輯
f29825604 發表於 16-5-22 13:23
感謝您!!
可以用了!
自訂mc指標CCICXAverage
///////////////////////////
// eleader-fucntion
///////////////////////////
def cci(period) :
m1 = (h+l+c)/3
m2 = ma(m1, period)
d1 = array(len(m2) - period + 1)
for i in range(period) :
d1 = d1 + abs(m1 - m2)
d1 = d1 / period
return (m1-m2) / (0.015 * d1)
****************************
mc 內 CCIClassic
****************************
Inputs: Len(NumericSimple);
Variables: var0(0),var1(0),var2(0),var3(0), var4(0);
If Len > 0 Then Begin
var4 = (High + Low + Close) / 3;
var3 = Average(var4 , Len);
var2 = 0;
for var1 = 0 to Len - 1 Begin
var2 = var2 + AbsValue(var4 - var3);
End;
var2 = var2 / Len;
If var2 = 0 Then
CCIClassic = 0
Else
CCIClassic = (var4 - var3) / (0.015 * var2);
End
Else
CCIClassic = 0;
新增CCICXAverage指標
用原本mc指標CCI Average修改
inputs:
CCILength( 14 ),
CCIAvgLength( 9 ),
OverSold( -100 ),
OverBought( 100 ) ;
variables:
var0( 0 ),
var1( 0 ) ;
var0 = CCIClassic( CCILength ) ;
var1 = XAverage( var0, CCIAvgLength ) ;
Plot1( var0, "CCIC" ) ;
Plot2( var1, "CCIXAvg" ) ;
Plot3( OverBought, "OverBot" ) ;
Plot4( OverSold, "OverSld" ) ;
condition1 = var1 crosses over OverSold ;
if condition1 then
Alert( "Indicator exiting oversold zone" )
else
begin
condition1 = var1 crosses under OverBought ;
if condition1 then
Alert( "Indicator exiting overbought zone" ) ;
end;
可以用
做紀錄
可查詢
Thanks!!
本帖最後由 f29825604 於 16-7-16 19:54 編輯
f29825604 發表於 16-5-28 10:21
自訂mc指標CCICXAverage
///////////////////////////
MultiCharts Version 8.0 Release (Build 5620)
語法似乎有些不同
紀錄一下
inputs:
CCILength( 14 ),
CCIAvgLength( 9 ),
OverSold( -100 ),
OverBought( 100 ) ;
variables:
var0( 0 ),
var1( 0 ) ;
var0 = CCI( CCILength ) ;
var1 = XAverage( var0, CCIAvgLength ) ;
Plot1( var0, "CCI" ) ;
Plot2( var1, "CCIXAvg" ) ;
Plot3( OverBought, "OverBot" ) ;
Plot4( OverSold, "OverSld" ) ;
condition1 = var1 crosses over OverSold ;
if condition1 then
Alert( "Indicator exiting oversold zone" )
else
begin
condition1 = var1 crosses under OverBought ;
if condition1 then
Alert( "Indicator exiting overbought zone" ) ;
end;
頁:
[1]