//+------------------------------------------------------------------+ //| SQ9 (Price).mq4 | //| Copyright © 2006, Matt Trigwell | //| | //+------------------------------------------------------------------+ #property copyright "Copyright © 2006, Matt Trigwell" #property link "m.trigwell@gmail.com" #property indicator_chart_window extern double StartPrice=0; extern bool Direction_Up=true; extern color _45Degree_Color=Yellow; extern color _25.5Degree_Color=DarkGray; int init() { return(0); } int deinit() { double AngleIndex=0; string AngleName=""; for(AngleIndex=0;AngleIndex<=720;AngleIndex=AngleIndex+22.5) { AngleName = "Angle_" + AngleIndex; ObjectDelete(AngleName + " Label"); ObjectDelete(AngleName + " Line"); } return(0); } int start() { double AngleIndex=0; string AngleName=""; double FactorIndex=0; double AnglePriceLevel=0; int Index=0; string strLabel=""; for(AngleIndex=0;AngleIndex<=720;AngleIndex=AngleIndex+22.5) { AnglePriceLevel = CalculateSquare(FactorIndex,StartPrice); //Trim Zero's if(Index==1) { strLabel = DoubleToStr(AngleIndex,1); } else { strLabel = DoubleToStr(AngleIndex,0); } AngleName = "Angle_" + AngleIndex; if(ObjectFind(AngleName + " Line") != 0) { ObjectCreate(AngleName + " Line", OBJ_HLINE, 0, Time[40], AnglePriceLevel); ObjectSet(AngleName + " Line", OBJPROP_STYLE, STYLE_DASHDOTDOT); if(MathMod(Index,2) == 0) { ObjectSet(AngleName + " Line", OBJPROP_COLOR, _45Degree_Color); } else { ObjectSet(AngleName + " Line", OBJPROP_COLOR, _25.5Degree_Color); } } else { ObjectMove(AngleName + " Line", 0, Time[40], AnglePriceLevel); } if(ObjectFind(AngleName + " Label") != 0) { ObjectCreate(AngleName + " Label", OBJ_TEXT, 0, Time[20], AnglePriceLevel); if(MathMod(Index,2) == 0) { ObjectSetText(AngleName + " Label", strLabel + "°", 8, "Arial", _45Degree_Color); } else { ObjectSetText(AngleName + " Label", strLabel + "°", 8, "Arial", EMPTY); } } else { ObjectMove(AngleName + " Label", 0, Time[20], AnglePriceLevel); } FactorIndex = FactorIndex + 0.125; Index = Index + 1; } return(0); } double CalculateSquare(double Factor, double Price) { double AnglePrice=0; if(Price > 0) { if(StringFind(Symbol(),"JPY",0) == -1) { Price = Price * 10000; } else { Price = Price * 100; } if(Direction_Up==true) { AnglePrice = MathPow(MathSqrt(Price) + Factor,2); } else { AnglePrice = MathPow(MathSqrt(Price) - Factor,2); } if(StringFind(Symbol(),"JPY",0) == -1) { AnglePrice = AnglePrice / 10000; } else { AnglePrice = AnglePrice / 100; } } return(AnglePrice); }
Sample
Analysis
Market Information Used:
Series array that contains open time of each bar
Indicator Curves created:
Indicators Used:
Custom Indicators Used:
Order Management characteristics:
Other Features: