//+------------------------------------------------------------------+ //| vForce Like Indy.mq4 | //| Copyright © 2008, TradingSytemForex | //| http://www.tradingsystemforex.com | //+------------------------------------------------------------------+ #property copyright "Copyright © 2008, TradingSytemForex" #property link "http://www.tradingsystemforex.com" #property indicator_chart_window #property indicator_buffers 2 #property indicator_color1 DeepSkyBlue #property indicator_color2 OrangeRed double CrossUp[]; double CrossDown[]; double prevtime; double Range, AvgRange; double LimeRmonow, LimeRmoprevious; double GoldRmonow, GoldRmoprevious; extern int StochKPeriod = 5; extern int StochDPeriod = 3; extern int StochSlowing = 3; extern bool OnlyAtStochSignal=false; extern int RSIPeriod = 14; extern int RSILevel = 50; extern bool OnlyAtRSISignal=false; extern int ADXPeriod = 14; extern bool OnlyAtADXSignal=false; extern int BearsPeriod = 13; extern bool OnlyAtBearsSignal=false; extern int BullsPeriod = 13; extern bool OnlyAtBullsSignal=false; extern int MACDFast = 12; extern int MACDSlow = 26; extern int MACDSMA = 9; extern bool OnlyAtMacdSignal=false; extern int RPeriod = 10; extern bool OnlyAtROCSignal=false; extern int BBPeriod = 20; extern bool OnlyAtBBSignal=false; extern int SoundAlert = 0; //0=disabled //+------------------------------------------------------------------+ //| Initialization | //+------------------------------------------------------------------+ int init() { //---- indicators SetIndexStyle(0, DRAW_ARROW, EMPTY, 2); SetIndexArrow(0, 233); SetIndexBuffer(0, CrossUp); SetIndexStyle(1, DRAW_ARROW, EMPTY, 2); SetIndexArrow(1, 234); SetIndexBuffer(1, CrossDown); //---- return(0); } //+------------------------------------------------------------------+ //| Deinitialization | //+------------------------------------------------------------------+ int deinit() { //---- //---- return(0); } //+------------------------------------------------------------------+ //| Iteration | //+------------------------------------------------------------------+ int start() { int limit, i, counter; int counted_bars=IndicatorCounted(); if(counted_bars<0) return(-1); if(counted_bars>0) counted_bars--; limit=Bars-counted_bars; for(i = 1; i <= limit; i++) { counter=i; Range=0; AvgRange=0; for(counter=i ;counter<=i+9;counter++) { AvgRange=AvgRange+MathAbs(High[counter]-Low[counter]); } Range=AvgRange/10; double StoMa=iStochastic(NULL,0,StochKPeriod,StochDPeriod,StochSlowing,MODE_SMA,0,MODE_MAIN,i+1); double StoSa=iStochastic(NULL,0,StochKPeriod,StochDPeriod,StochSlowing,MODE_SMA,0,MODE_SIGNAL,i+1); double StoM=iStochastic(NULL,0,StochKPeriod,StochDPeriod,StochSlowing,MODE_SMA,0,MODE_MAIN,i); double StoS=iStochastic(NULL,0,StochKPeriod,StochDPeriod,StochSlowing,MODE_SMA,0,MODE_SIGNAL,i); double RSIa=iRSI(NULL,0,RSIPeriod,PRICE_CLOSE,i+1); double RSI=iRSI(NULL,0,RSIPeriod,PRICE_CLOSE,i); double ADXPa=iADX(NULL,0,ADXPeriod,PRICE_CLOSE,MODE_PLUSDI,i+1); double ADXMa=iADX(NULL,0,ADXPeriod,PRICE_CLOSE,MODE_MINUSDI,i+1); double ADXP=iADX(NULL,0,ADXPeriod,PRICE_CLOSE,MODE_PLUSDI,i); double ADXM=iADX(NULL,0,ADXPeriod,PRICE_CLOSE,MODE_MINUSDI,i); double Bearsa=iBearsPower(NULL,0,BearsPeriod,PRICE_CLOSE,i+1); double Bullsa=iBullsPower(NULL,0,BullsPeriod,PRICE_CLOSE,i+1); double Bears=iBearsPower(NULL,0,BearsPeriod,PRICE_CLOSE,i); double Bulls=iBullsPower(NULL,0,BullsPeriod,PRICE_CLOSE,i); double MacdMa=iMACD(NULL,0,MACDFast,MACDSlow,MACDSMA,PRICE_CLOSE,MODE_MAIN,i+1); double MacdSa=iMACD(NULL,0,MACDFast,MACDSlow,MACDSMA,PRICE_CLOSE,MODE_SIGNAL,i+1); double MacdM=iMACD(NULL,0,MACDFast,MACDSlow,MACDSMA,PRICE_CLOSE,MODE_MAIN,i); double MacdS=iMACD(NULL,0,MACDFast,MACDSlow,MACDSMA,PRICE_CLOSE,MODE_SIGNAL,i); double CurrentClosea=iClose(NULL,0,i+RPeriod); double PrevClosea=iClose(NULL,0,i+RPeriod+RPeriod); double ROCa=CurrentClosea-PrevClosea; double CurrentClose=iClose(NULL,0,i); double PrevClose=iClose(NULL,0,i+RPeriod); double ROC=CurrentClose-PrevClose; double BBandsa=iMA(Symbol(),0,BBPeriod,0,MODE_SMA,PRICE_CLOSE,i+1); double BBands=iMA(Symbol(),0,BBPeriod,0,MODE_SMA,PRICE_CLOSE,i); if(((OnlyAtStochSignal==false && StoM>StoS) || (OnlyAtStochSignal && StoMa<StoSa && StoM>StoS )) && ((OnlyAtRSISignal==false && RSI>RSILevel) || (OnlyAtRSISignal && RSIa<RSILevel && RSI>RSILevel )) && ((OnlyAtADXSignal==false && ADXP>ADXM) || (OnlyAtADXSignal && ADXPa<ADXMa && ADXP>ADXM )) && ((OnlyAtBearsSignal==false && Bears>0) || (OnlyAtBearsSignal && Bearsa<0 && Bears>0 )) && ((OnlyAtBullsSignal==false && Bulls>0) || (OnlyAtBullsSignal && Bullsa<0 && Bulls>0 )) && ((OnlyAtMacdSignal==false && MacdM>MacdS) || (OnlyAtMacdSignal && MacdMa<MacdSa && MacdM>MacdS )) && ((OnlyAtROCSignal==false && ROC>0) || (OnlyAtROCSignal && ROCa<0 && ROC>0 )) && ((OnlyAtBBSignal==false && Close[i]>BBands) || (OnlyAtBBSignal && Close[i+1]<BBandsa && Close[i]>BBands ))) { CrossUp[i] = Low[i] - Range*1.5; } if(((OnlyAtStochSignal==false && StoM>StoS) || (OnlyAtStochSignal && StoMa>StoSa && StoM<StoS )) && ((OnlyAtRSISignal==false && RSI<RSILevel) || (OnlyAtRSISignal && RSIa>RSILevel && RSI<RSILevel )) && ((OnlyAtADXSignal==false && ADXP<ADXM) || (OnlyAtADXSignal && ADXPa>ADXMa && ADXP<ADXM )) && ((OnlyAtBearsSignal==false && Bears<0) || (OnlyAtBearsSignal && Bearsa>0 && Bears<0 )) && ((OnlyAtBullsSignal==false && Bulls<0) || (OnlyAtBullsSignal && Bullsa>0 && Bulls<0 )) && ((OnlyAtMacdSignal==false && MacdM<MacdS) || (OnlyAtMacdSignal && MacdMa>MacdSa && MacdM<MacdS )) && ((OnlyAtROCSignal==false && ROC<0) || (OnlyAtROCSignal && ROCa>0 && ROC<0 )) && ((OnlyAtBBSignal==false && Close[i]<BBands) || (OnlyAtBBSignal && Close[i+1]>BBandsa && Close[i]<BBands ))) { CrossDown[i] = High[i] + Range*1.5; } } if((CrossUp[0] > 2000) && (CrossDown[0] > 2000)) { prevtime = 0; } if((CrossUp[0] == Low[0] - Range*0.5) && (prevtime != Time[0]) && (SoundAlert != 0)) { prevtime = Time[0]; Alert(Symbol()," vForce Like Indy Up @ Hour ",Hour()," Minute ",Minute()); } if((CrossDown[0] == High[0] + Range*0.5) && (prevtime != Time[0]) && (SoundAlert != 0)) { prevtime = Time[0]; Alert(Symbol()," vForce Like Indy Down @ Hour ",Hour()," Minute ",Minute()); } return(0); }
Sample
Analysis
Market Information Used:
Series array that contains the highest prices of each bar
Series array that contains the lowest prices of each bar
Series array that contains close prices for each bar
Series array that contains open time of each bar
Indicator Curves created:
Implements a curve of type DRAW_ARROW
Indicators Used:
Stochastic oscillator
Relative strength index
Movement directional index
Bears Power indicator
Bulls Power indicator
MACD Histogram
Moving average indicator
Custom Indicators Used:
Order Management characteristics:
Other Features:
It issuies visual alerts to the screen