论坛全局菜单下方 - TICKMILL 285X70论坛全局菜单下方 - ThinkMarkets285X70论坛全局菜单下方 - 荔枝返现285X70论坛全局菜单下方 -  icmarkets285X70
查看:874回复:1
草龙
注册时间2004-12-17
[MT4-EA]在主图显示的RSi指标
楼主发表于:2014-01-24 01:31只看该作者倒序浏览
1楼 电梯直达
电梯直达
RSi的主图指标 这个需要大家在后期的使用中慢慢体会了 思路不错 但是我感觉用处不大 mt4指标类型:震荡指标 是否能用在mt4手机版上:否 是否含有未来函数:否 //+---------------------------------------------------------------------------------------------+ //| Rsi_R2_Opt_Indicator.mq4 | //| Copyright ? 2007 , http://finance.groups.yahoo.com/group/MetaTrader_Experts_and_Indicators/ | //| http://finance.groups.yahoo.com/group/MetaTrader_Experts_and_Indicators/ | //+---------------------------------------------------------------------------------------------+ #property copyright "Copyright ? 2007 , http://finance.groups.yahoo.com/group/MetaTrader_Experts_and_Indicators/" #property link "http://finance.groups.yahoo.com/group/MetaTrader_Experts_and_Indicators/" //+------------------------------------------------------------------------------------------------------------+ //| http://www.tradingmarkets.com/.site/stocks/commentary/editorial/The-Improved-R2-Strategy.cfm | //| introduced to http://finance.groups.yahoo.com/group/MetaTrader_Experts_and_Indicators/ | //| by Peter , blackprinzze , [email protected] , for a complimentary build in .mq4 | //| built by transport_david | //| This version should be able to match the AnyMA_RSI_R2_EA_Opt.mq4 expert ( Peter , Bluto , Robert , Loren ) | | //+------------------------------------------------------------------------------------------------------------+ #property indicator_chart_window #property indicator_buffers 5 #property indicator_color1 Yellow #property indicator_color2 Red #property indicator_color3 Lime #property indicator_color4 LightGray #property indicator_color5 Pink extern bool Play_Alert = false; extern string s0 = "---------------"; extern string t0 = "Hull Moving Average Filter"; extern bool Use_Hull_Filter = true; extern int Hull_Periods = 200; extern int Hull_Applied_Price = 0; extern int Hull_Separation_Pips= 1; extern string s1 = "---------------"; extern string t1 = "Trend Moving Average"; extern int Ma_Periods = 200; extern int Ma_Type = 0; extern int Ma_Applied_Price = 0; extern string s2 = "---------------"; extern int RsiPeriods = 2; extern int Rsi_Applied_Price = 0; extern string s3 = "---------------"; extern int BuyIfDay1RsiBelow = 65; // 1st day of tracking must be < this setting extern int BuyIfDay3RsiBelow = 65; // 3rd day must be < this setting extern string s4 = "---------------"; extern int SellIfDay1RsiAbove = 35; // 1st day of tracking must be > this setting extern int SellIfDay3RsiAbove = 35; // 3rd day must be > this setting extern string s5 = "---------------"; extern int CloseBuyIfRsiAbove = 75; extern int CloseSellIfRsiBelow = 25; extern string s6 = "---------------"; extern int ShowBars = 10000; double Trend_Ma; double Sell_Arrow; double Buy_Arrow; double Close_Trade_Marker; double Calc; double Hull_MA; double prevtime; double goober; //+------------------------------------------------------------------+ //| Custom indicator initialization function | //+------------------------------------------------------------------+ int init() { //---- indicators IndicatorBuffers(6); SetIndexEmptyValue(0,0.0); SetIndexStyle(0,DRAW_LINE,STYLE_SOLID,1); SetIndexBuffer(0,Trend_Ma); SetIndexLabel(0,"Trend_Ma ( "+Ma_Periods+" )"); SetIndexEmptyValue(1,0.0); SetIndexStyle(1,DRAW_ARROW,STYLE_SOLID,0); SetIndexArrow(1,234); SetIndexBuffer(1,Sell_Arrow); SetIndexLabel(1,"R2_Sell_Arrow"); SetIndexEmptyValue(2,0.0); SetIndexStyle(2,DRAW_ARROW,STYLE_SOLID,0); SetIndexArrow(2,233); SetIndexBuffer(2,Buy_Arrow); SetIndexLabel(2,"R2_Buy_Arrow"); SetIndexEmptyValue(3,0.0); SetIndexStyle(3,DRAW_ARROW,STYLE_SOLID,0); SetIndexArrow(3,172); SetIndexBuffer(3,Close_Trade_Marker); SetIndexLabel(3,"R2_Close_Trade_Marker"); SetIndexEmptyValue(4,0.0); SetIndexStyle(4,DRAW_LINE,STYLE_SOLID,1); SetIndexBuffer(4,Hull_MA); SetIndexLabel(4,"Hull_Ma_Filter ( "+Hull_Periods+" )"); SetIndexEmptyValue(5,0.0); SetIndexBuffer(5,Calc); //---- return(0); } //+------------------------------------------------------------------+ //| Custom indicator deinitialization function | //+------------------------------------------------------------------+ int deinit() { //---- //---- return(0); } //+------------------------------------------------------------------+ //| Custom indicator iteration function | //+------------------------------------------------------------------+ int start() { //---- int shift = ShowBars; if (ShowBars >= Bars) ShowBars = Bars-1; for ( shift = ShowBars; shift >= 0; shift-- ) { double Exp = 2; double firstwma = iMA(Symbol(),0,MathFloor(Hull_Periods/2),0,MODE_LWMA,Hull_Applied_Price,shift); double secondwma = iMA(Symbol(),0,Hull_Periods,0,MODE_LWMA,Hull_Applied_Price,shift); Calc[shift] = (Exp*firstwma)-secondwma; } if (Use_Hull_Filter) { for ( shift = ShowBars; shift >= 0; shift-- ) { double Hulldifference = (iMAOnArray(Calc,0,MathFloor(MathSqrt(Hull_Periods)),0,MODE_LWMA,shift+1) - iMAOnArray(Calc,0,MathFloor(MathSqrt(Hull_Periods)),0,MODE_LWMA,shift+2)); Hull_MA[shift] = iMAOnArray(Calc,0,MathFloor(MathSqrt(Hull_Periods)),0,MODE_LWMA,shift); Trend_Ma[shift] = iMA( Symbol(), 0, Ma_Periods, 0, Ma_Type, Ma_Applied_Price, shift); if (prevtime != Time[0]) { RefreshRates(); prevtime=Time[0]; } double Day1 = iRSI(Symbol(),0,RsiPeriods,Rsi_Applied_Price,shift+3); double Day2 = iRSI(Symbol(),0,RsiPeriods,Rsi_Applied_Price,shift+2); double Day3 = iRSI(Symbol(),0,RsiPeriods,Rsi_Applied_Price,shift+1); double Today = iRSI(Symbol(),0,RsiPeriods,Rsi_Applied_Price,shift); //- Sell Arrows --- if ( (iClose(Symbol(),0,shift+1) < Trend_Ma[shift+1]) && (Day1 > SellIfDay1RsiAbove) && (Day2 > Day1) && (Day3 > Day2) && (Day3 > SellIfDay3RsiAbove) && (Hulldifference <= -Hull_Separation_Pips*Point) ) Sell_Arrow[shift] = iHigh(Symbol(),0,shift) + (20*Point);//High arrow Sell //- Buy Arrows --- if ( (iClose(Symbol(),0,shift+1) > Trend_Ma[shift+1]) && (Day1 < BuyIfDay1RsiBelow) && (Day2 < Day1) && (Day3 < Day2) && (Day3 < BuyIfDay3RsiBelow) && (Hulldifference >= Hull_Separation_Pips*Point) ) Buy_Arrow[shift] = iLow(Symbol(),0,shift) - (20*Point);//Low arrow Buy //- Close Trades Marker --- if (Today < CloseSellIfRsiBelow) Close_Trade_Marker[shift] = iLow(Symbol(),0,shift) - (50*Point); if (Today > CloseBuyIfRsiAbove) Close_Trade_Marker[shift] = iHigh(Symbol(),0,shift) + (50*Point); } } if (!Use_Hull_Filter) { for ( shift = ShowBars; shift >= 0; shift-- ) { Hull_MA[shift] = 0; Trend_Ma[shift] = iMA( Symbol(), 0, Ma_Periods, 0, Ma_Type, Ma_Applied_Price, shift); if (prevtime != Time[0]) { RefreshRates(); prevtime=Time[0]; } Day1 = iRSI(Symbol(),0,RsiPeriods,Rsi_Applied_Price,shift+3); Day2 = iRSI(Symbol(),0,RsiPeriods,Rsi_Applied_Price,shift+2); Day3 = iRSI(Symbol(),0,RsiPeriods,Rsi_Applied_Price,shift+1); Today = iRSI(Symbol(),0,RsiPeriods,Rsi_Applied_Price,shift); //- Sell Arrows --- if ( (iClose(Symbol(),0,shift+1) < Trend_Ma[shift+1]) && (Day1 > SellIfDay1RsiAbove) && (Day2 > Day1) && (Day3 > Day2) && (Day3 > SellIfDay3RsiAbove) ) Sell_Arrow[shift] = iHigh(Symbol(),0,shift) + (20*Point); // High arrow Sell //- Buy Arrows --- if ( (iClose(Symbol(),0,shift+1) > Trend_Ma[shift+1]) && (Day1 < BuyIfDay1RsiBelow) && (Day2 < Day1) && (Day3 < Day2) && (Day3 < BuyIfDay3RsiBelow) ) Buy_Arrow[shift] = iLow(Symbol(),0,shift) - (20*Point); // Low arrow Buy //- Close Trades Marker --- if (Today < CloseSellIfRsiBelow) Close_Trade_Marker[shift] = iLow(Symbol(),0,shift) - (50*Point); if (Today > CloseBuyIfRsiAbove) Close_Trade_Marker[shift] = iHigh(Symbol(),0,shift) + (50*Point); } } if (Play_Alert) { int SignalBar = 0; if ( (Close_Trade_Marker[0] != 0) && (goober < Time[0]) ) { //Alert("Close_Trade_Marker , "+Symbol()+" , M_"+Period()+" , Bid = ",Bid," , Hour = ",Hour()," , Minute = ",Minute()," ."); PlaySound("email.wav"); goober = Time[0]; } if ( (Sell_Arrow[0] != 0) && (goober < Time[0]) ) { //Alert("R2_Sell Arrow , "+Symbol()+" , M_"+Period()+" , Bid = ",Bid," , Hour = ",Hour()," , Minute = ",Minute()," ."); PlaySound("email.wav"); goober = Time[0]; } if ( (Buy_Arrow[0] != 0) && (goober < Time[0]) ) { //Alert("R2_Buy Arrow , "+Symbol()+" , M_"+Period()+" , Ask = ",Ask," , Hour = ",Hour()," , Minute = ",Minute()," ."); PlaySound("email.wav"); goober = Time[0]; } } //---- return(0); } //+------------------------------------------------------------------+AnyMA_Rsi_R2_Indi_Opt.jpgAnyMA_Rsi_R2_Indi_Opt.jpg
TK29帖子1楼右侧xm竖版广告90-240
个性签名

阅尽天下指标
搬砖开始,始于2014

广告
TK30+TK31帖子一樓廣告
TK30+TK31帖子一樓廣告
HONGCHUN
注册时间2014-06-19
发表于:2015-06-17 10:05只看该作者
2楼
谢谢楼主,辛苦了

本站免责声明:

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

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

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

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

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

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