![]() |
總頁數 (2): [1] 2 » 在這個頁面顯示本主題全部的 17 個文章 |
奇狐社區論壇 (http://www.chiefox.com.tw/bbs/index.php)
- 應用交流 (http://www.chiefox.com.tw/bbs/forumdisplay.php?forumid=33)
-- John F. Ehlers的Sinewave Indicator (http://www.chiefox.com.tw/bbs/showthread.php?threadid=22337)
John F. Ehlers的Sinewave Indicator
請問版上的各位高手
John F. Ehlers的Sinewave Indicator
如何改為奇狐指標
http://quantitative-tradingg.blogsp...-indicator.html
介紹的很詳細 也有原碼:
Inputs: Price((H+L)/2);
Vars: Smooth (0),Detrender (0) , I1 (0), Q1 (0), jI (0), JQ (0), I2 (0), Q2 (0), Re (0), Im (0), Period (0), SmoothPeriod (0), SmoothPrice (0), DCPeriod (0), RealPart (0),
Imagpart (0), count (0), DCPhase (0), DCSine (0), LeadSine (0), Itrend (0), Trendline (0),
Trend (0), DaysinTrend (0);
If CurrentBar > 5 then begin
Smooth = (4*Price + 3*Price[1] + 2*Price[2] + Price[3]) / 10;
Detrender = (.0962 * Smooth + .5769 * Smooth[2] - .5769 * Smooth[4] - .0962*Smooth[6]) * (.075 * Period[1] + .54);
{Compute InPhase and Quadrature components.}
Q1 = (.0962 * Detrender + .5769 * Detrender[2] - .5769 * Detrender[4] - .0962 * Detrender[6]) * (.075 * Period[1] + .54);
I1 = Detrender[3];
{Advance the phase of I1 and Q1 by 90 degrees}
jI = (.0962 * I1 + .5769 * I1[2] - .5769 * I1[4] - .0962 * I1[6]) * (.075 * Period[1] + .54);
JQ = (.0962 * Q1 + .5769 * Q1[2] - .5769 * Q1[4] - .0962 * Q1[6]) * (.075 * Period[1] + .54);
{Phasor addition for 3 bar averaging)}
I2 = I1 - JQ;
Q2 = Q1 + jI;
{Smooth the I and Q components before applying the discriminator}
I2 = .2 * I2 + .8 * I2[1];
Q2 = .2 * Q2 + .8 * Q2[1];
{Homodyne Discriminator}
Re = I2 * I2[1] + Q2 * Q2[1];
Im = I2 * Q2[1] - Q2 * I2[1];
Re = .2 * Re + .8 * Re[1];
Im = .2 * Im + .8 * Im[1];
If Im <> 0 and Re <> 0 then Period = 360 / ArcTangent (Im/Re);
If Period > 1.5 * Period[1] then Period = 1.5 * Period[1];
If Period < .67 * Period[1] then Period = .67 * Period[1];
If Period < 6 then Period = 6;
If Period > 50 then Period = 50;
Period = .2 * Period + .8 * Period[1];
SmoothPeriod = .33 * Period + .67 * SmoothPeriod[1];
{Compute Dominant Cycle Phase}
SmoothPrice = (4 * price + 3 * Price[1] + 2 * Price[2] + Price[3]) / 10;
DCPeriod = IntPortion(SmoothPeriod + .5);
RealPart = 0;
ImagPart = 0;
For count = 0 To DCPeriod - 1 begin
RealPart = RealPart + sine (360 * count / DCPeriod) *
(SmoothPrice[count]);
ImagPart = imagPart + CoSine (360 * count / DCPeriod) *
(SmoothPrice[count]);
End;
If AbsValue(ImagPart) > 0
then DCPhase = Arctangent(RealPart / ImagPart);
If AbsValue(ImagPart) <= .001
then DCPhase = DCPhase + 90 * Sign(RealPart);
DCPhase = DCPhase + 90;
{Compensate for one bar lag of the Weighted Moving Average}
DCPhase = DCPhase + 360 / SmoothPeriod;
If ImagPart < 0 then DCPhase = DCPhase + 180;
If DCPhase > 315 then DCPhase = DCPhase - 360;
Plot1(Sine(DCPhase), "Sine");
Plot2(Sine(DCPhase + 45), "LeadSine");
end;
請教
請教一下總版主
小弟參考了總版主在如下的答覆
http://www.chiefox.com.tw/bbs/showt...=&threadid=9836
知道問題在於有使用到"上一周期的值"
範例中的Y'
此公式中的period[1](奇狐的REF(period,1)
multichart使用了If CurrentBar > 5 then begin
奇狐必需採用迴圈技巧
能否指導一下如何寫
謝謝總版主
回覆: 請教
引用:
最初由 ryan 發表
請教一下總版主
小弟參考了總版主在如下的答覆
http://www.chiefox.com.tw/bbs/showt...=&threadid=9836
知道問題在於有使用到"上一周期的值"
範例中的Y'
此公式中的period[1](奇狐的REF(period,1)
multichart使用了If CurrentBar > 5 then begin
奇狐必需採用迴圈技巧
能否指導一下如何寫
謝謝總版主
回覆
這個是2014至2016的網頁
連結進去已經沒有新的貼文了
所以沒有新的貼圖
Plot1(Sine(DCPhase), "Sine");
Plot2(Sine(DCPhase + 45), "LeadSine");
應該是上面的指標
下面的應該是回答留言所指的
Plot1(DCPhase, "DCPhase");
Plot2(0, "0");
Plot3(180, "180");
回覆: 回覆
引用:
最初由 ryan 發表
這個是2014至2016的網頁
連結進去已經沒有新的貼文了
所以沒有新的貼圖
Plot1(Sine(DCPhase), "Sine");
Plot2(Sine(DCPhase + 45), "LeadSine");
應該是上面的指標
下面的應該是回答留言所指的
Plot1(DCPhase, "DCPhase");
Plot2(0, "0");
Plot3(180, "180");
哇
如果紅藍線跟黃線分開為二個指標
就都一樣了
總版主真厲害
這個指標對於"盤整盤"跟"趨勢盤"的
判別有獨特的見解
總版主可以嘉惠我們狐友嗎
謝謝
回覆: 哇
引用:
最初由 ryan 發表
如果紅藍線跟黃線分開為二個指標
就都一樣了
總版主真厲害
這個指標對於"盤整盤"跟"趨勢盤"的
判別有獨特的見解
總版主可以嘉惠我們狐友嗎
謝謝
此公式計算負荷較重,請謹慎設定參數!!! (計算的總K棒數)
使用時請注意 CPU 負載,不要同時跑太多軟體或公式!
預設只算近期1200根K棒,請自行適度加減調整。
sinewave的使用
sinewave的使用在這個網頁有詳細的說明
https://wenschair.pixnet.net/blog/post/38583445
底下也有連結一些網頁 提供進出的技巧跟策略
在做逆勢盤...壓力跟支撐
在做順勢盤...突破(創新高跟破底)
sinewave的實用性很高
在這個網頁
https://indicatorvaulthq.com/sinewave/
也有範例說明
重點是 這個指標要499美金(大家都賺到了...謝謝總版主 )
PS:看了總版主改寫的程式...這 這 這真是非我們理工科班出身所能望塵莫及的了....再次拜謝
回覆: sinewave的使用
引用:
最初由 ryan 發表
sinewave的使用在這個網頁有詳細的說明
https://wenschair.pixnet.net/blog/post/38583445
底下也有連結一些網頁 提供進出的技巧跟策略
在做逆勢盤...壓力跟支撐
在做順勢盤...突破(創新高跟破底)
sinewave的實用性很高
在這個網頁
https://indicatorvaulthq.com/sinewave/
也有範例說明
重點是 這個指標要499美金(大家都賺到了...謝謝總版主 :p )
PS:看了總版主改寫的程式...這 這 這真是非我們理工科班出身所能望塵莫及的了....再次拜謝
sinewave
sinewave
感謝總版主的幫忙及改寫
今天的盤有二段符合trend的型態 其他為cycle型態
Even better Sinewave
Even better Sinewave
應該是John F. Ehlers更精進的寫法
https://www.prorealcode.com/proreal...etter-sinewave/
可以請總版主在幫忙改寫一下嗎
萬分感謝!
//parameters
// Duration = 36
// lowerBand = 9
if(barindex>10) then
OB = 0.85
OS = -0.85
Pi = 3.14159265358979
angle = ((360*Pi)/180)/Duration
alpha1 = (1-sin(angle))/cos(angle)
HP = 0.5*(1+alpha1)*(close-close[1])+alpha1*HP[1]
ang = sqrt(2)*Pi/lowerBand
a1 = exp(-ang)
b1 = 2*a1*cos(ang)
c2 = b1
c3 = -a1*a1
c1 = 1 - c2 - c3
filt = c1*(HP + (HP[1]))/2 + c2*(filt[1]) + c3*(filt[2])
Wave = (filt+filt[1]+filt[2])/3
Pwr = (filt*filt+filt[1]*filt[1]+filt[2]*filt[2])/3
sineWave = Wave / sqrt(Pwr)
endif
RETURN sineWave coloured(255,255,0) as "SineWave", OB as "Overbought level", OS as "Oversold level"
Whenever possible I get a even exclusive Sinewave which exceeded my expectation.
just for reference
回覆: Even better Sinewave
引用:
最初由 ryan 發表
Even better Sinewave
應該是John F. Ehlers更精進的寫法
https://www.prorealcode.com/proreal...etter-sinewave/
可以請總版主在幫忙改寫一下嗎
萬分感謝!
//parameters
// Duration = 36
// lowerBand = 9
if(barindex>10) then
OB = 0.85
OS = -0.85
Pi = 3.14159265358979
angle = ((360*Pi)/180)/Duration
alpha1 = (1-sin(angle))/cos(angle)
HP = 0.5*(1+alpha1)*(close-close[1])+alpha1*HP[1]
ang = sqrt(2)*Pi/lowerBand
a1 = exp(-ang)
b1 = 2*a1*cos(ang)
c2 = b1
c3 = -a1*a1
c1 = 1 - c2 - c3
filt = c1*(HP + (HP[1]))/2 + c2*(filt[1]) + c3*(filt[2])
Wave = (filt+filt[1]+filt[2])/3
Pwr = (filt*filt+filt[1]*filt[1]+filt[2]*filt[2])/3
sineWave = Wave / sqrt(Pwr)
endif
RETURN sineWave coloured(255,255,0) as "SineWave", OB as "Overbought level", OS as "Oversold level"
Even better Sinewave
公式名稱: Sinewave_EB
預設只算近期1200根K棒,請自行適度加減調整。
全部時間均為台灣時間, 現在時間為01:21 | 總頁數 (2): [1] 2 » 在這個頁面顯示本主題全部的 17 個文章 |
Powered by: vBulletin Version 2.3.0 - Copyright©2000-, Jelsoft Enterprises Limited.
簡愛洋行 製作 Copyright 2003-. All Rights Reserved.