论坛全局菜单下方 - TICKMILL 285X70论坛全局菜单下方 - ThinkMarkets285X70论坛全局菜单下方 - 荔枝返现285X70论坛全局菜单下方 -  icmarkets285X70
查看:1033回复:1
草龙
注册时间2004-12-17
[MT4指标]Indicator_Strength震荡趋势指标
楼主发表于:2014-05-14 10:42只看该作者倒序浏览
1楼 电梯直达
电梯直达
附图指标,Indicator_Strength震荡趋势指标 mt4指标类型:趋势指标 是否能用在mt4手机版上:否 是否含有未来函数:无 //+------------------------------------------------------------------+ //| Indicator_Strength.mq4 | //| DesO'Regan | //| mailto: [email protected] | //+------------------------------------------------------------------+ // =================================================================================== // This indicator displays, in histogram form, the difference between either: // 1. a fast and slow moving average (MA_Power=true) // 2. main and signal lines of a MACD indicator (MACD_Power=true) // 3. main and signal lines of a stochastic indicator (Stochastic_Power=true) // Only one option can be choosen (default is moving average) at any one time, // although another indicator can be opened for another option. // This indicator also displays average levels of difference values above and // below the zero line. This feature can be disabled (Set_Levels=false). // This indicator is meant to gauge the power/strength behind a price move. // =================================================================================== #property copyright "DesORegan" #property link "mailto: [email protected]" #property indicator_separate_window #property indicator_buffers 2 //two buffers, one for above zero line, one for below #property indicator_color1 Green // above zero line color #property indicator_color2 Red // below zero line color //---- input parameters extern bool MA_Power=true; // MA Indicator Strength ON/OFF extern bool MACD_Power=false; // MACD Indicator Strength ON/OFF extern bool Stochastic_Power=false; // Stochastic Indicator Strength ON/OFF extern int MA_Fast=13; // default indicator values extern int MA_Slow=21; extern int MACD_Fast=12; extern int MACD_Slow=26; extern int MACD_Signal=9; extern int Sto_K=14; extern int Sto_D=3; extern int Sto_Slowing=3; extern int Back_Bars=500; // history limit extern bool Set_Levels=true; // average pos/neg indicator levels ON/OFF //---- buffers double Power_Buffer_Pos; // Pos indicator values double Power_Buffer_Neg; // Neg indicator values //+------------------------------------------------------------------+ //| Custom indicator initialization function | //+------------------------------------------------------------------+ int init() { //==================================== // Checking Inputs & Set Window Labels //==================================== if (MA_Power == true && MACD_Power == false && Stochastic_Power == false) { IndicatorShortName("Moving Average Strength ("+DoubleToStr(MA_Fast,0)+","+DoubleToStr(MA_Slow,0)+")"); } else if (MA_Power == false && MACD_Power == true && Stochastic_Power == false) { IndicatorShortName("MACD Strength ("+DoubleToStr(MACD_Fast,0)+","+DoubleToStr(MACD_Slow,0)+","+DoubleToStr(MACD_Signal,0)+")"); } else if (MA_Power == false && MACD_Power == false && Stochastic_Power == true) { IndicatorShortName("Stochastic Strength ("+DoubleToStr(Sto_K,0)+","+DoubleToStr(Sto_D,0)+","+DoubleToStr(Sto_Slowing,0)+")"); } else if (MA_Power == false && MACD_Power == false && Stochastic_Power == false) { IndicatorShortName("Invalid Parameters"); Alert("One Power Indicator must be set to True"); return; } else { IndicatorShortName("Invalid Parameters"); Alert("Only one Power Indicator can be set to True"); return; } //================= // Indicator Setup //================= SetIndexStyle(0,DRAW_HISTOGRAM,EMPTY,2); // Pos indicator type and width SetIndexBuffer(0,Power_Buffer_Pos); //binds buffer to Power_Buffer_Pos SetIndexDrawBegin(0, Back_Bars); // not sure if necessary but is used to set starting point of indicator (bars back) SetIndexLabel(0, "Positive Strength"); // sets mouse-over label SetIndexStyle(1,DRAW_HISTOGRAM,EMPTY,2); // Neg indicator type and width SetIndexBuffer(1,Power_Buffer_Neg); //binds buffer to Power_Buffer_Neg SetIndexDrawBegin(1, Back_Bars); // not sure if necessary but is used to set starting point of indicator (bars back) SetIndexLabel(1, "Negative Strength"); // sets mouse-over label return(0); } //+------------------------------------------------------------------+ //| Custom indicator deinitialization function | //+------------------------------------------------------------------+ int deinit() { return(0); } //+------------------------------------------------------------------+ //| Custom indicator iteration function | //+------------------------------------------------------------------+ int start() { //====================== // variable declarations //====================== int limit; // not used!! int Bar_Index=0; // bar tracker int Pos_Bar_Count=0; // pos bar count (needed for averaging) int Neg_Bar_Count=0; // neg bar count (needed for averaging) double Total_Pos_Power=0; // stores total pos power/strength value (needed for averaging) double Average_Pos_Power=0; // current average pos power/strength value double Total_Neg_Power=0; // stores total neg power/strength value (needed for averaging) double Average_Neg_Power=0; // current average neg power/strength value int counted_bars=IndicatorCounted(); // not used!! (yet) for (Bar_Index = Back_Bars; Bar_Index >=0; Bar_Index--) // MAIN INDICATOR FOR LOOP { //======================= // Indicator Calculations //======================= double MA_Fast1 = iMA(Symbol(),0,MA_Fast,0,MODE_EMA,PRICE_CLOSE,Bar_Index); double MA_Slow1 = iMA(Symbol(),0,MA_Slow,0,MODE_EMA,PRICE_CLOSE,Bar_Index); double MA_Diff = MA_Fast1 - MA_Slow1; double MACD_Main = iMACD(Symbol(),0,MACD_Fast,MACD_Slow,MACD_Signal,PRICE_CLOSE,MODE_MAIN,Bar_Index); double MACD_Signal1 = iMACD(Symbol(),0,MACD_Fast,MACD_Slow,MACD_Signal,PRICE_CLOSE,MODE_SIGNAL,Bar_Index); double MACD_Diff = MACD_Main - MACD_Signal1; double Sto_Main = iStochastic(Symbol(),0,Sto_K,Sto_D,Sto_Slowing,MODE_EMA,0,MODE_MAIN,Bar_Index); double Sto_Signal = iStochastic(Symbol(),0,Sto_K,Sto_D,Sto_Slowing,MODE_EMA,0,MODE_SIGNAL,Bar_Index); double Sto_Diff = Sto_Main - Sto_Signal; //================= // MA Strength //================= if (MA_Power == true && MA_Diff > 0) { Power_Buffer_Pos[Bar_Index] = MA_Diff; // pos indicator value Power_Buffer_Neg[Bar_Index] = 0; // neg indicator value Pos_Bar_Count = Pos_Bar_Count + 1; Total_Pos_Power = Total_Pos_Power + MA_Diff; } else if (MA_Power == true && MA_Diff < 0) { Power_Buffer_Pos[Bar_Index] = 0; // pos indicator value Power_Buffer_Neg[Bar_Index] = MA_Diff; // neg indicator value Neg_Bar_Count = Neg_Bar_Count + 1; Total_Neg_Power = Total_Neg_Power + MA_Diff; } else if (MA_Power == true && MA_Diff == 0) { Power_Buffer_Pos[Bar_Index] = 0; Power_Buffer_Neg[Bar_Index] = 0; } //================= // MACD Strength //================= if (MACD_Power == true && MACD_Diff > 0) { Power_Buffer_Pos[Bar_Index] = MACD_Diff; // pos indicator value Power_Buffer_Neg[Bar_Index] = 0; // neg indicator value Pos_Bar_Count = Pos_Bar_Count + 1; Total_Pos_Power = Total_Pos_Power + MACD_Diff; } else if (MACD_Power == true && MACD_Diff < 0) { Power_Buffer_Pos[Bar_Index] = 0; // pos indicator value Power_Buffer_Neg[Bar_Index] = MACD_Diff; // neg indicator value Neg_Bar_Count = Neg_Bar_Count + 1; Total_Neg_Power = Total_Neg_Power + MACD_Diff; } else if (MACD_Power == true && MACD_Diff == 0) { Power_Buffer_Pos[Bar_Index] = 0; Power_Buffer_Neg[Bar_Index] = 0; } //==================== // Stochastic Strength //==================== if (Stochastic_Power == true && Sto_Diff > 0) { Power_Buffer_Neg[Bar_Index] = 0; // neg indicator value Power_Buffer_Pos[Bar_Index] = Sto_Diff; // pos indicator value Pos_Bar_Count = Pos_Bar_Count + 1; Total_Pos_Power = Total_Pos_Power + Sto_Diff; } else if (Stochastic_Power == true && Sto_Diff < 0) { Power_Buffer_Pos[Bar_Index] = 0; // pos indicator value Power_Buffer_Neg[Bar_Index] = Sto_Diff; // neg indicator value Neg_Bar_Count = Neg_Bar_Count + 1; Total_Neg_Power = Total_Neg_Power + Sto_Diff; } else if (Stochastic_Power == true && Sto_Diff == 0) { Power_Buffer_Neg[Bar_Index] = 0; Power_Buffer_Pos[Bar_Index] = 0; } } // CLOSE OF FOR LOOP //============================== // Average Strength Calculations //============================== Average_Pos_Power = Total_Pos_Power/Pos_Bar_Count; Average_Neg_Power = Total_Neg_Power/Neg_Bar_Count; //======================= // Setting Average Levels //======================= if (Set_Levels == true) // displaying levels { SetLevelStyle( EMPTY, 1, Blue) ; SetLevelValue(1, Average_Pos_Power); SetLevelValue(2, Average_Neg_Power); } else if (Set_Levels == false) // needed to erase old levels if setting Set_Levels to False { SetLevelStyle( EMPTY, 1, Gray) ; SetLevelValue(1, 0); SetLevelValue(2, 0); } return(0); } //+------------------------------------------------------------------+Indicator_Strength.jpgIndicator_Strength.jpg
TK29帖子1楼右侧xm竖版广告90-240
个性签名

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

广告
TK30+TK31帖子一樓廣告
TK30+TK31帖子一樓廣告
Pzxzx
注册时间2017-08-06
发表于:2017-08-11 09:34只看该作者
2楼
阅尽天下指标

本站免责声明:

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

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

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

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

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

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