龙听期货论坛's Archiver

龙听 发表于 2022-10-30 12:34

对艾略特波浪理论进行量化并进行初步回测[ELLIOTT WAVE SYSTEM STRATEGY CODE]

程式码相关:ELLIOTT WAVE SYSTEM STRATEGY CODE信号部分
**** Hidden Message *****函数部分:

1、WAVE345ELLIOTT[code]
INPUTS: LEN(NUMERIC), TRIG(NUMERIC);

VARS: ET(0), PRICE(0), OSC(0), WAVE(0), HIOSC(-999), HIOSC2(-999), HIPRICE(-999), HIPRICE2(-999);

OSC = ELLIOTTWAVEOSC;

PRICE = (HIGH + LOW) / 2;

ET = ELLIOTTREND(LEN, TRIG);

IF ET = 1 AND ET[1] = -1 AND OSC > 0 THEN BEGIN

        HIOSC = OSC;

        HIPRICE = PRICE;

        WAVE = 3;

END;

IF WAVE = 3 AND HIOSC < OSC THEN

        HIOSC = OSC;

IF WAVE = 3 AND OSC <= 0 AND ET = 1 THEN

        WAVE = 4;

IF WAVE = 4 AND PRICE = HIGHEST(PRICE, 5) AND OSC >= 0 THEN BEGIN

        WAVE = 5;

        HIOSC2 = OSC;

        HIPRICE2 = PRICE;

END;

IF WAVE = 5 AND HIOSC2 < OSC THEN

        HIOSC2 = OSC;

IF WAVE = 5 AND HIPRICE2 < PRICE THEN

        HIPRICE2 = PRICE;

IF HIOSC2 > HIOSC AND WAVE = 5 AND ET = 1 THEN BEGIN

        WAVE = 3;

        HIOSC = HIOSC2;

        HIPRICE = HIPRICE2;

        HIOSC2 = -999;

        HIPRICE2 = -999;

END;

IF ET = -1 AND WAVE = 5 THEN BEGIN

        WAVE = -3;

        HIOSC = -999;

        HIPRICE = -999;

        HIOSC2 = -999;

        HIPRICE2 = -999;

END;

WAVE345ELLIOTT = WAVE;
[/code]2、函数:ELLIOTTWAVEOSC[code]
VARS: OSC535(0), PRICE(0);

PRICE = (H+L)/2;

IF AVERAGE(PRICE, 35) <> 0 THEN

OSC535 = AVERAGE(PRICE, 5) - AVERAGE(PRICE, 35);

ELLIOTTWAVEOSC = OSC535;
[/code]3、函数:ELLIOTTREND[code]
INPUTS: LEN(NUMERIC), TRIGGER(NUMERIC);

VARS: TREND(0), OSC(0);

OSC = ELLIOTTWAVEOSC;

IF OSC = HIGHEST(OSC, LEN) AND TREND = 0 THEN TREND = 1;

IF OSC = LOWEST(OSC, LEN) AND TREND = 0 THEN TREND = -1;

IF LOWEST(OSC, LEN) < 0 AND TREND = -1 AND OSC > -1 * TRIGGER * LOWEST(OSC, LEN) THEN TREND = 1;

IF HIGHEST(OSC, LEN) > 0 AND TREND = 1 AND OSC < -1 * TRIGGER * HIGHEST(OSC, LEN) THEN TREND = -1;

ELLIOTTREND = TREND;
[/code]

龙听 发表于 2022-10-30 12:35

运行效果:
[img]http://p.algo2.net/2022/1030/45b88dd580ec9.png[/img]
[img]http://p.algo2.net/2022/1030/004cd2c861b74.png[/img]

孙彬 发表于 2023-1-14 16:41

感谢分享

一個人 发表于 2023-2-9 22:45

感谢分享

一個人 发表于 2023-2-11 08:54

感謝版主分享

琦琦 发表于 2023-3-20 23:36

感謝版主分享

游侠故事 发表于 2023-3-26 10:30

感谢分享

随风风风 发表于 2023-6-7 12:01

学习中

宇雲 发表于 2023-11-6 12:41

感谢分享

水山 发表于 2024-1-11 16:06

MultiCharts indicator that uses Expert Commentary functionality. Money Flow suggests a signal when a new period High or Low is reached in the market which is not confirmed by a similar new High in the Money Flow index.

ExpertMoneyFlow Function Code

你好世界 发表于 2024-7-3 08:57

你好世界是编程的第一句话

你好世界 发表于 2024-7-3 08:58

你好世界是编程的第一句话

页: [1]