论坛全局菜单下方 - TICKMILL 285X70论坛全局菜单下方 - ThinkMarkets285X70论坛全局菜单下方 - 荔枝返现285X70论坛全局菜单下方 -  icmarkets285X70
查看:2575回复:0
[MT4指标]求把fxcm里面的EWN艾略特波浪数目指标改成MT4可以用的代码,先谢!!
楼主发表于:2010-01-30 04:00只看该作者倒序浏览
1楼 电梯直达
电梯直达
如题,我是新手不会上传文件,下面是转成txt文件的代码: -- The indicator is based on EWO. -- The formula of EWO is described in the Kaufman "Trading Systems and Methods" chapter 14 "Behavioral techniques" (page 358-361) -- Indicator profile initialization routine -- Defines indicator profile properties and indicator parameters function Init() indicator:name(resources:get("name")); indicator:description(resources:get("description")); indicator:requiredSource(core.Bar); indicator:type(core.Oscillator); indicator.parameters:addInteger("Trigger", resources:get("param_Trigger_name"), resources:get("param_Trigger_description"), 70, 2, 1000); indicator.parameters:addInteger("Period", resources:get("param_Period_name"), resources:get("param_Period_description"), 20, 2, 1000); indicator.parameters:addColor("clrEWV", resources:get("param_clrEWV_name"), resources:get("param_clrEWV_description"), core.rgb(255, 0, 0)); end -- Indicator instance initialization routine -- Processes indicator parameters and creates output streams -- Parameters block local Trigger; local Period; local first; local source = nil; local hMean = nil; local trend = nil; local hiOsc = nil; local hiOsc2 = nil; local hiPrice = nil; local hiPrice2 = nil; local ewo = nil; -- Streams block local EWN = nil; -- Routine function Prepare() Trigger = instance.parameters.Trigger; Period = instance.parameters.Period; source = instance.source; first = source:first() + Period + 35; ewo = core.indicators:create("EWO", source); local name = profile:id() .. "(" .. source:name() .. ", " .. Trigger .. ", " .. Period .. ")"; instance:name(name); hMean = instance:addInternalStream(0, 0); trend = instance:addInternalStream(0, 0); hiOsc = instance:addInternalStream(0, 0); hiOsc2 = instance:addInternalStream(0, 0); hiPrice = instance:addInternalStream(0, 0); hiPrice2 = instance:addInternalStream(0, 0); EWN = instance:addStream("EWN", core.Line, name, "EWN", instance.parameters.clrEWV, first) EWN:addLevel(0); EWN:addLevel(5); end -- Indicator calculation routine function Update(period, mode) ewo:update(mode); hMean[period] = -100000; trend[period] = 0; hiOsc[period] = -999; hiOsc2[period] = -999; hiPrice[period] = -999; hiPrice2[period] = -999; if period >= first then local wave = EWN[period - 1]; local hmean = hMean[period - 1]; local i = 0; for i = period - 5, period do local newHMean = (source.high + source.low) / 2; if hmean < newHMean then hmean = newHMean; end end local range = core.rangeFrom(period - Period + 1, Period); local lowest = core.min(ewo.DATA, range); local highest = core.max(ewo.DATA, range); local last = ewo.DATA[period]; local oldTrend = trend[period - 1]; local newTrend = oldTrend; if newTrend == 0 then if (last == highest) then newTrend = 1; end if (last == lowest) then newTrend = -1; end end local trigger = Trigger / 100; if (lowest < 0 and newTrend == -1 and last > (-1 * trigger * lowest)) then newTrend = 1; end if (highest > 0 and newTrend == 1 and last < (-1 * trigger * highest)) then newTrend = -1; end local mean = (source.high[period] + source.low[period]) / 2; local osc = hiOsc[period - 1]; local osc2 = hiOsc2[period - 1]; local price = hiPrice[period - 1]; local price2 = hiPrice2[period - 1]; if newTrend == 1 and oldTrend == -1 and last > 0 then osc = last; price = mean; wave = 3; end if wave == 3 then if price < mean then price = mean; end if osc < last then osc = last; end if last <= 0 and oldTrend == 1 then wave = 4; end end if (wave == 4 and mean == hmean and last >= 0) then wave = 5; osc2 = last; price2 = mean; elseif (wave == 5) then if price2 < mean then price2 = mean; end if osc2 < last then osc2 = last; end end if (wave == 5 and osc2 > osc and newTrend == 1) then wave = 3; osc = osc2; price = price2; osc2 = -999; price2 = -999; elseif (wave == 5 and newTrend == -1) then wave = 3; osc = -999; osc2 = -999; price = -999; price2 = -999; end EWN[period] = wave; hMean[period] = hmean; trend[period] = newTrend; hiOsc[period] = osc; hiOsc2[period] = osc2; hiPrice[period] = price; hiPrice2[period] = price2; end end
TK29帖子1楼右侧xm竖版广告90-240
个性签名

韬客社区www.talkfx.co

广告
TK30+TK31帖子一樓廣告
TK30+TK31帖子一樓廣告

本站免责声明:

1、本站所有广告及宣传信息均与韬客无关,如需投资请依法自行决定是否投资、斟酌资金安全及交易亏损风险;

2、韬客是独立的、仅为投资者提供交流的平台,网友发布信息不代表韬客的观点与意思表示,所有因网友发布的信息而造成的任何法律后果、风险与责任,均与韬客无关;

3、金融交易存在极高法律风险,未必适合所有投资者,请不要轻信任何高额投资收益的诱导而贸然投资;投资保证金交易导致的损失可能超过您投入的资金和预期。请您考虑自身的投资经验及风险承担能力,进行合法、理性投资;

4、所有投资者的交易帐户应仅限本人使用,不应交由第三方操作,对于任何接受第三方喊单、操盘、理财等操作的投资和交易,由此导致的任何风险、亏损及责任由投资者个人自行承担;

5、韬客不隶属于任何券商平台,亦不受任何第三方控制,韬客不邀约客户投资任何保证金交易,不接触亦不涉及投资者的任何资金及账户信息,不代理任何交易操盘行为,不向客户推荐任何券商平台,亦不存在其他任何推荐行为。投资者应自行选择券商平台,券商平台的任何行为均与韬客无关。投资者注册及使用韬客即表示其接受和认可上述声明,并自行承担法律风险。

版权所有:韬客外汇论坛 www.talkfx.com 联络我们:[email protected]