论坛全局菜单下方 - TICKMILL 285X70论坛全局菜单下方 - ThinkMarkets285X70论坛全局菜单下方 - 荔枝返现285X70论坛全局菜单下方 -  icmarkets285X70
查看:1148回复:10
草龙
注册时间2004-12-17
[MT4指标]变色RSI指标
楼主发表于:2014-02-28 02:00只看该作者倒序浏览
1楼 电梯直达
电梯直达
附图指标, mt4指标类型:震荡指标 是否能用在mt4手机版上:否 是否含有未来函数:无 //+------------------------------------------------------------------+ //| Color RSI.mq4 | //| mladen | //| | //+------------------------------------------------------------------+ #property copyright "mladen" #property link "" #property indicator_separate_window #property indicator_buffers 3 #property indicator_minimum 0 #property indicator_maximum 100 #property indicator_color1 DimGray #property indicator_color2 Red #property indicator_color3 LimeGreen #property indicator_width2 2 #property indicator_width3 2 //---- input parameters // // // // extern int RSIPeriod = 5; extern string note1 = "0=close;1=open;2=hi;3=low"; extern string note2 = "4=median;5=typical;6=weighted"; extern int PriceType = 0; extern string note3 = "Chart Time Frame"; extern string note4 = "1=M1, 5=M5, 15=M15, 30=M30"; extern string note5 = "60=H1, 240=H4, 1440=D1"; extern string note6 = "10080=W1, 43200=MN1"; extern string timeFrame = "Current time frame"; extern int overBought = 80; extern int overSold = 20; extern bool showArrows = false; extern bool alertsOn = false; extern bool alertsMessage = false; extern bool alertsSound = false; extern bool alertsEmail = false; //---- buffers // // // // // double RSIBuffer; double Upper; double Lower; // // // // // int TimeFrame; datetime TimeArray; int maxArrows; //+------------------------------------------------------------------+ //| Custom indicator initialization function | //+------------------------------------------------------------------+ int init() { SetIndexBuffer(0,RSIBuffer); SetIndexBuffer(1,Upper); SetIndexBuffer(2,Lower); SetIndexLabel(0,"RSI"); SetIndexLabel(1,NULL); SetIndexLabel(2,NULL); // // // // // TimeFrame = stringToTimeFrame(timeFrame); string shortName = "RSI ("+TimeFrameToString(TimeFrame)+","+RSIPeriod+","+PriceTypeToString(PriceType); if (overBought < overSold) overBought = overSold; if (overBought < 100) shortName = shortName+","+overBought; if (overSold > 0) shortName = shortName+","+overSold; IndicatorShortName(shortName+")"); return(0); } // // // // // int deinit() { DeleteArrows(); return(0); } //+------------------------------------------------------------------+ //| Custom indicator iteration function | //+------------------------------------------------------------------+ int start() { int counted_bars=IndicatorCounted(); int limit; int i,y; if(counted_bars<0) return(-1); limit=Bars-counted_bars; ArrayCopySeries(TimeArray ,MODE_TIME ,NULL,TimeFrame); // // // // // for(i=0,y=0; i=0; i--) { if (RSIBuffer > overBought) { Upper = RSIBuffer; Upper[i+1] = RSIBuffer[i+1]; } else { Upper = EMPTY_VALUE; if (Upper[i+2] == EMPTY_VALUE) Upper[i+1] = EMPTY_VALUE; } if (RSIBuffer < overSold) { Lower = RSIBuffer; Lower[i+1] = RSIBuffer[i+1]; } else { Lower = EMPTY_VALUE; if (Lower[i+2] == EMPTY_VALUE) Lower[i+1] = EMPTY_VALUE; } } // // // // // if (showArrows) for (i=0; ioverBought && RSIBuffer[i+1]overSold) DrawArrow(i,"down"); } if (alertsOn) { if (RSIBuffer[0]>overBought && RSIBuffer[1]overSold) doAlert(overBought+" line crossed down"); } // // // // // return(0); } //+------------------------------------------------------------------+ //+------------------------------------------------------------------+ // // // // // void DrawArrow(int i,string type) { maxArrows++; ObjectCreate("RSISignal"+maxArrows,OBJ_ARROW,0,Time,0); if (type=="up") { ObjectSet("RSISignal"+maxArrows,OBJPROP_PRICE1,High+(8*Point)); ObjectSet("RSISignal"+maxArrows,OBJPROP_ARROWCODE,242); ObjectSet("RSISignal"+maxArrows,OBJPROP_COLOR,Red); } else { ObjectSet("RSISignal"+maxArrows,OBJPROP_PRICE1,Low-(6*Point)); ObjectSet("RSISignal"+maxArrows,OBJPROP_ARROWCODE,241); ObjectSet("RSISignal"+maxArrows,OBJPROP_COLOR,LimeGreen); } } void DeleteArrows() { while(maxArrows>0) { ObjectDelete("RSISignal"+maxArrows); maxArrows--; } } //+------------------------------------------------------------------+ //| | //+------------------------------------------------------------------+ void doAlert(string doWhat) { static string previousAlert="nothing"; static datetime previousTime; string message; if (previousAlert != doWhat || previousTime != Time[0]) { previousAlert = doWhat; previousTime = Time[0]; // // // // // message = StringConcatenate(Symbol()," at ",TimeToStr(TimeLocal(),TIME_SECONDS)," RSI ",doWhat); if (alertsMessage) Alert(message); if (alertsSound) PlaySound("alert2.wav"); if (alertsEmail) SendMail(StringConcatenate(Symbol()," RSI crossing"),message); } } //+------------------------------------------------------------------+ //+------------------------------------------------------------------+ // // // // // string PriceTypeToString(int pt) { string answer; switch(pt) { case 0: answer = "Close" ; break; case 1: answer = "Open" ; break; case 2: answer = "High" ; break; case 3: answer = "Low" ; break; case 4: answer = "Median" ; break; case 5: answer = "Typical" ; break; case 6: answer = "Wighted" ; break; default: answer = "Invalid price field requested"; Alert(answer); } return(answer); } int stringToTimeFrame(string tfs) { int tf=0; tfs = StringUpperCase(tfs); if (tfs=="M1" || tfs=="1") tf=PERIOD_M1; if (tfs=="M5" || tfs=="5") tf=PERIOD_M5; if (tfs=="M15"|| tfs=="15") tf=PERIOD_M15; if (tfs=="M30"|| tfs=="30") tf=PERIOD_M30; if (tfs=="H1" || tfs=="60") tf=PERIOD_H1; if (tfs=="H4" || tfs=="240") tf=PERIOD_H4; if (tfs=="D1" || tfs=="1440") tf=PERIOD_D1; if (tfs=="W1" || tfs=="10080") tf=PERIOD_W1; if (tfs=="MN" || tfs=="43200") tf=PERIOD_MN1; if (tf= 0) { char = StringGetChar(s, lenght); // // // // // if((char > 96 && char < 123) || (char > 223 && char < 256)) s = StringSetChar(s, lenght, char - 32); else if(char > -33 && char < 0) s = StringSetChar(s, lenght, char + 224); // // // // // lenght--; } // // // // // return(s); }Color%20RSI.jpgColor%20RSI.jpg
TK29帖子1楼右侧xm竖版广告90-240
个性签名

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

广告
TK30+TK31帖子一樓廣告
TK30+TK31帖子一樓廣告
netstray
注册时间2016-12-14
发表于:2016-12-15 11:50只看该作者
2楼
缺钱,灌水赚通宝,谢谢分享!!
myob
注册时间2017-04-02
发表于:2017-04-05 17:58只看该作者
3楼
缺钱,灌水赚通宝,谢谢分享!!
小风扇
注册时间2016-05-17
发表于:2017-04-10 03:19只看该作者
4楼
加载后可先模拟再交易
个性签名

韬客社区www.talkfx.co

小风扇
注册时间2016-05-17
小风扇
注册时间2016-05-17
小风扇
注册时间2016-05-17
发表于:2017-04-10 03:20只看该作者
7楼
加载后可先模拟再交易
小风扇
注册时间2016-05-17
小风扇
注册时间2016-05-17
发表于:2017-04-10 03:21只看该作者
9楼
加载后可先模拟再交易
个性签名

韬客社区www.talkfx.co

hackbos
注册时间2017-06-15
Pzxzx
注册时间2017-08-06
发表于:2017-08-07 05:59只看该作者
11楼
谢谢分享~~~~~~~~~~~
个性签名

韬客社区www.talkfx.co

广告
论坛谏言--外汇交易不应是你投资的全部,交易外汇也不应是你生活的全部

本站免责声明:

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

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

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

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

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

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