//+------------------------------------------------------------------+ //| 9Squared Gann.mq4 | //| Copyright © 2007, Steve Bowley, concept,formulas| //| & Patrick Nouvion, programming| //| www.9squaredfx.com, www.patricknouvion.com | //+------------------------------------------------------------------+ #property copyright "Copyright © 2007, Steve Bowley & Patrick Nouvion" #property link "www.9squaredfx.com, www.patricknouvion.com" #property indicator_chart_window extern double Value = 1.1234; extern double Angle = 9; extern int Width = 1; extern bool DisplayFiboCycles = True; //---- Colors extern string COLORS = "===========COLORS=========="; extern color ResistanceColor = DimGray; extern color SupportColor = SteelBlue; extern color FiboTimeZonesColor = Gray; //+------------------------------------------------------------------+ //| INIT | DEINIT | //+------------------------------------------------------------------+ int init() { CleanUp(); return(0); } int deinit() { CleanUp(); return(0); } //+------------------------------------------------------------------+ //| GS9 | //+------------------------------------------------------------------+ int start() { if( Value == 0.0 ) { Alert( "Invalid Price Entered" ); return(-1); } bool ItsAHigh = False; int Multiplier = 0; bool Done = False; int CountBars = 0; //---- Find Value n bar count for( int i = 0; i < Bars && !Done ; i++ ) { if( Value == High[i] || Value == Low[i] ) { if( Value == High[i] ) { ItsAHigh = True; } else { ItsAHigh = False; } Done = True; } CountBars++; } //---- Update Multiplier depending on symbol ... if( MarketInfo( Symbol(), MODE_DIGITS ) == 2 ) { Multiplier = 10; } else { Multiplier = 1000; } //---- Calc Vars Value *= Multiplier; double Factor = 2.0 * ( ( Angle ) / 360 ); int Cycle = MathRound( MathSqrt( Value ) ); //---- Calculate Cycle Offset int Extend = MathMax( 0.01, CountBars-Cycle ); //---- Draw 18 Res Lines for( i = 1; i <= 36; i++ ) { double rv = MathPow( ( MathSqrt( Value ) + ( Factor * i ) ), 2 ) / Multiplier; ObjectCreate( StringConcatenate("9squaredfxr0",i) , OBJ_HLINE, 0 , Time[0], rv); ObjectSet( StringConcatenate("9squaredfxr0",i) , OBJPROP_WIDTH, Width ); ObjectSet( StringConcatenate("9squaredfxr0",i) , OBJPROP_STYLE, 2 ); ObjectSet( StringConcatenate("9squaredfxr0",i) , OBJPROP_COLOR, ResistanceColor ); } //---- Draw 18 Support Lines for( i = 1; i <= 36; i++ ) { rv = MathPow( ( MathSqrt( Value ) - ( Factor * i ) ), 2 ) / Multiplier; ObjectCreate( StringConcatenate("9squaredfxs0",i) , OBJ_HLINE, 0 , Time[0], rv); ObjectSet( StringConcatenate("9squaredfxs0",i) , OBJPROP_WIDTH, Width ); ObjectSet( StringConcatenate("9squaredfxs0",i) , OBJPROP_STYLE, 2 ); ObjectSet( StringConcatenate("9squaredfxs0",i) , OBJPROP_COLOR, SupportColor ); } //---- Draw Start Line { ObjectCreate( "9squaredfx_001", OBJ_HLINE, 0 , Time[0], Value / Multiplier); ObjectSet( "9squaredfx_001", OBJPROP_WIDTH, Width ); ObjectSet( "9squaredfx_001", OBJPROP_STYLE, 0 ); ObjectSet( "9squaredfx_001", OBJPROP_COLOR, Plum ); } //---- Draw Fibo Lines //-- Time Zones if( DisplayFiboCycles ) { ObjectCreate( "9SquaredFibo", 11, 0, Time[CountBars-1], ( Value / Multiplier ), Time[Extend], Close[Extend] ); ObjectSet( "9SquaredFibo", OBJPROP_LEVELCOLOR, FiboTimeZonesColor ); } //--- return(0); } //+------------------------------------------------------------------+ void CleanUp() { //---- Start ObjectDelete("9squaredfx_001"); //---- Fib Lines ObjectDelete("9SquaredFibo"); //---- Resistance for( int k = 1; k <= 36; k++ ) { ObjectDelete( StringConcatenate("9squaredfxr0",k) ); ObjectDelete( StringConcatenate("9squaredfxs0",k) ); } }
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 open time of each bar
Series array that contains close prices for each bar
Indicator Curves created:
Indicators Used:
Custom Indicators Used:
Order Management characteristics:
Other Features:
It issuies visual alerts to the screen