bull 发表于 2006-8-17 16:04:00

[转帖]波浪交易系统

<P>//| ICWR indicator |<BR>//| Copyright ?2005, John Lotoski |<BR>//| <a href="mailto:john@fayandjohn.com" target="_blank" >mailto:john@fayandjohn.com</A> |<BR>//| |<BR>//+------------------------------------------------------------------+<BR>#property copyright "Copyright ?2005, <a href="mailto:john@fayandjohn.com" target="_blank" >john@fayandjohn.com</A>"<BR>#property link "<a href="mailto:john@fayandjohn.com" target="_blank" >mailto:john@fayandjohn.com</A>" #property indicator_chart_window<BR>#property indicator_buffers 1<BR>#property indicator_color1 Blue</P>
<P>//---- indicator parameters<BR>extern int ExtDepth=12;<BR>extern int ExtDeviation=5;<BR>extern int ExtBackstep=3;<BR>extern int RequiredWaveHeight=40;</P>
<P>//---- indicator buffers<BR>double ExtMapBuffer[];<BR>double ExtMapBuffer2[];</P>
<P>//+------------------------------------------------------------------+<BR>//| Custom indicator initialization function |<BR>//+------------------------------------------------------------------+<BR>int init()<BR>{<BR>IndicatorBuffers(2);</P>
<P>//---- drawing settings<BR>SetIndexStyle(0,DRAW_SECTION);</P>
<P>//---- indicator buffers mapping<BR>SetIndexBuffer(0,ExtMapBuffer);<BR>SetIndexBuffer(1,ExtMapBuffer2);<BR>SetIndexEmptyValue(0,0.0);<BR>ArraySetAsSeries(ExtMapBuffer,true);<BR>ArraySetAsSeries(ExtMapBuffer2,true);</P>
<P>//---- indicator short name<BR>IndicatorShortName("ICWR("+ExtDepth+","+ExtDeviation+","+ExtBackstep+")");</P>
<P>//---- initialization done<BR>return(0);<BR>}</P>
<P>//+------------------------------------------------------------------+<BR>//| Custor indicator deinitialization function |<BR>//+------------------------------------------------------------------+</P>
<P>int deinit() // Removes all lines and text<BR>{ // from the chart upon removal<BR>// of the indicator<BR>ObjectDelete("ActiveWave");<BR>ObjectDelete("Fibo");<BR>return(0);<BR>}</P>
<P>//+------------------------------------------------------------------+<BR>//| Main function |<BR>//+------------------------------------------------------------------+<BR>int start()<BR>{<BR>int shift,back,lasthighpos,lastlowpos,LastActivePos;<BR>double val,res;<BR>double curlow,curhigh,lasthigh,lastlow,LastActive;</P>
<P>int AWStartPos, AWEndPos;<BR>double AWStart, AWEnd;</P>
<P>double FiboL, FiboH, FiboLC, FiboLR, FiboHR, FiboHC;</P>
<P>for(shift=Bars-ExtDepth; shift&gt;=0; shift--)<BR>{<BR>// The beginning code of this for loop is dedicated<BR>// to finding a low endpoint of a zig-zag<BR>val=Low;<BR>// Start at beginning of data<BR>// - Get low of last depth (12) periods<BR>// - Repeat low search of 12 periods,<BR>// advancing 1 bar every search (for loop)</P>
<P>if(val==lastlow) // If this is not a new low<BR>val=0.0; // - Reset the val marker to dbl 0</P>
<P>else // Otherwise, if it is a new low<BR>{ <BR>lastlow=val; // - Record this new low in lastlow for future reference<BR>if((Low-val)&gt;(ExtDeviation*Point)) <BR>val=0.0; // If the low of the current bar is 6 or<BR>// more pips greater than the lowest low of the last<BR>// depth (12) periods, then reset val to dbl 0.<BR>// Ie: continue the zig because the line is going up</P>
<P>else // Otherwise, if the current low is within 6 pips<BR>{ // of the lowest low of the last 12 bars<BR>for(back=1; back&lt;=ExtBackstep; back++)<BR>{ // Check back 3 bars, and if each value over those<BR>// three bars is greater than the current lowest low,<BR>// then reset the map buffer value to 0 because<BR>// we have a new lower low.<BR>res=ExtMapBuffer;<BR>if((res!=0)&amp;&amp;(res&gt;val)) <BR>ExtMapBuffer=0.0; <BR>}<BR>}<BR>} </P>
<P>ExtMapBuffer=val; // Set our current bar to 0 (continuation of zig) if:<BR>// - A new low has not been reached;<BR>// - The current bar is 6 pips beyond the lowest low<BR>// Set our current bar to the lowest low if:<BR>// - It is within 6 pips of the lowest low and<BR>// and go back over the last three bars and set them<BR>// to continuation of zig as well if they are greater<BR>// than the new lowest value</P>
<P><BR>// Same deal for below, except the case is reversed<BR>// and everything is done in terms of trying to find<BR>// the high zig-zag endpoint<BR>val=High;</P>
<P>if(val==lasthigh) <BR>val=0.0;<BR>else <BR>{<BR>lasthigh=val;<BR>if((val-High)&gt;(ExtDeviation*Point)) <BR>val=0.0;<BR>else<BR>{<BR>for(back=1; back&lt;=ExtBackstep; back++)<BR>{<BR>res=ExtMapBuffer2;<BR>if((res!=0)&amp;&amp;(res&lt;val)) <BR>ExtMapBuffer2=0.0; <BR>} <BR>}<BR>}<BR>ExtMapBuffer2=val;<BR>}</P>
<P>// final cutting <BR>lasthigh=-1; <BR>lasthighpos=-1;<BR>lastlow=-1; <BR>lastlowpos=-1;</P>
<P>for(shift=Bars-ExtDepth; shift&gt;=0; shift--)<BR>{<BR>curlow=ExtMapBuffer;<BR>curhigh=ExtMapBuffer2;</P>
<P>if((curlow==0)&amp;&amp;(curhigh==0)) // Break into the next cycle of the loop<BR>continue; // to try and find the next zig-zap endpoint</P>
<P>if(curhigh!=0) // If there is a current high, then:<BR>{<BR>if(lasthigh&gt;0) // If there was a previous high already:<BR>{<BR>if(lasthigh&lt;curhigh) // - Set the last high to 0 if it is less than the current high<BR>ExtMapBuffer2=0;<BR>else // - Set the current bar to 0 if it is less than the last high<BR>ExtMapBuffer2=0;<BR>}</P>
<P>if(lasthigh&lt;curhigh || lasthigh&lt;0)<BR>{ // If there was no last high or the last high was less than the current high<BR>lasthigh=curhigh; // - Set the current high to be the last high (keep record of it)<BR>lasthighpos=shift; // - Set the current bar to the lasthighpos (keep record of it)<BR>}<BR>lastlow=-1; // Since we just had a new high, reset the lastlow flag<BR>}</P>
<P>if(curlow!=0) // If there is a low, then do the same as above, except for the case of lows instead of highs<BR>{<BR>if(lastlow&gt;0)<BR>{<BR>if(lastlow&gt;curlow) <BR>ExtMapBuffer=0;<BR>else <BR>ExtMapBuffer=0;<BR>}</P>
<P>if((curlow&lt;lastlow)||(lastlow&lt;0))<BR>{<BR>lastlow=curlow;<BR>lastlowpos=shift;<BR>} <BR>lasthigh=-1;<BR>}<BR>}</P>
<P>for(shift=Bars-1; shift&gt;=0; shift--)<BR>{ // Go through all the bars<BR>if(shift&gt;=Bars-ExtDepth) // If we are not at the beginning comparison bars,<BR>ExtMapBuffer=0.0; // then set the low buffer to 0<BR>else<BR>{ // Otherwise:<BR>res=ExtMapBuffer2; // - If the current bar has a high, set the low<BR>if(res!=0.0) // buffer to contain the high<BR>ExtMapBuffer=res;<BR>} // Looks like this function brings the highs into the lows<BR>} // so that all the zig-zags can be drawn from one function</P>
<P>LastActive = -1;<BR>LastActivePos = -1;</P>
<P>for(shift=0; shift&lt;=Bars-ExtDepth; shift++)<BR>{<BR>if(ExtMapBuffer!=0.0)<BR>{<BR>if(LastActive &gt; 0)<BR>{<BR>if(MathAbs(LastActive - ExtMapBuffer) &gt;= RequiredWaveHeight*Point)<BR>{<BR>AWStartPos = shift;<BR>AWStart = ExtMapBuffer;<BR>AWEndPos = LastActivePos;<BR>AWEnd = LastActive;</P>
<P>if(ObjectFind("ActiveWave") != 0)<BR>{<BR>ObjectCreate("ActiveWave", OBJ_TREND, 0, Time, AWStart, Time, AWEnd);<BR>ObjectSet("ActiveWave", OBJPROP_STYLE, STYLE_SOLID);<BR>ObjectSet("ActiveWave", OBJPROP_COLOR, Red); <BR>ObjectSet("ActiveWave", OBJPROP_WIDTH, 3);<BR>ObjectSet("ActiveWave", OBJPROP_RAY, false); <BR>}<BR>else<BR>{<BR>ObjectMove("ActiveWave", 0, Time, AWStart);<BR>ObjectMove("ActiveWave", 1, Time, AWEnd);<BR>}</P>
<P>if(AWStart &lt; AWEnd)<BR>{<BR>FiboL = AWStart;<BR>FiboH = AWEnd;<BR>}<BR>else<BR>{<BR>FiboL = AWEnd;<BR>FiboH = AWStart;<BR>}</P>
<P>FiboLC = FiboL + (FiboH - FiboL)*0.25;<BR>FiboLR = FiboL + (FiboH - FiboL)*0.382;<BR>FiboHR = FiboL + (FiboH - FiboL)*0.618;<BR>FiboHC = FiboL + (FiboH - FiboL)*0.75;</P>
<P><BR>if(ObjectFind("Fibo") != 0)<BR>{<BR>ObjectCreate("Fibo", OBJ_FIBO, 0, Time, AWStart, Time, AWEnd);<BR>ObjectSet("Fibo", OBJPROP_STYLE, STYLE_SOLID);<BR>ObjectSet("Fibo", OBJPROP_COLOR, Green); <BR>ObjectSet("Fibo", OBJPROP_WIDTH, 2);<BR>ObjectSet("Fibo", OBJPROP_FIBOLEVELS, 6);<BR>/* ObjectSet("Fibo", OBJPROP_FIRSTLEVEL+0, FiboL);<BR>ObjectSet("Fibo", OBJPROP_FIRSTLEVEL+1, FiboLC);<BR>ObjectSet("Fibo", OBJPROP_FIRSTLEVEL+2, FiboLR);<BR>ObjectSet("Fibo", OBJPROP_FIRSTLEVEL+3, FiboHR);<BR>ObjectSet("Fibo", OBJPROP_FIRSTLEVEL+4, FiboHC);<BR>ObjectSet("Fibo", OBJPROP_FIRSTLEVEL+6, FiboH); */</P>
<P>ObjectSet("Fibo", OBJPROP_FIRSTLEVEL+0, 0);<BR>ObjectSet("Fibo", OBJPROP_FIRSTLEVEL+1, 0.25);<BR>ObjectSet("Fibo", OBJPROP_FIRSTLEVEL+2, 0.382);<BR>ObjectSet("Fibo", OBJPROP_FIRSTLEVEL+3, 0.618);<BR>ObjectSet("Fibo", OBJPROP_FIRSTLEVEL+4, 0.75);<BR>ObjectSet("Fibo", OBJPROP_FIRSTLEVEL+5, 1);<BR>}<BR>else<BR>{<BR>ObjectMove("Fibo", 0, Time, AWStart);<BR>ObjectMove("Fibo", 1, Time, AWEnd);<BR>}<BR>break;<BR>}<BR>}<BR>LastActive = ExtMapBuffer;<BR>LastActivePos = shift;<BR>}<BR>}<BR>}</P>

黄金矿工 发表于 2013-6-30 23:34:18


佛下山游说佛法,在一家店铺里看到一尊释迦牟尼像,青铜所铸,形体逼真,神态安然,佛大悦。若能带回寺里,开启其佛光,记世供奉,真乃一件幸事,可店铺老板要价5000元,分文不能少,加上见佛如此钟爱它,更加咬定原价不放。
佛回到寺里对众僧谈起此事,众僧很着急,问佛打算以多少钱买下它。佛说:“500元足矣。”众僧唏嘘不止:“那怎么可能?”佛说:“天理犹存,当有办法,万丈红尘,芸芸众生,欲壑难填,得不偿失啊,我佛慈悲,普度众生,当让他仅仅赚到这500元!”
“怎样普度他呢?”众僧不解地问。
“让他忏悔。”佛笑答。众僧更不解了。佛说:“只管按我的吩咐去做就行了。”
第一个弟子下山去店铺里和老板侃价,弟子咬定4500元,未果回山。
第二天,第二个弟子下山去和老板侃价,咬定4000元不放,亦未果回山。
就这样,直到最后一个弟子在第九天下山时所给的价已经低到了200元。眼见着一个个买主一天天下去、一个比一个价给得低,老板很是着急,每一天他都后悔不如以前一天的价格卖给前一个人了,他深深地怨责自己太贪。到第十天时,他在心里说,今天若再有人来,无论给多少钱我也要立即出手。
第十天,佛亲自下山,说要出500元买下它,老板高兴得不得了———竟然反弹到了500元!当即出手,高兴之余另赠佛龛台一具。佛得到了那尊铜像,谢绝了龛台,单掌作揖笑曰:“YUWANG无边,凡事有度,一切适可而止啊!善哉,善哉……”

gracerun 发表于 2013-12-28 14:58:48

有没有觉得我很帅,什么你敢说没有,好吧,其实我是漂亮

你跟我的不同就是我手中有这一把神器[帖帖不休],秒你无压力.

黄金圣旗 发表于 2006-9-5 23:13:00

谢谢

lzy 发表于 2006-11-6 15:28:00

谢谢

汇虫 发表于 2007-2-16 09:55:00

好,呵呵

bull 发表于 2007-2-16 11:17:00

这是一个国外的源码,写的还是很工整的

Gemini 发表于 2007-3-21 10:46:00

<P>麻烦 版主 请把这个作成 MQ4 格式或者 EX4 可以吗 </P>
<P>小可实在是不会 使用多谢多谢 </P>

bull 发表于 2007-3-21 11:09:00

拷贝上面程序,存成mq4文件,编译后就可以使用了,上面的就是源码

panda77 发表于 2007-4-18 11:17:00

<P>老大,这个指标有没有说明啊?</P>
<P>thank u</P>

bull 发表于 2007-4-18 14:50:00

<P>没见到过说明。。。</P>

fgg 发表于 2007-5-3 16:24:00

<P>感激</P>

wyf3587 发表于 2007-5-7 16:50:00

<P>估计是个好插件可就是不会用,可惜!</P>

wyf3587 发表于 2007-5-7 17:37:00

<P>我不会转成MQ也不会编译,老大请您把它搞成现成的文件格式好吗,我下载后加到MT4里会的.</P>
<P>   谢谢您了老大</P>

bull 发表于 2007-5-7 23:46:00

拷贝后,打开MetaEditor新建一个Indicator,源码拷进去,点击Complie进行编译,然后到MT4里面自定义指标里面找到这个指标加载到土上就可以了

wyf3587 发表于 2007-8-5 16:25:00

问了好多人了,我还是搞不出来.

bull 发表于 2007-8-5 19:58:00

<P>拷贝发布的源码,保存成bolang.mq4文件,将bolang.mq4文件拷贝到MT4目录下experts\indicators目录下,双击打开它,这是将会自动启动MetaEditor装载这个源程序,在打开的界面顶部菜单上,点击“编译”。然后MT4,可以在“自定义指标”下面发现bolang的指标名字,将其加载到你想应用的K线图标上就可以了!</P>
页: [1] 2 3 4 5 6 7 8 9 10
查看完整版本: [转帖]波浪交易系统