Welcome Forex EA downloads & MT4/MT5 auto-trading resources — EAs, Gold EAs, quant tools and real-world automation.
Sign In Sign Up

Gap Indicator - MetaTrader 4 Script - MQL5 #7366 | Forex Indicator Download - MT4/MT5 Resources

author EAcpu | 3 reads | 0 comments |

Gap indicator - indicator for MetaTrader 4

//+------------------------------------------------------------------+
//|Gap indicator|
//|Forex and STOX |
//| ram-kr@krastalk.ru |
//+------------------------------------------------------------------+
#Property Copyright "ram-kr@krastalk.ru"
#property- related 
#property -indicator_separate_window
# Property indicator buffer 2
#PropertyIndicator_color1 Blue #PropertyIndicator_color2 Red #PropertyIndicatorWidth1 2
# Property indicator width 2 2

Double ExtMapBuffer1[]; Double ExtMapBuffer2[]; //+----------------------------------------------------------------------------------+
//|Custom indicator initialization function |
//+------------------------------------------------------------------+
integer_initialize ()
{ //---- indicator
Indicator buffer ( 2 ); set index style ( 0 , draw histogram ); set index buffer ( 0 , ExtMapBuffer1); set index label ( 0 , "blue" ); set index style ( 1 , draw histogram ); set index buffer ( 1 , ExtMapBuffer2); set index label ( 1 , "red" ); //----
Indicator abbreviation ( "Gap Indicator FOREX&STOX" ); //----
return ( 0 );
} //+------------------------------------------------------------------+
//|Customer indicator de-initialization function |
//+------------------------------------------------------------------+
integer deinitialization()
{ return ( 0 );
} //+------------------------------------------------------------------+
//|Custom indicator iteration function |
//+------------------------------------------------------------------+
integer start()
{ Integer count bar = counting indicator (); double band mode, band price, power price; //+----Main part--------------------------------------------------+
double value 1, value 2; order ( integer i = 0 ; i <= bar ; i++)
{
Value 1= 0 ; Value 2= 0 ; // Downward gap\--------------------------------------------------
if (( Open [i] -Close [i+ 1 ])> 0 ) value 1=( Open [i] -Close [i+ 1 ])/ view ; // Gap up/------------------------------------------------------------------
if (( open [i] -close [i+ 1 ])< 0 ) value 2=( open [i] -close [i+ 1 ])/ view ; //-------------------------------------------------------------------------------- ExtMapBuffer1[i]=value 1; ExtMapBuffer2[i]=value 2; } //End //+------------------------------------------------------------------+ Return ( 0 ); } //+----------------------------------------------------------------------------------+

Attachment download

📎 i_GAP.mq4 (2.62 KB)

Source: MQL5 #7366

Verification code Refresh