//|----------------------------------------------- -----------------------| / / | | / / | | / / | Dedicated to the memory of my friend | / / | Denisov, Vladimir Nikolaevich | / / | September 2007, Novokuybyshevsk | / / | | / / | | //|----------------------------------------------- -----------------------| / / | ZigZag universal with patterns Pesavento | //|----------------------------------------------- -----------------------| / / | | / / | "Parameters for ZigZag" | / / | | //|----------------------------------------------- -----------------------| / / | ExtIndicator - with the option of the indicator, based on which | / / | Built Pesavento Patterns | / / | 0 - Zigzag from metatrader, standard, slightly | / / | Optimized | / / | 1 - Zigzag Alex | / / | 2 - indicator similar to the built-in Ensign | / / | 3 - ZigZag Ensign with a variable value minBars | / / | 4 - ZigZag, developed tauber | / / | 5 - a variation on swings Gunn | / / | 6 - DT-ZigZag with external ZigZag_new_nen3.mq4. It is based | / / | Standard ZigZag | / / | 7 - DT-ZigZag with external DT_ZZ.mq4 (developed klot) | / / | 8 - DT-ZigZag with external CZigZag.mq4 (developed Candid) | / / | 10 - DT-ZigZag with external Swing_zz - it ExtIndicator = 5 | / / | Online DT | / / | 11 - includes a search of patterns Gartley on the basis of standard | / / | ZigZag | / / | 12 - ZigZag, developed Talex | / / | 13 - SQZZ zigzag, developed Commodity | / / | 14 - ZZ_2L_nen, developed wellx (avtoraschet levels - nen) | / / | | / / | minBars - filter bars (given the number of bars) | / / | minSize - filter on the number of points (given the number of items) | / / | | / / | ExtDeviation and ExtBackstep - settings left over from ZigZag from MT4 | / / | | / / | GrossPeriod - meaning timeframe, measured in minutes (number of minutes), | / / | Data from which are used for the construction of ZigZag mode DT-ZigZag | / / | | / / | minPercent - percentage filter (specified percentage, eg 0.5) | / / | If you have interest - put the number as minSize = 0; | / / | | / / | ExtPoint = 11 - number of points for the zigzag zigzag Talex | / / | | / / | StLevel - the first level of the zigzag (wellx) | / / | BigLevel - the second level of the zigzag (wellx) | / / | auto - automatic calculation of job levels and StLevel BigLevel | / / | minBar -% value to calculate StLevel | / / | maxBar -% value to calculate BigLevel | / / | | / / | | / / | ExtStyleZZ - = true - specifies the line style by ZigZag tab COLORS | / / | = False - Zigzag output points at the extrema | / / | | / / | ExtMaxBar - specifies the number of bars involved in the calculation of the zigzag | / / | 0 - zigzags are calculated on the entire history | / / | ExtMinBar - specifies the minimum number of bar to which calculated | / / | ZigZag | / / | | / / | ExtNumberPeak - includes the numbering of fractures ZigZag from 1 | / / | ExtNumberPeak10 - allows output numbers only in the first 10 fractures | / / | ExtNumberPeakLow - output numbers only in a Low or High and Low | / / | ExtNumberPeakColor - color numbers | / / | ExtNumberPeakFontSize - the size of the numbers | //|----------------------------------------------- -----------------------| / / | | / / | "Parameters for fibo Levels" | / / | | //|----------------------------------------------- -----------------------| / / | ExtFiboDinamic - allows output dnamicheskih Fibo levels. | / / | Dynamic Fibo levels are displayed on the first ray | / / | ZigZag-a. | / / | | / / | ExtFiboStatic - allows the output of static Fibo levels | / / | | / / | ExtFiboStaticNum - Number ray ZigZag-a, which will be displayed | / / | Static Fibonacci levels. 1 0.14 and <5. | / / | 2 - shows only those lines where the percentage for the restoration of | / / | Tation of equal numbers Pesavento (and 0.447, 0.886, 2.236, | / / | 3.14, 3,618 for the construction of patterns Gartley) | / / | 3 - shows the number listed in paragraph 2 | / / | And the corresponding lines | / / | 4 - shows the number not Pesavento and the corresponding lines | / / | 5 - hides all the rigging. Can only ZigZag | / / | And output patterns Gartley | / / | | / / | ExtFractal - the number of fractals (maxima, minima), | / / | Of which go through to the other fractals | / / | | / / | ExtFractalEnd - the number of fractals, which are lines | / / | More of this fractal connecting lines will not be | / / | If ExtFractalEnd = 0 then the latter is a fractal | / / | The maximum number of fractals. | / / | Minimum value ExtFractalEnd = 1 | / / | | / / | ExtFiboChoice - choice of numbers of numbers to construct patterns | / / | Pesavento. Parameter specifies the number from 0 to 11 | / / | | / / | ExtFiboZigZag - allows the conclusion "ZiaZag Fibonacci" | / / | | / / | ExtDelta - (tolerance) deviation in the calculation. Specifies the value of | / / | A potential reversal zone. | / / | Must be 0 0 allows the display of the zone of the point D | / / | = 2 additional output line potential | / / | Terms of levels D | / / | | / / | ExtColorRangeForPointD - color of the border zone of the point D | / / | ExtLineForPointD_AB - sets the color of the potential level of point D | / / | ExtLineForPointD_BC - sets the color of the potential level of point D | / / | | / / | ExtColorPatterns - color triangles patterns | / / | | / / | ExtColorPatternList - given a list of colors for shading of the wings | / / | Patterns Gartley. The color names listed | / / | A comma. If any color will be | / / | Written with an error, then this color is selected | / / | Red | / / | | / / | ExtDeltaGartley - admission to the deviation of the price search patterns | / / | By default 9% - 0.09 | / / | | / / | ExtCD - the value of the beam pattern on the CD after which the beam BC | / / | Begins search patterns (maybe - this is an extra option) | / / | | / / | Equilibrium - includes output lines Equilibrium, Reaction1 and Reaction2 | / / | ReactionType - specifies the type of reaction lines | / / | EquilibriumStyle - sets the line style | / / | EquilibriumWidth - specifies the thickness of the lines | / / | ColorEquilibrium - sets the color for Equilibrium | / / | ColorReaction - sets the color for Reaction1 and Reaction2 | //|----------------------------------------------- -----------------------| / / | | / / | "Parameters for Andrews Pitchfork" | / / | | //|----------------------------------------------- -----------------------| / / | ExtPitchforkDinamic> 0 (= 1) are derived from the dynamic pitchfork Andrews | / / | The past two extremes ZigZag | / / | = 2 50% median | / / | = 3 50% pitchfork | / / | = 4 lines Schiff | / / | | / / | ExtPitchforkStatic> 0 (= 1) are derived from static fork Andrews | / / | ZigZag extremum numbered ExtPitchforkStaticNum | / / | = 2 50% median | / / | = 3 50% pitchfork | / / | = 4 lines Schiff | / / | | / / | 3 2 and <= 9 static Fibonacci extension | / / | | / / | ExtFiboExpansionColor - sets the color line extensions Fibonacci | / / | | / / | ExtExpansionStyle - sets the line style levels extensions | / / | Fibonacci | / / | | / / | ExtExpansionWidth - sets the line thickness levels extensions | / / | Fibonacci | //|----------------------------------------------- -----------------------| / / | | / / | "Parameters for versum Levels" | / / | | //|----------------------------------------------- -----------------------| / / | ExtVLDinamicColor - includes Versum Levels dynamic choice of colors | / / | | / / | ExtVLStaticColor - includes Versum Levels static choice of colors | / / | | / / | ExtVLStaticNum - sets the number of peaks, from which are derived | / / | Versum Levels | / / | | / / | ExtVLStyle - sets the line style levels Versum Levels | / / | | / / | ExtVLWidth - sets the line thickness levels Versum Levels | //|----------------------------------------------- -----------------------| / / | | / / | "Parameters for fibo Arc" | / / | | //|----------------------------------------------- -----------------------| / / | ExtArcDinamicNum - sets the number of fractures ZigZag to which | / / | Build dynamic fibo arcs | / / | | / / | ExtArcStaticNum - sets the number of fractures which ZigZag | / / | Built static fibo arcs | / / | | / / | ExtArcDinamicColor - sets the color of dynamic Fibo Arcs | / / | | / / | ExtArcStaticColor - sets the color of static Fibo Arcs | / / | | / / | ExtArcDinamicScale - sets the scale of dynamic Fibo Arcs | / / | 0 - Autosize> 0 - scale set by the user | / / | | / / | ExtArcStaticScale specifies scale stamicheskih Fibo Arcs | / / | 0 - Autosize> 0 - scale set by the user | / / | | / / | ExtArcStyle - sets the line style levels Fibo Arcs | / / | | / / | ExtArcWidth - sets the line thickness levels Fibo Arcs | //|----------------------------------------------- -----------------------| / / | | / / | "Golden Spiral" | / / | | //|----------------------------------------------- -----------------------| / / | ExtSpiralNum - sets the number of fractures ZigZag, at which | / / | Built golden spiral | / / | | / / | goldenSpiralCycle - sets the distance between the turns. The higher the number, | / / | The smaller the distance between the turns of the helix. | / / | | / / | accurity - sets the length of the segments of straight lines, which is based | / / | Spiral | / / | | / / | NumberOfLines specifies the number of segments of straight lines, of which | / / | Built spiral | / / | | / / | clockWiseSpiral - sets the direction of twist spiral | / / | True - spiral curls clockwise | / / | False - spiral curls counterclockwise | / / | | / / | spiralColor1 - sets the first color of the line spiral | / / | | / / | spiralColor2 - sets the color of the second line of the spiral | / / | | / / | ExtSpiralStyle - sets the line style spiral | / / | | / / | ExtSpiralWidth - sets the line thickness of the helix | //|----------------------------------------------- -----------------------| / / | | / / | "Parameters for Pivot ZigZag" | / / | | //|----------------------------------------------- -----------------------| / / | ExtPivotZZ1Color - sets the color Pivot ZigZag 1 | / / | | / / | ExtPivotZZ2Color - sets the color Pivot ZigZag 2 | / / | | / / | ExtPivotZZ1Num - sets the number of beam, which is calculated 1 | / / | Pivot ZigZag | / / | | / / | ExtPivotZZ2Num - sets the number of beam, which is calculated 2 | / / | Pivot ZigZag | / / | | / / | ExtPivotZZStyle - sets the line style levels Pivot ZigZag | / / | | / / | ExtPivotZZWidth - sets the line thickness levels Pivot ZigZag | //|----------------------------------------------- -----------------------| / / | | / / | "Parameters for Channels" | / / | | //|----------------------------------------------- -----------------------| / / | ExtTypeChannels - Specifies the type of channel. | / / | 1 - trend line passes through the fracture and zigzag | / / | At a tangent to the market. The line passes objectives | / / | Parallel trendlines. This channel is built | / / | Or on one ray, or on two consecutive | / / | | / / | 2 - trend line and the line run parallel goals | / / | ZigZag ray tangent to the market. Ray zigzag | / / | Can pass between any fractures from 1 to | / / | 9 | / / | | / / | ExtTypeLineChannels - specifies the type of trend lines and goals. Can | / / | To take values from 0 to 3 | / / | | / / | ExtChannelsNum - sets the number of fractures of the zigzag, between which | / / | Constructed channel. | / / | | / / | ExtLTColor - sets the color of the trend line | / / | ExtLCColor - sets the color line goals | / / | ExtLTChannelsStyle - sets the style trend line | / / | ExtLTChannelsWidth - specifies the thickness of the trend line | / / | ExtLCChannelsStyle - sets the line style goals | / / | ExtLCChannelsWidth - sets the line thickness of the goals | //|----------------------------------------------- -----------------------| / / | | / / | "Parameters for Fibo Time" | / / | | //|----------------------------------------------- -----------------------| / / | ExtFiboTimeNum - sets zigzag fractures, which are constructed from | / / | ExtFiboTime, not tied to vilam Andrews | / / | | / / | ExtFiboTime1x-includes time zones Fibo 1. | / / | | / / | ExtFiboTime2x-includes time zones Fibo 2. | / / | | / / | ExtFiboTime3x-includes time zones Fibo 3. | / / | | / / | ExtFiboTime1Cx-sets the color of the lines of the Zone 1. | / / | | / / | ExtFiboTime2Cx-sets the color of the lines of the Zone 2. | / / | | / / | ExtFiboTime3Cx-sets the color of the lines of the Zone 3. | / / | | / / | ExtVisibleDateTimex-display includes date and time values time | / / | Zones | / / | | / / | ExtVisibleNumberFiboTimex-allows you to highlight those Fibo Time, at which | / / | To show the date and time | / / | | / / | 1 - displays date and time | / / | 0 - not displayed | / / | | / / | The first digit - for Fibo Time 1 | / / | Second digit - for Fibo Time 2 | / / | The third digit - for Fibo Time 3 | //|----------------------------------------------- -----------------------| / / | | / / | "Parameters Exp" | / / | | //|----------------------------------------------- -----------------------| / / | chHL = true - displays the levels of evidence for regimes | / / | ExtIdicator = 1, ExtIdicator = 2, ExtIdicator = 3 | / / | | / / | PeakDet = true - displays the levels of previous highs for all | / / | Regimes ExtIndicator | / / | | / / | chHL_PeakDet_or_vts - true - By default, allows the output lines | / / | Confirm (price channel) and the levels of previous highs ZigZag. | / / | False - output indicator i-vts. | / / | | / / | ExtLabel = 0 normal output mode zigzags | / / | = 1 output tags in the estimated site of emergence of a new ray | / / | For REDIMA DT - in the form of strips of characters | / / | = 3 output tags in the estimated site of emergence of a new ray | / / | Mode DT - in the form of a single character | / / | | / / | ExtCodLabel - character code to display tags | / / | | / / | NumberOfBars - Number of bars calculation (0-all) for i-vts. | / / | | / / | NumberOfVTS - this, I understand, the smoothing parameter for the i-vts. | / / | | / / | NumberOfVTS1 - smoothing parameter for the second copy i-vts. | //|----------------------------------------------- -----------------------| / / | | / / | "Common Parameters" | / / | | //|----------------------------------------------- -----------------------| / / | ExtFiboType - specifies on what values are set Phib Fibo tools | / / | | / / | 0 - standard fiby | / / | 1 - fiby with numbers Pesavento, etc. | / / | 2 - fiby user-defined | / / | | / / | ExtFiboTypeFree - set user Phib to: | / / | 1) Fibo fans along the median of Andrews' Pitchfork | / / | 2) arbitrary Fibo fans | / / | 3) levels Fibo | / / | 4) Fibonacci extension | / / | 6) Fibo Arcs | / / | | / / | ExtObjectColor - sets the color of the line connecting the base points of objects | / / | | / / | ExtObjectStyle - specifies Playstyle line | / / | Connecting the base points of objects | / / | | / / | ExtObjectWidth - specifies the thickness of the line | / / | Connecting the base points of objects | / / | | / / | ExtDinamic - allows the output of static tools like dynamic | / / | With the appearance of a new beam static | / / | Tools moved to other fractures of the zigzag | / / | | / / | ExtVisibleDinamic - allows you to select which static | / / | Tools display in dynamic mode | / / | | / / | Total 11 tools. | / / | | / / | I shall list them in order they appear in the list: | / / | 1 - numbering fractures zigzag | / / | 2 - static Fibo levels, and the first type of extensions Fibo | / / | 3 - static Andrews' Pitchfork and all that is associated with a pitchfork | / / | 4 - static Fibo fans | / / | 5 - static Fibo extension | / / | 6 - static Versum Levels | / / | 7 - static Fibo arc | / / | 8 - static fibo spiral | / / | 9 - static Pivot ZigZag | / / | 10 - Feeds | / / | 11 - Fibo Time | / / | | / / | By default ExtVisibleDinamic = "01000000000" | / / | 0 - displayed in static mode | / / | 1 - displayed in the dynamic mode | / / | | / / | | / / | ZigZagHighLow - specifies from which points to build a | / / | Patterns Pesavento, Andrews' Pitchfork, etc. | / / | true - from the extremes bars | / / | false - from fractures ZigZag, when they hang in the air "| / / | | / / | ExtSendMail - sending email message that appears on the pattern. | / / | | / / | ExtAlert - allows the output message and a beep when | / / | Emergence of a new ray of ZigZag | / / | | / / | ExtPlayAlert - allows the output message and a beep when | / / | The appearance of a new pattern | / / | | / / | ExtBack - sets the output of all the objects in the background | / / | | / / | ExtSave - allows the preservation of static sets of forks and | / / | Fibo Time | / / | | / / | info_comment - allows you to select a group of parameters for the withdrawal of this | / / | Group in the information line. | / / | Total 4 groups of parameters. | / / | 0 - group settings are not displayed | / / | 1 - a group of parameters is displayed | / / | | / / | Group parameters: | / / | 1 - information about the candlelight with senior timeframes | / / | 2 -% change in the beam of radiation tactics | / / | 3 - parameters zigzags | / / | 4 - information about the found pattern Gartley | / / | 5 - output the calculated RL, if the right border | / / | RedZone Andrews' Pitchfork to the tangent to the market | / / | | / / | infoTF - includes information on 5 larger timeframes. | / / | I get the name timeframe. The size of the candles in the points. | / / | The current situation regarding the minimum price. | / / | Also shows the height of the zigzag beam expressed in percentage. | / / | Display mode indicator and parameters of zigzags. | / / | Shows the name of Gartley patterns and price zone size | / / | Possible development of the point D for patterns Gartley. | / / | | / / | ExtComplekt - sets the number of the indicator. In the derivation of the graph several | / / | Indicators through this option sets the number of copies. | / / | In this case all copies of the indicator will work correctly. | //+----------------------------------------------- -----------------------+ # property copyright "nen" # property link "http://www.onix-trade.net/forum/index.php?showtopic=118&view=findpost&p=380843" / / Description http://onix-trade.net/forum/index.php?s=&showtopic=373&view=findpost&p=72865 # property stacksize 65535 # property indicator_chart_window # property indicator_buffers 6 # property indicator_color1 Magenta / / Red / / # property indicator_width6 5 # property indicator_color2 Green # property indicator_color3 Orange # property indicator_color4 LightSkyBlue # property indicator_color5 LemonChiffon / / # property indicator_color4 Chartreuse / / # property indicator_color5 Red # property indicator_color6 Magenta / / Yellow # import "user32.dll" int GetClientRect (int hWnd, int lpRect []); # import # define pi 3.14159265 # define phi 1.61803399 //=================================== //---- Indicator parameters extern string ______________0_____________ = "Parameters for ZigZag"; extern int ExtIndicator = 11; extern int minBars = 12; extern int minSize = 50; / / Variables from ZigZag from MT extern int ExtDeviation = 8; extern int ExtBackstep = 3; / / Variable for nen-ZigZag extern int GrossPeriod = 1440; //---- extern double minPercent = 0; extern int ExtPoint = 11, / / number of points for the zigzag zigzag Talex / / Parameters for zigzag developed wellx extern int StLevel = 28; extern int BigLevel = 32; extern bool auto = true; extern double minBar = 38.2, maxBar = 61.8; extern bool ExtStyleZZ = true; extern int ExtMaxBar = 700, / / Number of bars calculation (0-all) extern int ExtMinBar = 0; / / Output numbers of fractures zigzags extern bool ExtNumberPeak = false; extern bool ExtNumberPeak10 = true; extern bool ExtNumberPeakLow = true; extern color ExtNumberPeakColor = Red; extern int ExtNumberPeakFontSize = 11; extern string ______________1_____________ = "Parameters for fibo Levels"; extern bool ExtFiboDinamic = false; extern bool ExtFiboStatic = false; extern int ExtFiboStaticNum = 2; extern bool ExtFiboCorrectionExpansion = false; extern color ExtFiboD = Sienna; extern color ExtFiboS = Teal; extern int ExtFiboStyle = 2; extern int ExtFiboWidth = 0; //------------------------------------- extern string ______________2_____________ = "Parameters for Pesavento Patterns"; extern int ExtPPWithBars = 0; extern int ExtHidden = 1; extern int ExtFractal = 7; extern int ExtFractalEnd = 7; extern int ExtFiboChoice = 2; extern bool ExtFiboZigZag = false; extern double ExtDelta = 0.04; extern int ExtDeltaType = 2; extern int ExtSizeTxt = 7; extern color ExtLine = DarkBlue; extern color ExtLine886 = Purple; extern color ExtNotFibo = SlateGray; extern color ExtPesavento = Yellow; extern color ExtGartley886 = GreenYellow; color colorPPattern; / / Patterns Gartley extern string ______________3_____________ = "Parameters for Gartley Patterns"; extern int maxDepth = 33; extern int minDepth = 3; extern bool DirectionOfSearchMaxMin = true; extern int NumberPattern = 1, / / Number of the pattern, which is calibrated zigzag and the parameters of which are derived through InfoTF extern int ExtGartleyTypeSearch = 0; extern int ExtHiddenPP = 1; extern bool ExtGartleyOnOff = false; / / extern int VarDisplay = 0; extern int maxBarToD = 15; extern bool patternInfluence = true; extern double AllowedBandPatternInfluence = 1.618; extern int RangeForPointD = 2; extern color ExtColorRangeForPointD = Red; extern color ExtLineForPointD_AB = Aqua; extern color ExtLineForPointD_BC = Gold; extern color ExtColorPatterns = Blue; extern string ExtColorPatternList = "Blue, DarkGreen, Navy, Sienna, MediumBlue, RoyalBlue, DodgerBlue, CornflowerBlue, LightSkyBlue, SlateBlue, MediumSlateBlue, SlateGray, LightSteelBlue"; extern double ExtDeltaGartley = 0.09; extern double ExtCD = 0.886; //--------------- extern bool Equilibrium = true; extern bool ReactionType = false; extern int EquilibriumStyle = 1; extern int EquilibriumWidth = 0; extern color ColorEquilibrium = Red; extern color ColorReaction = Yellow; //------------------------------------------------ ---------------------- / / Set of tools working together with pitchforks Andrews. Start. //------------------------------------------------ ---------------------- / / Variables for Andrews' Pitchfork extern string ______________4_____________ = "Parameters for Andrews Pitchfork"; extern int ExtPitchforkDinamic = 0; extern int ExtPitchforkStatic = 0; extern int ExtPitchforkStaticNum = 3; extern color ExtLinePitchforkD = MediumSlateBlue; extern color ExtLinePitchforkS = MediumBlue; extern color ExtPitchforkStaticColor = CLR_NONE; extern int ExtPitchforkStyle = 1; extern int ExtPitchforkWidth = 0; extern int ExtISLStyle = 1; extern int ExtISLWidth = 0; / / Variables for fiboveerov extern bool ExtFiboFanDinamic = false; / / can be displayed independently extern bool ExtFiboFanStatic = false; / / is displayed only in conjunction with static fork extern bool ExtFiboFanExp = true; extern bool ExtFiboFanHidden = false; extern color ExtFiboFanD = Sienna; extern color ExtFiboFanS = Teal; extern color ExtFiboFanMedianaDinamicColor = CLR_NONE; extern color ExtFiboFanMedianaStaticColor = CLR_NONE; / / Time Zone Fib of Andrews' Pitchfork extern bool ExtFiboTime1 = false; extern bool ExtFiboTime2 = false; extern bool ExtFiboTime3 = false; extern color ExtFiboTime1C = Teal; extern color ExtFiboTime2C = Sienna; extern color ExtFiboTime3C = Aqua; extern bool ExtVisibleDateTime = false; extern string ExtVisibleNumberFiboTime = "111"; / / Pivot Zone extern color ExtPivotZoneDinamicColor = CLR_NONE; extern color ExtPivotZoneStaticColor = CLR_NONE; extern bool ExtPivotZoneFramework = false; / / Enable warning and control lines extern bool ExtUTL = false; extern bool ExtLTL = false; extern bool ExtUWL = false; extern bool ExtVisibleUWL = false; extern bool ExtLWL = false; extern bool ExtVisibleLWL = false; extern bool ExtLongWL = false; extern bool ExtISLDinamic = false; extern bool ExtISLStatic = false; extern bool ExtVisibleISL = false; / / Enable lines reaction extern bool ExtRL146 = true; extern bool ExtRLDinamic = true; extern bool ExtRLStatic = true; extern bool ExtVisibleRL = true; extern bool ExtRLineBase = true; / / Turn RedZone for lines reaction extern bool ExtRedZoneDinamic = false; extern bool ExtRedZoneStatic = false; extern double ExtRZDinamicValue = 0.146; extern double ExtRZStaticValue = 0.146; extern color ExtRZDinamicColor = Salmon; extern color ExtRZStaticColor = Salmon; //------------------------------------------------ ---------------------- / / extern datetime ExtDateTimePitchfork_1 = D'11 .07.2006 00:00 '; / / extern datetime ExtDateTimePitchfork_2 = D'19 .07.2006 00:00 '; / / extern datetime ExtDateTimePitchfork_3 = D'09 .08.2006 00:00 '; //------------------------------------------------ ---------------------- / / The following selected timing for the construction of Andrews' Pitchfork for the entire history eurusd for dnevok //------------------------------------------------ ---------------------- extern bool ExtPitchforkCandle = false; extern datetime ExtDateTimePitchfork_1 = D'15 .06.1989 00:00 '; extern datetime ExtDateTimePitchfork_2 = D'08 .03.1995 00:00 '; extern datetime ExtDateTimePitchfork_3 = D'26 .10.2000 00:00 '; extern bool ExtPitchfork_1_HighLow = false; //------------------------------------------------ ---------------------- / / Set user level Fibo tool, built-in Andrews' Pitchfork extern string ExtFiboFreeFT1 = "0.382,0.618,1.0,1.236,1.618"; extern string ExtFiboFreeFT2 = "0.382,0.618,1.0,1.236,1.618"; extern string ExtFiboFreeFT3 = "0.382,0.618,1.0,1.236,1.618"; extern string ExtFiboFreeRL = "0.382,0.618,1,1.618,2.618,3.618"; extern string ExtFiboFreeUWL = "0.382,0.618,1,1.618,2.618,3.618"; extern string ExtFiboFreeLWL = "0.382,0.618,1,1.618,2.618,3.618"; extern string ExtFiboFreeISL = "0.25,0.75"; //------------------------------------------------ ---------------------- / / Channels micmed'a extern string ________________5_____________ = "Parameters for micmed Channels"; extern int ExtCM_0_1A_2B_Dinamic = 0, ExtCM_0_1A_2B_Static = 0; extern double ExtCM_FiboDinamic = 0.618, ExtCM_FiboStatic = 0.618; //------------------------------------------------ ---------------------- / / Set of tools working together with pitchforks Andrews. End. //------------------------------------------------ ---------------------- / Fiboveery additional extern string ______________6_____________ = "Parameters for fibo Fan"; extern color ExtFiboFanColor = CLR_NONE; extern int ExtFiboFanNum = 0; extern int ExtFanStyle = 1; extern int ExtFanWidth = 0; / / Fibonacci Extensions extern string ______________7_____________ = "Parameters for fibo Expansion"; extern int ExtFiboExpansion = 0; extern color ExtFiboExpansionColor = Yellow; extern int ExtExpansionStyle = 2; extern int ExtExpansionWidth = 0; //-------------------------------------- extern string ______________8_____________ = "Parameters for versum Levels"; extern color ExtVLDinamicColor = CLR_NONE; extern color ExtVLStaticColor = CLR_NONE; extern int ExtVLStaticNum = 0; extern int ExtVLStyle = 0; extern int ExtVLWidth = 0; //-------------------------------------- extern string ______________9_____________ = "Parameters for fibo Arc"; extern int ExtArcDinamicNum = 0; extern int ExtArcStaticNum = 0; extern color ExtArcDinamicColor = Sienna; extern color ExtArcStaticColor = Teal; extern double ExtArcDinamicScale = 0; extern double ExtArcStaticScale = 0; extern int ExtArcStyle = 0; extern int ExtArcWidth = 0; extern string ______________10_____________ = "Golden Spiral"; extern int ExtSpiralNum = 0; extern double goldenSpiralCycle = 1; extern double accurity = 0.2; extern int NumberOfLines = 200; extern bool clockWiseSpiral = true; extern color spiralColor1 = Blue; extern color spiralColor2 = Red; extern int ExtSpiralStyle = 0; extern int ExtSpiralWidth = 0; extern string ______________11_____________ = "Pivot ZigZag"; extern color ExtPivotZZ1Color = Blue; extern color ExtPivotZZ2Color = Red; extern int ExtPivotZZ1Num = 0; extern int ExtPivotZZ2Num = 0; extern int ExtPivotZZStyle = 0; extern int ExtPivotZZWidth = 2; extern string ______________12_____________ = "Parameters for Channels"; extern int ExtTypeChannels = 0; extern int ExtTypeLineChannels = 1; extern int ExtChannelsNum = 2; extern color ExtLTColor = Red; extern color ExtLCColor = Green; extern int ExtLTChannelsStyle = 0; extern int ExtLTChannelsWidth = 1; extern int ExtLCChannelsStyle = 2; extern int ExtLCChannelsWidth = 0; extern bool ExtRay = false; extern string ______________13_____________ = "Parameters Fibo Time"; / / Fib Time Zones extern int ExtFiboTimeNum = 0; extern bool ExtFiboTime1x = false; extern bool ExtFiboTime2x = false; extern bool ExtFiboTime3x = false; extern color ExtFiboTime1Cx = Teal; extern color ExtFiboTime2Cx = Sienna; extern color ExtFiboTime3Cx = Aqua; extern bool ExtVisibleDateTimex = false; extern string ExtVisibleNumberFiboTimex = "111"; extern string ______________14_____________ = "Parameters Exp"; extern bool chHL = false; extern bool PeakDet = false; // Variables for the i-vts extern bool chHL_PeakDet_or_vts = true; extern int ExtLabel = 0; extern int ExtCodLabel = 116; extern int NumberOfBars = 1000; // Number of bars calculation (0-all) extern int NumberOfVTS = 13; extern int NumberOfVTS1 = 1; extern string ______________15_____________ = "Common Parameters"; //-------------------------------------- extern int ExtFiboType = 1; extern string ExtFiboTypeFree = "0,0.382,0.618,0.764,1,1.236,1.618"; // userland Fibo extern color ExtObjectColor = CLR_NONE; extern int ExtObjectStyle = 1; extern int ExtObjectWidth = 0; // output static objects in dynamic mode extern bool ExtDinamic = false; extern string ExtVisibleDinamic = "01000000000"; extern bool ZigZagHighLow = true; // -------------------------------- // Additional finktsii extern bool ExtSendMail = false; extern bool ExtAlert = false; extern bool ExtPlayAlert = false; // Conclusion objects in the background extern bool ExtBack = true; // Preservation of static Andrews' Pitchfork, Fibo Time ? ?.?. extern bool ExtSave = false; extern string info_comment = "11111"; extern bool infoTF = true; extern int ExtComplekt = 0; //=================================== // Arrays for ZigZag // Array to draw ZigZag double zz[]; // Array minima ZigZag double zzL[]; // Array maxima ZigZag double zzH[]; // Arrays for nen-ZigZag double nen_ZigZag[]; int _maxbarZZ; / / number of bars involved in the calculation of zigzags. // Array for optimized ZigZag //double TempBuffer[1],ZigZagBuffer[1]; // Variables snap // Array of numbers Pesavento (Fiby and modified Fiby) //double fi[]={0.146, 0.236, 0.382, 0.447, 0.5, 0.618, 0.707, 0.786, 0.841, 0.886, 1.0, 1.128, 1.272, 1.414, 1.5, 1.618, 1.732, 1.902, 2.0, 2.236, 2.414, 2.618, 3.14, 3.618, 4.0}; //string fitxt[]={"0.146", "0.236", ".382", ".447", ".5", ".618", ".707", ".786", ".841", ".886", "1.0", "1.128", "1.272", "1.414", "1.5", "1.618", "1.732", "1.902", "2.0", "2.236", "2.414", "2.618", "3.14", "3.618", "4.0"}; //double fi1[]={0.146, 0.236, 0.382, 0.5, 0.618, 0.764, 0.854, 1.0, 1.236, 1.618}; //string fitxt1[]={"0.146", "0.236", ".382", ".5", ".618", ".764", ".854", "1.0", "1.236", "1.618"}; // An array of numbers, user-defined double fi[]; string fitxt[]; string fitxt100[]; int Sizefi=0,Sizefi_1=0; color ExtLine_; double number[64]; string numbertxt[64]; int numberFibo[64]; int numberPesavento[64]; int numberGartley[64]; int numberMix[64]; int numberGilmorQuality[64]; int numberGilmorGeometric[64]; int numberGilmorHarmonic[64]; int numberGilmorArithmetic[64]; int numberGilmorGoldenMean[64]; int numberSquare[64]; int numberCube[64]; int numberRectangle[64]; int numberExt[64]; string nameObj,nameObjtxt,save; // bool descript_b=false; / / PPWithBars - The output from the connector / / Descript - description of objects string PPWithBars, descript; // Matrix to find the missing bars afr - array of values of the time of the last five fractals and rendering of dynamic and static Phib // afrl - minima, afrh - maxima int afr[]={0,0,0,0,0,0,0,0,0,0}; double afrl[]={0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0}, afrh[]={0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0}, afrx[]={0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0}; // Options taymfrymov double openTF[]={0.0,0.0,0.0,0.0,0.0}, closeTF[]={0.0,0.0,0.0,0.0,0.0}, lowTF[]={0.0,0.0,0.0,0.0,0.0}, highTF[]={0.0,0.0,0.0,0.0,0.0}; double close_TF=0; string TF[]={"MN","W1","D1","H4","H1","m30","m15","m5","m1"}; string Period_tf; bool afrm=true; double ExtHL; double HL,HLp,kk,kj,Angle; // LowPrim,HighPrim,LowLast,HighLast - values of minima and maxima of bars double LowPrim,HighPrim,LowLast,HighLast; // numLowPrim,numHighPrim,numLowLast,numHighLast -number of bars int numLowPrim,numHighPrim,numLowLast,numHighLast,k,k1,k2,ki,kiPRZ=0,countLow1,countHigh1,shift,shift1; string txtkk; / / Time to the first spark of the zero bar fractal int timeFr1new; / / Count of fractals int countFr; / / Bar, to which we must draw a connecting line from the zero bar int countBarEnd = 0, TimeBarEnd; / / Bar, to which we must count from zero bar int numBar = 0; / / Object number int numOb; / / FlagFrNew = true - formed a new fractal or fractal first moved to another bar. = false - by default. bool flagFrNew = false; / / Identifier of the new beam bool newRay = true; / / FlagGartle - the emergence of a new pattern or disappearance Gartley Gartley Pattern bool flagGartle = false; / / Period of the current schedule int perTF; bool Demo; / / Variables for the zigzag developed wellx bool first=true; int NewBarTime=0, countbars=0; int lasthighpos,lastlowpos,realcnt=0; double lasthigh,lastlow; double int_to_d=0, int_to_d1=0, int_to_d2=0; int counted_bars, cbi, iBar; / / Average size of the bar of the current timeframe / / The average size of a bar double ASBar; / / Variables for Alex and ZigZag indicator of this built-in Ensign double ha[],la[],hi,li,si,sip,di,hm,lm,ham[],lam[],him,lim,lLast=0,hLast=0; int fs=0,fsp,countBar; int ai,bi,ai0,bi0,aim,bim; datetime tai,tbi,ti,tmh,tml; / / Fcount0 - at Reset counters missing bars at 0 bar fcount0 = true. / / At the next bar = false and you can define a turning point bool fh=false,fl=false,fcount0,PeakDetIni; /* / / Variables for swings Gunn double lLast_m=0, hLast_m=0; int countBarExt; // counter external bars int countBarl,countBarh; * / / / Variables for nen-ZigZag bool hi_nen; bool init_zz=true; / / Variables for the extended operation mode indicator int mFibo[]={0,0}, mPitch[]={0,0,0}, mFan[]={0,0}, mExpansion[]={0,0,0}, mVL[]={0,0,0}, mArcS[]={0,0}, mArcD[]={0,0}, mSpiral[]={0,0},mChannels[]={-1,-1,-1,-1,-1,-1,-1,-1,-1,-1}; / / Variables for the construction of Andrews' Pitchfork by candlelight int mPitchTime[]={0,0,0}; int mPitchTimeSave; double mPitchCena[]={0.0,0.0,0.0}; / / Variables for vts double ms[2]; / / Variables for Gartley patterns string vBullBear = ""; // variable to indicate bullish or bearish pattern string vNamePattern = ""; // variable to indicate the name of the pattern string vBullBearToNumberPattern = ""; string vNamePatternToNumberPattern = ""; int maxPeak, vPatOnOff, vPatNew=0; int Depth; double hBar, lBar; datetime tiZZ; bool FlagForD = true; // Permission to search the inception of the point D pattern (Gartley) datetime TimeForDmin = 0, TimeForDminToNumberPattern; datetime TimeForDmax = 0, TimeForDmaxToNumberPattern; double LevelForDmin = 0, LevelForDminToNumberPattern; double LevelForDmax = 0, LevelForDmaxToNumberPattern; double PeakCenaX[1],PeakCenaA[1],PeakCenaB[1],PeakCenaC[1],PeakCenaD[1]; datetime PeakTimeX[1],PeakTimeA[1],PeakTimeB[1],PeakTimeC[1],PeakTimeD[1]; int countGartley = 0; // Counter patterns int minBarsToNumberPattern; color ColorList[]; int ColorSize=0; int countColor = 0; bool flagExtGartleyTypeSearch2=false; int minBarsSave, minBarsX; string info_RZS_RL="",info_RZD_RL=""; // Variables for the zigzag Talex static int endbar = 0; static double endpr = 0; // Variables for calculating the size of the window in pixels for the Golden Spiral static int GPixels,VPixels; int rect[4],hwnd; int f=1; // Variables channels int DinamicChannels=-1; //+------------------------------------------------------------------+ //| Custom indicator initialization function | //+------------------------------------------------------------------+ int init() { string aa,aa1; int aa2, i; hwnd=WindowHandle(Symbol(),Period()); if(hwnd>0) { GetClientRect(hwnd,rect); GPixels=rect[2]; // here the function returns the number of pixels horizontally VPixels=rect[3]; // here the function returns a count of pixels vertically ) minBarsSave=minBars; IndicatorBuffers(8); // ------- // Gartley Patterns if (ExtGartleyTypeSearch<0) ExtGartleyTypeSearch=0; if (ExtGartleyTypeSearch>2) ExtGartleyTypeSearch=2; if (ExtHiddenPP<0) ExtHiddenPP=0; if (ExtHiddenPP>2) ExtHiddenPP=2; if (NumberPattern<1) NumberPattern=1; if (ExtIndicator==14) { if (auto) { double wrmassiv[]; if (minBar>=100) minBar=61.8; if (minBar<=0) minBar=61.8; if (maxBar>=100) maxBar=38.2; if (minBar<=0) minBar=38.2; ArrayResize(wrmassiv,Bars-1); for (i=Bars-1;i>0;i--) {wrmassiv[i]=High[i]-Low[i]+Point;} ArraySort (wrmassiv); i=MathFloor(minBar*Bars/100); StLevel=MathFloor(wrmassiv[i]/Point); i=MathFloor(maxBar*Bars/100); BigLevel=MathFloor(wrmassiv[i]/Point); //Print ("StLevel=",StLevel); //Print ("BigLevel=",BigLevel); ) ) if (ExtMaxBar>Bars) ExtMaxBar=Bars; if (ExtMaxBar>0) _maxbarZZ=ExtMaxBar; else _maxbarZZ=Bars; if (ExtGartleyTypeSearch>0) // Prepare a list of color values for butterflies Gartley, user-defined { //--------- if (!patternInfluence) { if (ExtMaxBar>0) { if (maxBarToD==0 || maxBarToD>ExtMaxBar) maxBarToD=ExtMaxBar-15; ) else if (maxBarToD==0) maxBarToD=Bars-15; ) if (ExtHiddenPP==0 || ExtHiddenPP==2) {ExtHidden=0; ExtStyleZZ=false;} if (RangeForPointD>2) RangeForPointD=2; //--------- i=-1; aa2=0; while (aa2>=0) { aa2=StringFind(ExtColorPatternList, ",",i+1); if (aa2>=0) {i=aa2;ColorSize++;} else { if (StringLen(ExtColorPatternList)-i>0) { if (StrToDouble(StringSubstr(ExtColorPatternList,i+1))>0) ColorSize++; ArrayResize(ColorList,ColorSize); aa1=ExtColorPatternList; for (i=0;i=0) aa1=StringSubstr(aa1,aa2+1); ) aa2=-1; ) ) ) ) // ------- if (ExtStyleZZ) {SetIndexStyle(0,DRAW_SECTION);} else {SetIndexStyle(0,DRAW_ARROW); SetIndexArrow(0,158);} if (ExtLabel>0) { SetIndexStyle(3,DRAW_ARROW); SetIndexArrow(3,ExtCodLabel); SetIndexStyle(4,DRAW_ARROW); SetIndexArrow(4,ExtCodLabel); ) else { SetIndexStyle(3,DRAW_LINE,STYLE_DOT); SetIndexStyle(4,DRAW_LINE,STYLE_DOT); ) SetIndexLabel(0,"ZUP"+ExtComplekt+" (zz"+ExtIndicator+")"); if (ExtIndicator==6) SetIndexLabel(5,"ZUP"+ExtComplekt+" DT6_"+minBars+"/"+ExtDeviation+"/"+ExtBackstep+"/GP"+GrossPeriod+""); else if (ExtIndicator==7) SetIndexLabel(5,"ZUP"+ExtComplekt+" DT7_"+minBars+"/GP"+GrossPeriod+""); else if (ExtIndicator==8) SetIndexLabel(5,"ZUP"+ExtComplekt+" DT8_"+minBars+"/"+ExtDeviation+"/GP"+GrossPeriod+""); if (ExtLabel>0) { SetIndexLabel(1,"ZUP"+ExtComplekt+" zz"+ExtIndicator+" H_PeakDet"); SetIndexLabel(2,"ZUP"+ExtComplekt+" zz"+ExtIndicator+" L_PeakDet"); SetIndexLabel(3,"ZUP"+ExtComplekt+" zz"+ExtIndicator+" UpTrend"); SetIndexLabel(4,"ZUP"+ExtComplekt+" zz"+ExtIndicator+" DownTrend"); ) else { if (chHL_PeakDet_or_vts) { PeakDetIni=true; SetIndexLabel(1,"ZUP"+ExtComplekt+" zz"+ExtIndicator+" H_PeakDet"); SetIndexLabel(2,"ZUP"+ExtComplekt+" zz"+ExtIndicator+" L_PeakDet"); SetIndexLabel(3,"ZUP"+ExtComplekt+" zz"+ExtIndicator+" H_chHL"); SetIndexLabel(4,"ZUP"+ExtComplekt+" zz"+ExtIndicator+" L_chHL"); ) else { SetIndexLabel(1,"ZUP"+ExtComplekt+" zz"+ExtIndicator+" H_vts"); SetIndexLabel(2,"ZUP"+ExtComplekt+" zz"+ExtIndicator+" L_vts"); SetIndexLabel(3,"ZUP"+ExtComplekt+" zz"+ExtIndicator+" H_vts1"); SetIndexLabel(4,"ZUP"+ExtComplekt+" zz"+ExtIndicator+" L_vts1"); ) ) // Levels of previous peaks SetIndexStyle(1,DRAW_LINE,STYLE_DOT); SetIndexStyle(2,DRAW_LINE,STYLE_DOT); SetIndexBuffer(1,ham); SetIndexBuffer(2,lam); // Levels of evidence SetIndexBuffer(3,ha); SetIndexBuffer(4,la); SetIndexBuffer(0,zz); SetIndexBuffer(5,nen_ZigZag); SetIndexBuffer(6,zzL); SetIndexBuffer(7,zzH); SetIndexStyle(5,DRAW_ARROW); SetIndexArrow(5,159); SetIndexEmptyValue(0,0.0); SetIndexEmptyValue(1,0.0); SetIndexEmptyValue(2,0.0); SetIndexEmptyValue(3,0.0); SetIndexEmptyValue(4,0.0); SetIndexEmptyValue(5,0.0); SetIndexEmptyValue(6,0.0); SetIndexEmptyValue(7,0.0); if (ExtIndicator<6 || ExtIndicator>10) { switch (Period()) { case 1 : {Period_tf=TF[8];break;} case 5 : {Period_tf=TF[7];break;} case 15 : {Period_tf=TF[6];break;} case 30 : {Period_tf=TF[5];break;} case 60 : {Period_tf=TF[4];break;} case 240 : {Period_tf=TF[3];break;} case 1440 : {Period_tf=TF[2];break;} case 10080 : {Period_tf=TF[1];break;} case 43200 : {Period_tf=TF[0];break;} ) ) else { switch (GrossPeriod) { case 1 : {Period_tf=TF[8];break;} case 5 : {Period_tf=TF[7];break;} case 15 : {Period_tf=TF[6];break;} case 30 : {Period_tf=TF[5];break;} case 60 : {Period_tf=TF[4];break;} case 240 : {Period_tf=TF[3];break;} case 1440 : {Period_tf=TF[2];break;} case 10080 : {Period_tf=TF[1];break;} case 43200 : {Period_tf=TF[0];break;} ) if (GrossPeriod>43200) { if (MathMod(GrossPeriod,43200)>0) Period_tf=GrossPeriod; else Period_tf=TF[0]+GrossPeriod/43200 + ""; ) else if (GrossPeriod<43200) { if (GrossPeriod>10080) { if (MathMod(GrossPeriod,10080)>0) Period_tf=GrossPeriod; else Period_tf="W"+GrossPeriod/10080 + ""; ) else if (GrossPeriod<10080) { if (GrossPeriod>1440) { if (MathMod(GrossPeriod,1440)>0) Period_tf=GrossPeriod; else Period_tf="D"+GrossPeriod/1440 + ""; ) else if (GrossPeriod<1440) { if (GrossPeriod!=60) { if (MathMod(GrossPeriod,60)>0) Period_tf=GrossPeriod; else Period_tf="H"+GrossPeriod/60 + ""; ) ) ) ) ) if (ExtIndicator==1) if (minSize!=0) di=minSize*Point/2; if (ExtIndicator==2) {di=minSize*Point; countBar=minBars;} if (ExtIndicator==3) {countBar=minBars;} if (ExtIndicator>5 && ExtIndicator<11 && GrossPeriod>Period()) { if (GrossPeriod==43200 && Period()==10080) maxBarToD=maxBarToD*5; else maxBarToD=maxBarToD*GrossPeriod/Period(); ) if (ExtIndicator<6 ||ExtIndicator>10) GrossPeriod=Period(); if (ExtFiboType<0) ExtFiboType=0; if (ExtFiboType>2) ExtFiboType=2; if (ExtFiboType==2) // Roster Phib, user-defined { i=-1; aa2=0; while (aa2>=0) { aa2=StringFind(ExtFiboTypeFree, ",",i+1); if (aa2>=0) {i=aa2;Sizefi++;} else { if (StringLen(ExtFiboTypeFree)-i>0) { if (StrToDouble(StringSubstr(ExtFiboTypeFree,i+1))>0) Sizefi++; arrResize(Sizefi); aa1=ExtFiboTypeFree; for (i=0;i=0) aa1=StringSubstr(aa1,aa2+1); ) // aa2=-1; ) ) ) ) // ------- // Validation imposed by external variables if (ExtDelta<=0) ExtDelta=0.001; if (ExtDelta>1) ExtDelta=0.999; if (ExtHidden<0) ExtHidden=0; if (ExtHidden>5) ExtHidden=5; if (ExtDeltaType<0) ExtDeltaType=0; if (ExtDeltaType>3) ExtDeltaType=3; if (ExtFiboChoice<0) ExtFiboChoice=0; if (ExtFiboChoice>11) ExtFiboChoice=11; if (ExtPivotZZ1Num>9) ExtPivotZZ1Num=9; if (ExtPivotZZ2Num>9) ExtPivotZZ2Num=9; if (ExtPivotZZ1Num==ExtPivotZZ2Num) { if (ExtPivotZZ1Num>0) ExtPivotZZ1Num=ExtPivotZZ2Num-1; ) if (ExtFractalEnd>0) { if (ExtFractalEnd<1) ExtFractalEnd=1; ) if (ExtPitchforkStatic>4) ExtPitchforkStatic=4; if (ExtPitchforkDinamic>4) ExtPitchforkDinamic=4; if (ExtCM_0_1A_2B_Dinamic<0) ExtCM_0_1A_2B_Dinamic=0; if (ExtCM_0_1A_2B_Dinamic>5) ExtCM_0_1A_2B_Dinamic=5; if (ExtCM_0_1A_2B_Static<0) ExtCM_0_1A_2B_Static=0; if (ExtCM_0_1A_2B_Static>5) ExtCM_0_1A_2B_Static=5; if (ExtCM_FiboDinamic<0) ExtCM_FiboDinamic=0; if (ExtCM_FiboDinamic>1) ExtCM_FiboDinamic=1; if (ExtCM_FiboStatic<0) ExtCM_FiboStatic=0; if (ExtCM_FiboStatic>1) ExtCM_FiboStatic=1; //-------------------------------------------- if (ExtPitchforkStaticNum<3) ExtPitchforkStaticNum=3; if (ExtFiboStaticNum<2) ExtFiboStaticNum=2; if (ExtFiboStaticNum>9) { aa=DoubleToStr(ExtFiboStaticNum,0); aa1=StringSubstr(aa,0,1); mFibo[0]=StrToInteger(aa1); aa1=StringSubstr(aa,1,1); mFibo[1]=StrToInteger(aa1); ) else { mFibo[0]=ExtFiboStaticNum; mFibo[1]=ExtFiboStaticNum-1; ) if (ExtFiboFanNum<1) ExtFiboFanNum=1; if (ExtFiboFanNum>9) { aa=DoubleToStr(ExtFiboFanNum,0); aa1=StringSubstr(aa,0,1); mFan[0]=StrToInteger(aa1); aa1=StringSubstr(aa,1,1); mFan[1]=StrToInteger(aa1); ) else { mFan[0]=ExtFiboFanNum; mFan[1]=ExtFiboFanNum-1; ) if (ExtPitchforkStaticNum>99) { aa=DoubleToStr(ExtPitchforkStaticNum,0); aa1=StringSubstr(aa,0,1); mPitch[0]=StrToInteger(aa1); aa1=StringSubstr(aa,1,1); mPitch[1]=StrToInteger(aa1); aa1=StringSubstr(aa,2,1); mPitch[2]=StrToInteger(aa1); ) else { mPitch[0]=ExtPitchforkStaticNum; mPitch[1]=ExtPitchforkStaticNum-1; mPitch[2]=ExtPitchforkStaticNum-2; ) if (ExtFiboExpansion<2) ExtFiboExpansion=0; if (ExtFiboExpansion>0) { if (ExtFiboExpansion>99) { aa=DoubleToStr(ExtFiboExpansion,0); aa1=StringSubstr(aa,0,1); mExpansion[0]=StrToInteger(aa1); aa1=StringSubstr(aa,1,1); mExpansion[1]=StrToInteger(aa1); aa1=StringSubstr(aa,2,1); mExpansion[2]=StrToInteger(aa1); ) else { mExpansion[0]=ExtFiboExpansion; mExpansion[1]=ExtFiboExpansion-1; mExpansion[2]=ExtFiboExpansion-2; ) ) if (ExtPitchforkCandle) { mPitchTime[0]=ExtDateTimePitchfork_1; mPitchTime[1]=ExtDateTimePitchfork_2; mPitchTime[2]=ExtDateTimePitchfork_3; if (ExtPitchfork_1_HighLow) { mPitchCena[0]=High[iBarShift(Symbol(),Period(),ExtDateTimePitchfork_1,true)]; mPitchCena[1]=Low[iBarShift(Symbol(),Period(),ExtDateTimePitchfork_2,true)]; mPitchCena[2]=High[iBarShift(Symbol(),Period(),ExtDateTimePitchfork_3,true)]; ) else { mPitchCena[0]=Low[iBarShift(Symbol(),Period(),ExtDateTimePitchfork_1,true)]; mPitchCena[1]=High[iBarShift(Symbol(),Period(),ExtDateTimePitchfork_2,true)]; mPitchCena[2]=Low[iBarShift(Symbol(),Period(),ExtDateTimePitchfork_3,true)]; ) if (mPitchCena[0]<=0 || mPitchCena[1]<=0 || mPitchCena[2]<=0) {ExtPitchforkCandle=false;ExtPitchforkStatic=0;} ) if (ExtFiboTimeNum<=2) ExtFiboTimeNum=0; if (ExtFiboTimeNum>999) ExtFiboTimeNum=0; if (ExtVLStaticNum>0) { if (ExtVLStaticNum<2) ExtVLStaticNum=2; if (ExtVLStaticNum>99) { aa=DoubleToStr(ExtVLStaticNum,0); aa1=StringSubstr(aa,0,1); mVL[0]=StrToInteger(aa1); aa1=StringSubstr(aa,1,1); mVL[1]=StrToInteger(aa1); aa1=StringSubstr(aa,2,1); mVL[2]=StrToInteger(aa1); ) else { mVL[0]=ExtVLStaticNum; mVL[1]=ExtVLStaticNum-1; mVL[2]=ExtVLStaticNum-2; ) ) if (ExtArcStaticNum>0) { if (ExtArcStaticNum<2) ExtArcStaticNum=2; if (ExtArcStaticNum<12 && ExtArcStaticNum>9) ExtArcStaticNum=9; if (ExtArcStaticNum>98) ExtArcStaticNum=98; if (ExtArcStaticNum>=12) { aa=DoubleToStr(ExtArcStaticNum,0); aa1=StringSubstr(aa,1,1); mArcS[0]=StrToInteger(aa1); aa1=StringSubstr(aa,0,1); mArcS[1]=StrToInteger(aa1); if (mArcS[0]==0) {ExtArcStaticNum=0; mArcS[1]=0;} ) else { mArcS[1]=ExtArcStaticNum; mArcS[0]=ExtArcStaticNum-1; ) ) if (ExtArcDinamicNum>0) { if (ExtArcDinamicNum>90) ExtArcStaticNum=90; if (ExtArcDinamicNum>9) { aa=DoubleToStr(ExtArcDinamicNum,0); aa1=StringSubstr(aa,1,1); mArcD[0]=StrToInteger(aa1); aa1=StringSubstr(aa,0,1); mArcD[1]=StrToInteger(aa1); if (mArcD[0]>0) mArcD[0]=0; ) else { mArcD[1]=0; mArcD[0]=ExtArcDinamicNum; ) ) // Golden spiral if (ExtSpiralNum>0) { if(goldenSpiralCycle <= 0) goldenSpiralCycle = 1; if(accurity <= 0) accurity = 0.2; if (ExtSpiralNum<2) ExtSpiralNum=2; if (ExtSpiralNum>98) ExtSpiralNum=98; if (ExtSpiralNum>9) { aa=DoubleToStr(ExtSpiralNum,0); aa1=StringSubstr(aa,1,1); mSpiral[0]=StrToInteger(aa1); aa1=StringSubstr(aa,0,1); mSpiral[1]=StrToInteger(aa1); if (mSpiral[0]==0) {ExtSpiralNum=0; mSpiral[1]=0;} ) else { mSpiral[1]=ExtSpiralNum; mSpiral[0]=ExtSpiralNum-1; ) ) // Channels if (ExtChannelsNum>9876543210) ExtChannelsNum=0; if (ExtChannelsNum>0) { aa=DoubleToStr(ExtChannelsNum,0); aa2=StringLen(aa); for (i=0;i=0) {mChannels[i]=-1; ArraySort(mChannels,WHOLE_ARRAY,0,MODE_DESCEND); i--;} ) for (i=1;i<=9;i++) { if (mChannels[i]==0) {DinamicChannels=i; break;} // Print("mChannels["+i+"]=",mChannels[i]); ) ) if (ExtSave) { MathSrand(LocalTime()); save=MathRand(); ) if (ExtCM_0_1A_2B_Static==4 || ExtCM_0_1A_2B_Dinamic==4) { for (i=Bars-1; i>-1; i--) { ASBar=ASBar + iHigh(NULL,GrossPeriod,i) - iLow(NULL,GrossPeriod,i) + Point; ) ASBar=ASBar/Bars; ) array_(); perTF=Period(); Demo=IsDemo(); delete_objects1(); return(0); ) //+------------------------------------------------------------------+ //| Deinitialization. Removing all the trend lines and text objects //+------------------------------------------------------------------+ int deinit() { int i; delete_objects_dinamic(); delete_objects1(); delete_objects3(); delete_objects4(); delete_objects5(); delete_objects_spiral(); delete_objects_number(); ObjectDelete("fiboS" + ExtComplekt+"_"); ObjectDelete("fiboFanS" + ExtComplekt+"_"); ObjectDelete("RLineS" + ExtComplekt+"_"); ObjectDelete("pitchforkS" + ExtComplekt+"_"); ObjectDelete("pmedianaS" + ExtComplekt+"_"); ObjectDelete("1-2pmedianaS" + ExtComplekt+"_"); ObjectDelete("fiboTime1" + ExtComplekt+"_");ObjectDelete("fiboTime2" + ExtComplekt+"_");ObjectDelete("fiboTime3" + ExtComplekt+"_"); ObjectDelete("fiboTime1Free" + ExtComplekt+"_");ObjectDelete("fiboTime2Free" + ExtComplekt+"_");ObjectDelete("fiboTime3Free" + ExtComplekt+"_"); ObjectDelete("UTL" + ExtComplekt+"_");ObjectDelete("LTL" + ExtComplekt+"_"); ObjectDelete("UWL" + ExtComplekt+"_");ObjectDelete("LWL" + ExtComplekt+"_"); ObjectDelete("ISL_S" + ExtComplekt+"_"); ObjectDelete("RZS" + ExtComplekt+"_"); ObjectDelete("CL" + ExtComplekt+"_"); ObjectDelete("PivotZoneS" + ExtComplekt+"_"); ObjectDelete("FanMedianaStatic" + ExtComplekt+"_"); ObjectDelete("FiboFan" + ExtComplekt+"_"); ObjectDelete("FiboArcS" + ExtComplekt+"_"); ObjectDelete("LinePivotZZ" + "1" + ExtComplekt+"_"); ObjectDelete("LinePivotZZ" + "2" + ExtComplekt+"_"); for (i=0;i<9; i++) { nameObj="LCChannel" + i + ExtComplekt+"_"; ObjectDelete(nameObj); nameObj="LTChannel" + i + ExtComplekt+"_"; ObjectDelete(nameObj); ) for (i=0; i<7; i++) { nameObj="VLS"+i+" " + ExtComplekt+"_"; ObjectDelete(nameObj); ) Comment(""); return(0); ) //******************************************************** // HOME int start() { if ((ExtIndicator==6 || ExtIndicator==7 || ExtIndicator==8 || ExtIndicator==10) && Period()>GrossPeriod) { ArrayInitialize(zz,0);ArrayInitialize(zzL,0);ArrayInitialize(zzH,0);ArrayInitialize(nen_ZigZag,0); init_zz=true; return; ) counted_bars=IndicatorCounted(); if (perTF!=Period()) { delete_objects1(); perTF=Period(); ) if (Demo!=IsDemo()) { delete_objects1(); Demo=IsDemo(); counted_bars=0; ) //----------------------------------------- // // 1. // // Block fill buffers. Start. //----------------------------------------- // zz[] - buffer, the data from which are used for the rendering of the ZigZag-a // zzL[] - array of minima rough // zzH[] - array of maxima rough // //----------------------------------------- if (Bars-IndicatorCounted()>2) { if (ExtMaxBar>0) cbi=ExtMaxBar; else cbi=Bars-1; tiZZ=0; if (ExtIndicator==1) {ti=0; ai=0; bi=0; tai=0; tbi=0; fs=0; si=0; sip=0;} lBar=0; hBar=0; ArrayInitialize(zz,0);ArrayInitialize(zzL,0);ArrayInitialize(zzH,0);ArrayInitialize(nen_ZigZag,0); init_zz=true; afrm=true; delete_objects_dinamic(); delete_objects1(); delete_objects3(); flagExtGartleyTypeSearch2=false; vPatOnOff=0; PeakDetIni=true; ) else { if (ExtIndicator==1) cbi=Bars-IndicatorCounted()-1; else cbi=Bars-IndicatorCounted(); if (ExtMinBar>0&&(ExtIndicator==0||ExtIndicator==1||ExtIndicator==2||ExtIndicator==3||ExtIndicator==5||ExtIndicator==6||ExtIndicator==7||ExtIndicator==8||ExtIndicator==10||ExtIndicator==11) && tiZZ==iTime(NULL,GrossPeriod,0)) return (0); else if (lBar<=iLow(NULL,GrossPeriod,0) && hBar>=iHigh(NULL,GrossPeriod,0) && tiZZ==iTime(NULL,GrossPeriod,0)) return(0); else { if (tiZZ0) PivotZZ(ExtPivotZZ1Color, ExtPivotZZ1Num, 1); if (ExtPivotZZ2Num==1 && ExtPivotZZ2Color>0) PivotZZ(ExtPivotZZ2Color, ExtPivotZZ2Num, 2); ) ) lBar=iLow(NULL,GrossPeriod,0); hBar=iHigh(NULL,GrossPeriod,0); tiZZ=iTime(NULL,GrossPeriod,0); ) ) switch (ExtIndicator) { case 0 : {ZigZag_(); break;} case 1 : {ang_AZZ_(); break;} case 2 : {Ensign_ZZ(); break;} case 3 : {Ensign_ZZ(); break;} case 4 : {ZigZag_tauber();break;} case 5 : {GannSwing(); break;} case 6 : {nenZigZag(); break;} // DT-ZigZag - ? ????????????, ???????????????? ???????? ZigZag_new_nen3.mq4 case 7 : {nenZigZag(); break;} // DT-ZigZag - ??????? ???????, ??????? ??????? ??????????? klot - DT_ZZ.mq4 case 8 : {nenZigZag(); break;} // DT-ZigZag - ??????? ???????, ??????? ??????? ??????????? Candid - CZigZag.mq4 case 10 : {nenZigZag(); break;} // DT-ZigZag - ??????? ??????? ExtIndicator=5 ? ?????? DT - ??????? ?????? Swing_zz.mq4 // Search patterns case 11 : { if (ExtGartleyTypeSearch<2) vPatOnOff = 0; ZigZag_(); if (ExtGartleyTypeSearch==2 && vPatOnOff == 1) flagExtGartleyTypeSearch2=true; if (vPatOnOff==1 && vPatNew==0) { vPatNew=1; flagGartle=true; if(ExtPlayAlert) { Alert (Symbol()," ",Period()," ???????? ????? ???????"); PlaySound("alert.wav"); ) if (ExtSendMail) _SendMail("There was a pattern","on " + Symbol() + " " + Period() + " pattern " + vBullBear + " " + vNamePattern); ) else if (vPatOnOff==0 && vPatNew==1) { vPatNew=0; flagGartle=true; FlagForD=true; ) if (minBarsSave!=minBarsX) { afrm=true; delete_objects_dinamic(); delete_objects1(); counted_bars=0; minBarsSave=minBarsX; PeakDetIni=true; ) break; ) case 12 : {ZZTalex(minBars);break;} case 13 : {ZigZag_SQZZ();break;} // ZigZag goods manager case 14 : {ZZ_2L_nen();break;} // ZigZag wellx ) if (ExtHidden<5) // Permission for withdrawal of equipment. Start. { if(!chHL_PeakDet_or_vts) { if (ExtLabel==0) {i_vts(); i_vts1();} ) else if (PeakDetIni && PeakDet) { PeakDetIni=false; double kl=0,kh=0; // kl - min; kh - max for (shift=Bars; shift>0; shift--) { if (zzH[shift]>0) {kh=zzH[shift];} if (zzL[shift]>0) {kl=zzL[shift];} lam[shift]=kl; ham[shift]=kh; ) ) // Initialize matrix matriza(); if (infoTF) if (close_TF!=Close[0]) info_TF(); ) //----------------------------------------- // Block fill buffers. End. //----------------------------------------- if (ExtHidden<5) // Permission for withdrawal of equipment. Start. { //====================== //====================== //====================== //----------------------------------------- // // 2. // // Block data preparation. Start. //----------------------------------------- if (Bars - counted_bars>2 || flagFrNew) { // Search time and numbers of bars, to which will be drawn connecting lines if (countBarEnd==0) { if (ExtFractalEnd>0) { k=ExtFractalEnd; for (shift=0; shift0; shift++) { if (zz[shift]>0 && zzH[shift]>0) {countBarEnd=shift; TimeBarEnd=Time[shift]; k--;} ) ) else { countBarEnd=Bars-3; TimeBarEnd=Time[Bars-3]; ) ) else { countBarEnd=iBarShift(Symbol(),Period(),TimeBarEnd); ) ) //----------------------------------------- // Block data preparation. End. //----------------------------------------- //----------------------------------------- // // 3. // // Block checks and removal of lines, // lost their relevance. Start. //----------------------------------------- // Correction of connecting lines and numbers. Start. if (Bars - counted_bars<3) { // Search time bar of the first extremum, counting from zero bar for (shift1=0; shift10.0 && (zzH[shift1]==zz[shift1] || zzL[shift1]==zz[shift1])) { timeFr1new=Time[shift1]; break; ) ) // Search bar, on which the first extremum was previously. shift=iBarShift(Symbol(),Period(),afr[0]); // A new ray of ZigZag if ((zzH[shift1]>0 && afrl[0]>0) || (zzL[shift1]>0 && afrh[0]>0)) { newRay=true; if (!ExtDinamic) { ExtNumberPeak=false; ExtFiboStatic=false; ExtPitchforkStatic=0; ExtFiboFanNum=0; ExtFiboExpansion=0; ExtVLStaticNum=0; ExtArcStaticNum=0; ExtSpiralNum=0; ExtPivotZZ2Num=0; ExtChannelsNum=0; ExtFiboTimeNum=0; ) else { if (StringSubstr(ExtVisibleDinamic,0,1)!="1") ExtNumberPeak=false; if (StringSubstr(ExtVisibleDinamic,1,1)!="1") ExtFiboStatic=false; if (StringSubstr(ExtVisibleDinamic,2,1)!="1") ExtPitchforkStatic=0; if (StringSubstr(ExtVisibleDinamic,3,1)!="1") ExtFiboFanNum=0; if (StringSubstr(ExtVisibleDinamic,4,1)!="1") ExtFiboExpansion=0; if (StringSubstr(ExtVisibleDinamic,5,1)!="1") ExtVLStaticNum=0; if (StringSubstr(ExtVisibleDinamic,6,1)!="1") ExtArcStaticNum=0; if (StringSubstr(ExtVisibleDinamic,7,1)!="1") ExtSpiralNum=0; if (StringSubstr(ExtVisibleDinamic,8,1)!="1") ExtPivotZZ2Num=0; if (StringSubstr(ExtVisibleDinamic,9,1)!="1") ExtChannelsNum=0; if (StringSubstr(ExtVisibleDinamic,10,1)!="1") ExtFiboTimeNum=0; ) if (ExtAlert) { Alert (Symbol()," ",Period()," ???????? ????? ??? ZigZag"); PlaySound("alert.wav"); ) ) // Comparison of the current value of the extremum in order, which was previously // Form a new extreme if (timeFr1new!=afr[0]) { flagFrNew=true; if (shift>=shift1) numBar=shift; else numBar=shift1; afrm=true; ) // Extrema on the peak shifted to another bar if (afrh[0]>0 && zz[shift]==0.0) { flagFrNew=true; if (numBar0 && zz[shift]==0.0) { flagFrNew=true; if (numBar0) { flagFrNew=true; numBar=0; delete_objects2(afr[0]); afrx[0]=High[shift]; afrh[0]=High[shift]; if (ExtFiboFanDinamic) screenFiboFanD(); if (mFibo[1]==0 && ExtFiboStatic) screenFiboS(); if (ExtFiboDinamic) screenFiboD(); if (ExtPitchforkDinamic>0) screenPitchforkD(); if (ExtVLDinamicColor>0) VLD(); if (mVL[2]==0 && ExtVLStaticNum>0) VLS(); if (ExtFiboTimeNum>2) fiboTimeX (); if (ExtPitchforkStatic>0) { if (ExtPitchforkCandle) { if (iBarShift(Symbol(),Period(),ExtDateTimePitchfork_3)==0) screenPitchforkS(); ) else { if (mPitch[2]==0) screenPitchforkS(); ) ) if (mExpansion[2]==0 && ExtFiboExpansion>0) FiboExpansion(); if (mFan[1]==0 && ExtFiboFanNum>0 && ExtFiboFanColor>0) screenFiboFan(); if (ExtArcDinamicNum>0) screenFiboArcD(); if (ExtArcStaticNum>0) screenFiboArcS(); ) //============= 1 shifted maximum. End. // //============= 1 shifted minimum. Start. if (afrl[0]-Low[shift]!=0 && afrl[0]>0) { flagFrNew=true; numBar=0; delete_objects2(afr[0]); afrx[0]=Low[shift]; afrl[0]=Low[shift]; if (mFibo[1]==0 && ExtFiboStatic) screenFiboS(); if (ExtFiboDinamic) screenFiboD(); if (ExtPitchforkDinamic>0) screenPitchforkD(); if (ExtFiboFanDinamic) screenFiboFanD(); if (ExtVLDinamicColor>0) VLD(); if (mVL[2]==0 && ExtVLStaticNum>0) VLS(); if (ExtFiboTimeNum>2) fiboTimeX (); if (ExtPitchforkStatic>0) { if (ExtPitchforkCandle) { if (iBarShift(Symbol(),Period(),ExtDateTimePitchfork_3)==0) screenPitchforkS(); ) else { if (mPitch[2]==0) screenPitchforkS(); ) ) if (mExpansion[2]==0 && ExtFiboExpansion>0) FiboExpansion(); if (mFan[1]==0 && ExtFiboFanNum>0 && ExtFiboFanColor>0) screenFiboFan(); if (ExtArcDinamicNum>0) screenFiboArcD(); if (ExtArcStaticNum>0) screenFiboArcS(); ) //============= 1 shifted minimum. End. //-----------3 Shifted the maximum or minimum, but remained at the same bar. End. // Find Missing fractals and deleting lines emanating from these fractals. Start. countBarEnd=iBarShift(Symbol(),Period(),TimeBarEnd); for (k=0; k<5; k++) { // Check highs. if (afrh[k]>0) { // Search bar, which was that the fractal shift=iBarShift(Symbol(),Period(),afr[k]); if (zz[shift]==0) { flagFrNew=true; if (shift>numBar) numBar=shift; afrm=true; numHighPrim=shift; numHighLast=0;HighLast=0.0; for (k1=shift+1; k1<=countBarEnd; k1++) { if (zzH[k1]>0) { if (ZigZagHighLow) HighLast=High[k1]; else HighLast=zzH[k1]; numHighLast=k1; nameObj="_" + ExtComplekt + "ph" + Time[numHighPrim] + "_" + Time[numHighLast]; numOb=ObjectFind(nameObj); if (numOb>-1) { ObjectDelete(nameObj); nameObjtxt="_" + ExtComplekt + "phtxt" + Time[numHighPrim] + "_" + Time[numHighLast]; ObjectDelete(nameObjtxt); ) ) ) ) ) // Check minima. if (afrl[k]>0) { // Search bar, which was that the fractal shift=iBarShift(Symbol(),Period(),afr[k]); if (zz[shift]==0) { flagFrNew=true; if (shift>numBar) numBar=shift; afrm=true; numLowPrim=shift; numLowLast=0;LowLast=10000000; for (k1=shift+1; k1<=countBarEnd; k1++) { if (zzL[k1]>0) { if (ZigZagHighLow) LowLast=Low[k1]; else LowLast=zzL[k1]; numLowLast=k1; nameObj="_" + ExtComplekt + "pl" + Time[numLowPrim] + "_" + Time[numLowLast]; numOb=ObjectFind(nameObj); if (numOb>-1) { ObjectDelete(nameObj); nameObjtxt="_" + ExtComplekt + "pltxt" + Time[numLowPrim] + "_" + Time[numLowLast]; ObjectDelete(nameObjtxt); ) ) ) ) ) ) // Find Missing fractals and deleting lines emanating from these fractals. End. // Rewrite the matrix. Start. matriza (); // Rewriting the matrix. End. ) // Correction of connecting lines and numbers. End. //----------------------------------------- // Block checks and removal of lines, // lost their relevance. End. //----------------------------------------- // Counting the number of fractals. Start. countFractal(); // Counting the number of fractals. End. //----------------------------------------- // // 4. // // Power output connecting lines. Start. //----------------------------------------- if (Bars - counted_bars>2 && ExtHidden>0) { //-----------1 Drawing highs. Start. //+--------------------------------------------------------------------------+ //| Conclusion connecting lines and the numbers Pesavento and 0.886 for the maxima ZigZag-a //| Drawing starts at zero bar //+--------------------------------------------------------------------------+ numLowPrim=0; numLowLast=0; numHighPrim=0; numHighLast=0; LowPrim=0.0; LowLast=0.0; HighPrim=0.0; HighLast=0.0; Angle=-100; if (flagFrNew && !flagGartle) countFr=1; else countFr=ExtFractal; for (k=0; (k0 && countFr>0); k++) { if (zzL[k]>0.0 && (zzL[k]0 && zzL[k]==zz[k]) { if (ZigZagHighLow) LowPrim=Low[k]; else LowPrim=zzL[k]; numLowPrim=k; ) if (zzH[k]>0.0 && zzH[k]==zz[k]) { if (HighPrim>0) { if (ZigZagHighLow) HighLast=High[k]; else HighLast=zzH[k]; numHighLast=k; HL=HighLast-LowPrim; kj=(HighPrim-HighLast)*1000/(numHighLast-numHighPrim); if (HL>0 && (Angle>=kj || Angle==-100)) // Checking the angle line { Angle=kj; // Creating lines and text object HLp=HighPrim-LowPrim; k1=MathCeil((numHighPrim+numHighLast)/2); kj=HLp/HL; if (ExtPPWithBars==0) PPWithBars=""; else if (ExtPPWithBars==1) PPWithBars=" ("+(numHighLast-numHighPrim)+")"; else if (ExtPPWithBars==2) PPWithBars=" ("+(numHighLast-numLowPrim)+"-"+(numLowPrim-numHighPrim)+")"; else if (ExtPPWithBars==3) { int_to_d1=(numLowPrim-numHighPrim); int_to_d2=(numHighLast-numLowPrim); int_to_d=int_to_d1/int_to_d2; PPWithBars=" ("+DoubleToStr(int_to_d,2)+")"; ) else if (ExtPPWithBars==4) { int_to_d1=(Time[numLowPrim]-Time[numHighPrim]); int_to_d2=(Time[numHighLast]-Time[numLowPrim]); int_to_d=int_to_d1/int_to_d2; PPWithBars=" ("+DoubleToStr(int_to_d,2)+")"; ) else if (ExtPPWithBars==5) { int_to_d1=(numLowPrim-numHighPrim)*(High[numHighPrim]-Low[numLowPrim]); int_to_d2=(numHighLast-numLowPrim)*(High[numHighLast]-Low[numLowPrim]); int_to_d=int_to_d1/int_to_d2; PPWithBars=" ("+DoubleToStr(int_to_d,2)+")"; ) else if (ExtPPWithBars==7) { int_to_d1=((High[numHighLast]-Low[numLowPrim])/Point)/(numHighLast-numLowPrim); int_to_d2=((High[numHighPrim]-Low[numLowPrim])/Point)/(numLowPrim-numHighPrim); PPWithBars=" ("+DoubleToStr(int_to_d1,3)+"/"+DoubleToStr(int_to_d2,3)+")"; ) else if (ExtPPWithBars==8) { int_to_d1=MathSqrt((numLowPrim-numHighPrim)*(numLowPrim-numHighPrim) + ((High[numHighPrim]-Low[numLowPrim])/Point)*((High[numHighPrim]-Low[numLowPrim])/Point)); int_to_d2=MathSqrt((numHighLast-numLowPrim)*(numHighLast-numLowPrim) + ((High[numHighLast]-Low[numLowPrim])/Point)*((High[numHighLast]-Low[numLowPrim])/Point)); int_to_d=int_to_d1/int_to_d2; PPWithBars=" ("+DoubleToStr(int_to_d,2)+")"; ) else if (ExtPPWithBars==9) { int_to_d1=100-100*Low[numLowPrim]/High[numHighLast]; int_to_d2=100*High[numHighPrim]/Low[numLowPrim]-100; PPWithBars=" ("+DoubleToStr(int_to_d1,1)+"/"+DoubleToStr(int_to_d2,1)+")"; ) // ExtPPWithBars=6 Calculate kolichstvo points and the percentage deviation from the retracement "Pesavento" ExtLine_=ExtLine; if (kj>0.1 && kj<9.36) { // ???????? ?????????? ??????? (????? ?????????). % recovery between the peaks kk=kj; k2=1; Pesavento_patterns(); if (k2<0) // percentage recovery of Pesavento and 0.886 { ExtLine_=ExtLine886; if (ExtHidden!=4) { nameObj="_" + ExtComplekt + "phtxt" + Time[numHighPrim] + "_" + Time[numHighLast]; ObjectCreate(nameObj,OBJ_TEXT,0,Time[k1],(HighPrim+HighLast)/2); if (ExtPPWithBars==6) { int_to_d=MathAbs((kk-kj)/kk)*100; PPWithBars=" ("+DoubleToStr((LowPrim+(HighLast-LowPrim)*kk-HighPrim)/Point,0)+"/"+DoubleToStr(int_to_d,2)+"%)"; ) descript=txtkk; ObjectSetText(nameObj,txtkk+PPWithBars,ExtSizeTxt,"Arial", colorPPattern); if (ExtPPWithBars==6) PPWithBars=""; ) ) else // percentage recovery (not Pesavento and 0.886) { if (ExtHidden==1 || ExtHidden==4) { nameObj="_" + ExtComplekt + "phtxt" + Time[numHighPrim] + "_" + Time[numHighLast]; ObjectCreate(nameObj,OBJ_TEXT,0,Time[k1],(HighPrim+HighLast)/2); descript=DoubleToStr(kk,3); if (ExtDeltaType==3) { ObjectSetText(nameObj,""+DoubleToStr(kk,3)+PPWithBars,ExtSizeTxt,"Arial",colorPPattern); ) else { ObjectSetText(nameObj,""+DoubleToStr(kk,2)+PPWithBars,ExtSizeTxt,"Arial",colorPPattern); ) ) ) if ((ExtHidden==2 && k2<0) || ExtHidden!=2) { nameObj="_" + ExtComplekt + "ph" + Time[numHighPrim] + "_" + Time[numHighLast]; ObjectCreate(nameObj,OBJ_TREND,0,Time[numHighLast],HighLast,Time[numHighPrim],HighPrim); if (descript_b) ObjectSetText(nameObj,"ZUP"+ExtComplekt+" zz"+ExtIndicator+" PPesavento "+"Line High "+descript); ObjectSet(nameObj,OBJPROP_RAY,false); ObjectSet(nameObj,OBJPROP_STYLE,STYLE_DOT); ObjectSet(nameObj,OBJPROP_COLOR,ExtLine_); ObjectSet(nameObj,OBJPROP_BACK,ExtBack); ) if (ExtFiboZigZag) k=countBarEnd; ) ) ) else { if (ZigZagHighLow) HighPrim=High[k]; else HighPrim=zzH[k]; numHighPrim=k; ) ) // Go to the next extremum if (k>countBarEnd) { k=numHighPrim+1; countHigh1--; countFr--; numLowPrim=0; numLowLast=0; numHighPrim=0; numHighLast=0; LowPrim=0.0; LowLast=0.0; HighPrim=0.0; HighLast=0.0; Angle=-100; ) ) //-----------1 Drawing highs. End. //-----------2 Drawing minima. Start. //+-------------------------------------------------------------------------+ //| Conclusion connecting lines and the numbers Pesavento and 0.886 for the minimum ZigZag-a //| Drawing goes from zero bar //+-------------------------------------------------------------------------+ numLowPrim=0; numLowLast=0; numHighPrim=0; numHighLast=0; LowPrim=0.0; LowLast=0.0; HighPrim=0.0; HighLast=0.0; Angle=-100; if (flagFrNew && !flagGartle) countFr=1; else countFr=ExtFractal; flagFrNew=false; flagGartle=false; for (k=0; (k0 && countFr>0); k++) { if (zzH[k]>HighPrim && LowPrim>0) { if (ZigZagHighLow) HighPrim=High[k]; else HighPrim=zzH[k]; numHighPrim=k; ) if (zzL[k]>0.0 && zzL[k]==zz[k]) { if (LowPrim>0) { if (ZigZagHighLow) LowLast=Low[k]; else LowLast=zzL[k]; numLowLast=k; // output connecting lines, and percent recovery (numbers Pesavento) HL=HighPrim-LowLast; kj=(LowPrim-LowLast)*1000/(numLowLast-numLowPrim); if (HL>0 && (Angle<=kj || Angle==-100)) // Checking the angle line { Angle=kj; HLp=HighPrim-LowPrim; k1=MathCeil((numLowPrim+numLowLast)/2); kj=HLp/HL; if (ExtPPWithBars==0) PPWithBars=""; else if (ExtPPWithBars==1) PPWithBars=" ("+(numLowLast-numLowPrim)+")"; else if (ExtPPWithBars==2) PPWithBars=" ("+(numLowLast-numHighPrim)+"-"+(numHighPrim-numLowPrim)+")"; else if (ExtPPWithBars==3) { int_to_d1=(numHighPrim-numLowPrim); int_to_d2=(numLowLast-numHighPrim); int_to_d=int_to_d1/int_to_d2; PPWithBars=" ("+DoubleToStr(int_to_d,2)+")"; ) else if (ExtPPWithBars==4) { int_to_d1=(Time[numHighPrim]-Time[numLowPrim]); int_to_d2=(Time[numLowLast]-Time[numHighPrim]); int_to_d=int_to_d1/int_to_d2; PPWithBars=" ("+DoubleToStr(int_to_d,2)+")"; ) else if (ExtPPWithBars==5) { int_to_d1=(numHighPrim-numLowPrim)*(High[numHighPrim]-Low[numLowPrim]); int_to_d2=(numLowLast-numHighPrim)*(High[numHighPrim]-Low[numLowLast]); int_to_d=int_to_d1/int_to_d2; PPWithBars=" ("+DoubleToStr(int_to_d,2)+")"; ) else if (ExtPPWithBars==7) { int_to_d1=((High[numHighPrim]-Low[numLowLast])/Point)/(numLowLast-numHighPrim); int_to_d2=((High[numHighPrim]-Low[numLowPrim])/Point)/(numHighPrim-numLowPrim); PPWithBars=" ("+DoubleToStr(int_to_d1,3)+"/"+DoubleToStr(int_to_d2,3)+")"; ) else if (ExtPPWithBars==8) { int_to_d1=MathSqrt((numHighPrim-numLowPrim)*(numHighPrim-numLowPrim) + ((High[numHighPrim]-Low[numLowPrim])/Point)*((High[numHighPrim]-Low[numLowPrim])/Point)); int_to_d2=MathSqrt((numLowLast-numHighPrim)*(numLowLast-numHighPrim) + ((High[numHighPrim]-Low[numLowLast])/Point)*((High[numHighPrim]-Low[numLowLast])/Point)); int_to_d=int_to_d1/int_to_d2; PPWithBars=" ("+DoubleToStr(int_to_d,2)+")"; ) else if (ExtPPWithBars==9) { int_to_d1=100*High[numHighPrim]/Low[numLowLast]-100; int_to_d2=100-100*Low[numLowPrim]/High[numHighPrim]; PPWithBars=" ("+DoubleToStr(int_to_d1,1)+"/"+DoubleToStr(int_to_d2,1)+")"; ) // ExtPPWithBars=6 Calculate kolichstvo points and the percentage deviation from the retracement "Pesavento" ExtLine_=ExtLine; if ( kj>0.1 && kj<9.36) { // Create a text object (the numbers Pesavento). % recovery between the minima kk=kj; k2=1; Pesavento_patterns(); if (k2<0) // percentage recovery of Pesavento and 0.886 { ExtLine_=ExtLine886; if (ExtHidden!=4) { nameObj="_" + ExtComplekt + "pltxt" + Time[numLowPrim] + "_" + Time[numLowLast]; ObjectCreate(nameObj,OBJ_TEXT,0,Time[k1],(LowPrim+LowLast)/2); if (ExtPPWithBars==6) { int_to_d=MathAbs((kk-kj)/kk)*100; PPWithBars=" ("+DoubleToStr((HighPrim-(HighPrim-LowLast)*kk-LowPrim)/Point,0)+"/"+DoubleToStr(int_to_d,2)+"%)"; ) descript=txtkk; ObjectSetText(nameObj,txtkk+PPWithBars,ExtSizeTxt,"Arial", colorPPattern); if (ExtPPWithBars==6) PPWithBars=""; ) ) else // percentage recovery (not Pesavento and 0.886) { if (ExtHidden==1 || ExtHidden==4) { nameObj="_" + ExtComplekt + "pltxt" + Time[numLowPrim] + "_" + Time[numLowLast]; ObjectCreate(nameObj,OBJ_TEXT,0,Time[k1],(LowPrim+LowLast)/2); descript=DoubleToStr(kk,3); if (ExtDeltaType==3) { ObjectSetText(nameObj,""+DoubleToStr(kk,3)+PPWithBars,ExtSizeTxt,"Arial",colorPPattern); ) else { ObjectSetText(nameObj,""+DoubleToStr(kk,2)+PPWithBars,ExtSizeTxt,"Arial",colorPPattern); ) ) ) if ((ExtHidden==2 && k2<0) || ExtHidden!=2) { nameObj="_" + ExtComplekt + "pl" + Time[numLowPrim] + "_" + Time[numLowLast]; ObjectCreate(nameObj,OBJ_TREND,0,Time[numLowLast],LowLast,Time[numLowPrim],LowPrim); if (descript_b) ObjectSetText(nameObj,"ZUP"+ExtComplekt+" zz"+ExtIndicator+" PPesavento "+"Line Low "+descript); ObjectSet(nameObj,OBJPROP_RAY,false); ObjectSet(nameObj,OBJPROP_STYLE,STYLE_DOT); ObjectSet(nameObj,OBJPROP_COLOR,ExtLine_); ObjectSet(nameObj,OBJPROP_BACK,ExtBack); ) if (ExtFiboZigZag) k=countBarEnd; ) ) ) else { numLowPrim=k; if (ZigZagHighLow) LowPrim=Low[k]; else LowPrim=zzL[k]; ) ) // Go to the next extremum if (k>countBarEnd) { k=numLowPrim+1; countLow1--; countFr--; numLowPrim=0; numLowLast=0; numHighPrim=0; numHighLast=0; LowPrim=0.0; LowLast=0.0; HighPrim=0.0; HighLast=0.0; Angle=-100; ) ) //-----------2 Drawing minima. End. ) //----------------------------------------- // Power output connecting lines. End. //----------------------------------------- //====================== //====================== //====================== } // Permission for withdrawal of equipment. End. // END } // start //---------------------------------------------------- // Subroutines and functions //---------------------------------------------------- //-------------------------------------------------------- // Counting the number of extrema. Minima and maxima. Start. //-------------------------------------------------------- void countFractal() { int shift; countLow1=0; countHigh1=0; if (flagFrNew && !flagGartle) { for(shift=0; shift<=numBar; shift++) { if (zzL[shift]>0.0) {countLow1++;} if (zzH[shift]>0.0) {countHigh1++;} ) numBar=0; counted_bars=Bars-4; ) else { if (flagGartle) {counted_bars=0;} for(shift=0; shift<=countBarEnd; shift++) { if (zzL[shift]>0.0) {countLow1++;} if (zzH[shift]>0.0) {countHigh1++;} ) ) ) //-------------------------------------------------------- // Counting the number of extrema. Minima and maxima. End. //-------------------------------------------------------- //-------------------------------------------------------- // Formation of the matrix. Start. // // The matrix is used to find the missing extrema. // This tool compensation unexpected quirks standard ZigZag-a. // // Also, the static and dynamic fiby and fans Fibonacci // Andrews' Pitchfork ... //------------------------------------------------------ void matriza() { if (afrm && ExtHidden<5) { afrm=false; int shift,k; double kl=0,kh=0; if (ExtMaxBar>0) cbi=ExtMaxBar; else cbi=Bars; k=0; for (shift=0; shift0) { afrx[k]=zz[shift]; afr[k]=Time[shift]; if (zz[shift]==zzL[shift]) { kl=zzL[shift]; if (ZigZagHighLow) afrl[k]=Low[shift]; else { if (k==0) afrl[k]=Low[shift]; else afrl[k]=zzL[shift]; ) afrh[k]=0.0; ) if (zz[shift]==zzH[shift]) { kh=zzH[shift]; if (ZigZagHighLow) afrh[k]=High[shift]; else { if (k==0) afrh[k]=High[shift]; else afrh[k]=zzH[shift]; ) afrl[k]=0.0; ) k++; ) ) if (PeakDet && chHL_PeakDet_or_vts) { // kl - min; kh - max for (k=shift; k>0; k--) { if (zzH[k]>0) {kh=zzH[k];} if (zzL[k]>0) {kl=zzL[k];} if (kl>0) lam[k]=kl; if (kh>0) ham[k]=kh; ) ) // Conclusion Fibo Time out of Andrews' Pitchfork if (ExtFiboTimeNum>2) fiboTimeX (); // be called before calling the static Andrews' Pitchfork // Derivation of Andrews' Pitchfork if (ExtPitchforkStatic>0) { if (newRay && mPitch[2]>0) screenPitchforkS(); if (ExtPitchforkCandle) { if (iBarShift(Symbol(),Period(),ExtDateTimePitchfork_3)==0) screenPitchforkS(); ) else { if (mPitch[2]==0) screenPitchforkS(); ) ) if (ExtPitchforkDinamic>0) screenPitchforkD(); // Conclusion kanallov. if (ExtChannelsNum>1 || DinamicChannels>0) Channels(); // Derivation of static and dynamic Phib. if (ExtFiboStatic) { if (newRay && mFibo[1]>0) screenFiboS(); if (mFibo[1]==0) screenFiboS(); ) if (ExtFiboDinamic) {screenFiboD();} // Fibonacci Extensions if (ExtFiboExpansion>0) { if (newRay && mExpansion[2]>0) FiboExpansion(); if (mExpansion[2]==0) FiboExpansion(); ) // Conclusion fiboveerov if (ExtFiboFanNum>0 && ExtFiboFanColor>0) { if (newRay && mFan[1]>0) screenFiboFan(); if (mFan[1]==0) screenFiboFan(); ) if (ExtFiboFanDinamic) screenFiboFanD(); // Conclusion Versum Levels if (ExtVLStaticColor>0) { if (newRay && mVL[2]>0 && ExtVLStaticNum>0) VLS(); if (mVL[2]==0) VLS(); ) if (ExtVLDinamicColor>0) {VLD();} // Conclusion PivotZZ dynamic if (ExtPivotZZ1Num==1 && ExtPivotZZ1Color>0) PivotZZ(ExtPivotZZ1Color, ExtPivotZZ1Num, 1); if (ExtPivotZZ2Num==1 && ExtPivotZZ2Color>0) PivotZZ(ExtPivotZZ2Color, ExtPivotZZ2Num, 2); // Conclusion PivotZZ static if (newRay && ExtPivotZZ1Num>1 && ExtPivotZZ1Color>0) PivotZZ(ExtPivotZZ1Color, ExtPivotZZ1Num, 1); if (newRay && ExtPivotZZ2Num>1 && ExtPivotZZ2Color>0) PivotZZ(ExtPivotZZ2Color, ExtPivotZZ2Num, 2); // Conclusion fibodug if (ExtArcDinamicNum>0) screenFiboArcD(); if (newRay && ExtArcStaticNum>0) screenFiboArcS(); // Output coil if (newRay && ExtSpiralNum>0) GoldenSpiral(afr[mSpiral[0]],afrx[mSpiral[0]],afr[mSpiral[1]],afrx[mSpiral[1]]); // ????? ????????? Gartley if (ExtGartleyOnOff) { switch (ExtIndicator) { case 0 : {_Gartley("ExtIndicator=0_" + minBars+"/"+ExtDeviation+"/"+ExtBackstep,0);break;} case 1 : {_Gartley("ExtIndicator=1_" + minSize+"/"+minPercent,0);break;} case 2 : {_Gartley("ExtIndicator=2_" + minBars+"/"+minSize,0);break;} case 3 : {_Gartley("ExtIndicator=3_" + minBars,0);break;} case 4 : {_Gartley("ExtIndicator=4_" + minSize,0);break;} case 5 : {_Gartley("ExtIndicator=5_" + minBars,0);break;} case 6 : {_Gartley("ExtIndicator=6_" + minBars+"/"+ExtDeviation+"/"+ExtBackstep,0);break;} case 7 : {_Gartley("ExtIndicator=7_" + minBars,0);break;} case 8 : {_Gartley("ExtIndicator=8_" + minBars+"/"+ExtDeviation,0);break;} case 10 : {_Gartley("ExtIndicator=10_" + minBars,0);break;} case 12 : {_Gartley("ExtIndicator=12_" + minBars,0);break;} case 13 : {_Gartley("ExtIndicator=13_" + minBars+"/"+minSize,0);break;} case 14 : {_Gartley("ExtIndicator=14_" + minBars,0);break;} ) if (vPatOnOff==1 && vPatNew==0) { vPatNew=1; if (ExtSendMail) _SendMail("There was a pattern","on " + Symbol() + " " + Period() + " pattern " + vBullBear + " " + vNamePattern); ) else if (vPatOnOff==0 && vPatNew==1) {vPatNew=0; FlagForD=true;} ) ExtSave=false; ) if (newRay && ExtNumberPeak) NumberPeak(); newRay=false; ) //-------------------------------------------------------- // Formation of the matrix. End. //-------------------------------------------------------- //-------------------------------------------------------- // Output numbers fractures zigzags. Start //-------------------------------------------------------- void NumberPeak() { int n=0,i,endNumber; string txt; if (ExtNumberPeak10) endNumber=iBarShift(Symbol(),Period(),afr[9]); else endNumber=Bars-minBars; delete_objects_number(); for (i=iBarShift(Symbol(),Period(),afr[0])+1;i0) { n++; if (ExtNumberPeakLow) { if (zzL[i]>0) { txt=DoubleToStr(n,0); nameObj="NumberPeak" + "_" + ExtComplekt + "_" + n; ObjectCreate(nameObj,OBJ_TEXT,0,Time[i],zz[i]); ObjectSetText(nameObj,txt,ExtNumberPeakFontSize,"Arial",ExtNumberPeakColor); ) ) else { txt=DoubleToStr(n,0); nameObj="NumberPeak" + "_" + ExtComplekt + "_" + n; ObjectCreate(nameObj,OBJ_TEXT,0,Time[i],zz[i]); ObjectSetText(nameObj,txt,ExtNumberPeakFontSize,"Arial",ExtNumberPeakColor); ) ) ) ) //-------------------------------------------------------- // Output numbers fractures zigzags. End //-------------------------------------------------------- //-------------------------------------------------------- // Channels. Start. //-------------------------------------------------------- void Channels() { int i,j,k,m,n,nul,peakLeft,peakRight,peakBase; double tangens, sdvigH, sdvigL, sdvigH_, sdvigL_, cenaLTLeft, cenaLTRight, cenaLCLeft, cenaLCRight, wrcenaL, wrcenaR; datetime timeLTLeft, timeLTRight, timeLCLeft, timeLCRight; int baseExtremum; // Number fracture zigzag (bar), which is based trend bool fTrend=false; // =true - Bull spend trend of minima, = false - Bear perform trend of highs bool dinamic=false; if (ExtChannelsNum==0 && DinamicChannels>0) dinamic=true; //int o; k=0; for (i=0;i<=9;i++) {if (mChannels[i]>=0) k++;} // Channels with the trend line, the first point of which at the turn of the zigzag, // second point is built on a tangent to the market in the area covered by the channel. Start. if (ExtTypeChannels==1) { if (dinamic) nul=DinamicChannels; else nul=1; for (i=1;iafrx[mChannels[i-1]-2] && afrx[mChannels[i-1]-1]>afrx[mChannels[i]]) { o=2; Print ("===2==="); fTrend=false; if (afrx[mChannels[i-1]]MathAbs(afrx[mChannels[i]]-afrx[mChannels[i]+1])) // converging triangle { if (MathAbs(afrx[mChannels[i-1]]-afrx[mChannels[i-1]-2])>MathAbs(afrx[mChannels[i]]-afrx[mChannels[i]+2])) { if (afrx[mChannels[i-1]]afrx[mChannels[i]+1]) baseExtremum=mChannels[i]+1; else baseExtremum=mChannels[i-1]; ) else { fTrend=false; if (afrx[mChannels[i-1]]>afrx[mChannels[i]+1]) baseExtremum=mChannels[i-1]; else baseExtremum=mChannels[i]+1; ) o=3; Print ("===3==="); ) else { if (afrx[mChannels[i-1]]afrx[mChannels[i]]) baseExtremum=mChannels[i-1]-1; else baseExtremum=mChannels[i]; ) else { fTrend=true; if (afrx[mChannels[i-1]-1]>afrx[mChannels[i]]) baseExtremum=mChannels[i]; else baseExtremum=mChannels[i-1]-1; ) o=4; Print ("===4==="); ) ) else // divergent triangle or flat (parallel) correction, which is very rare { if (MathAbs(afrx[mChannels[i-1]]-afrx[mChannels[i-1]-2])>MathAbs(afrx[mChannels[i]]-afrx[mChannels[i]+2])) { if (afrx[mChannels[i-1]]afrx[mChannels[i]+2]) baseExtremum=mChannels[i]; else baseExtremum=mChannels[i]+2; ) else { o=51; Print ("===51==="); Print (MathAbs(afrx[mChannels[i-1]]-afrx[mChannels[i-1]-2])-MathAbs(afrx[mChannels[i]]-afrx[mChannels[i]+2])); fTrend=true; if (afrx[mChannels[i]]>afrx[mChannels[i]+2]) baseExtremum=mChannels[i]; else baseExtremum=mChannels[i]+2; ) ) else { if (afrx[mChannels[i-1]]afrx[mChannels[i-1]]) baseExtremum=mChannels[i-1]; else baseExtremum=mChannels[i]+1; ) else { o=7; Print (MathAbs(afrx[mChannels[i-1]]-afrx[mChannels[i-1]-2])-MathAbs(afrx[mChannels[i]]-afrx[mChannels[i]+2])); Print ("===7==="); fTrend=false; if (afrx[mChannels[i]+1]>afrx[mChannels[i-1]]) baseExtremum=mChannels[i]+1; else baseExtremum=mChannels[i-1]; ) ) ) ) ) //Print ("baseExtremum=",baseExtremum); //Print ("o=",o); * / peakBase=iBarShift(Symbol(),Period(),afr[baseExtremum]); tangens=(afrx[mChannels[i]]-afrx[baseExtremum])/(peakBase-peakRight); for (j=peakBase;j>=peakRight;j--) // compute tangens { if (fTrend) { if (afrx[baseExtremum] + tangens*(peakBase-j)-Low[j]>0) tangens=(Low[j]-afrx[baseExtremum])/(peakBase-j); ) else { if (High[j] - (afrx[baseExtremum] + tangens*(peakBase-j))>0) tangens=(High[j]-afrx[baseExtremum])/(peakBase-j); ) ) for (j=peakLeft;j>=peakRight;j--) // calculate changes { if (fTrend) { sdvigH_=High[j] - (afrx[baseExtremum] + tangens*(peakBase-j)); if (sdvigH_>sdvigH) {sdvigH=sdvigH_; cenaLCRight=High[j]+tangens*(j-peakRight);} ) else { sdvigL_=afrx[baseExtremum] + tangens*(peakBase-j)-Low[j]; if (sdvigL_>sdvigL) {sdvigL=sdvigL_; cenaLCRight=Low[j]+tangens*(j-peakRight);} ) ) timeLCRight=afr[mChannels[i]]; if (ExtTypeLineChannels==0) { while (j>0) { if (fTrend) { if (afrx[baseExtremum] + tangens*(peakBase-j)-Low[j]>sdvigL) break; ) else { if (High[j] - (afrx[baseExtremum] + tangens*(peakBase-j))>sdvigH) break; ) j--; ) ) if (j<0) j=0; nameObj="LTChannel" + i + ExtComplekt+"_"; if (ExtSave) { if (i!=DinamicChannels) nameObj=nameObj + save; ) ObjectDelete(nameObj); if (fTrend) { timeLTLeft=afr[mChannels[i-1]]; cenaLTLeft=afrx[baseExtremum]-tangens*(peakLeft-peakBase); timeLTRight=Time[j]; cenaLTRight=afrx[baseExtremum] + tangens*(peakBase-j)-sdvigL; ) else { timeLTLeft=afr[mChannels[i-1]]; cenaLTLeft=afrx[baseExtremum]-tangens*(peakLeft-peakBase); timeLTRight=Time[j]; cenaLTRight=afrx[baseExtremum] + tangens*(peakBase-j)+sdvigH; ) if (ExtTypeLineChannels==1 || ExtTypeLineChannels==3) { n=j; wrcenaR=cenaLTRight; if (fTrend) { while (cenaLTRight<=afrx[mChannels[i]] && n>0) {n--; cenaLTRight=wrcenaR+tangens*(j-n);} ) else { while (cenaLTRight>=afrx[mChannels[i]] && n>0) {n--; cenaLTRight=wrcenaR+tangens*(j-n);} ) timeLTRight=Time[n]; timeLTLeft=afr[baseExtremum]; cenaLTLeft=afrx[baseExtremum]; ) ObjectCreate(nameObj,OBJ_TREND,0,timeLTLeft,cenaLTLeft,timeLTRight,cenaLTRight); if (ExtTypeLineChannels<2) ObjectSet(nameObj,OBJPROP_RAY,ExtRay); ObjectSet(nameObj,OBJPROP_COLOR,ExtLTColor); ObjectSet(nameObj,OBJPROP_STYLE,ExtLTChannelsStyle); ObjectSet(nameObj,OBJPROP_WIDTH,ExtLTChannelsWidth); nameObj="LCChannel" + i + ExtComplekt+"_"; if (ExtSave) { if (i!=DinamicChannels) nameObj=nameObj + save; ) ObjectDelete(nameObj); if (fTrend) { cenaLCLeft=afrx[baseExtremum]+sdvigH-tangens*(peakLeft-peakBase); ) else { cenaLCLeft=afrx[baseExtremum]-sdvigL-tangens*(peakLeft-peakBase); ) timeLCLeft=afr[mChannels[i-1]]; if (ExtTypeLineChannels==1 || ExtTypeLineChannels==3) { m=peakLeft; wrcenaL=cenaLCLeft; n=peakRight; wrcenaR=cenaLCRight; if (fTrend) { while (cenaLCLeft>=afrx[baseExtremum] && m<=Bars) {m++; cenaLCLeft=wrcenaL-tangens*(m-peakLeft);} while (cenaLCRight>=afrx[mChannels[i]] && n<=peakLeft) {n++; cenaLCRight=wrcenaR-tangens*(n-peakRight);} ) else { while (cenaLCLeft<=afrx[baseExtremum] && m<=Bars) {m++; cenaLCLeft=wrcenaL-tangens*(m-peakLeft);} while (cenaLCRight<=afrx[mChannels[i]] && n<=peakLeft) {n++; cenaLCRight=wrcenaR-tangens*(n-peakRight);} ) timeLCLeft=Time[m]; cenaLCRight=wrcenaR-tangens*(n-1-peakRight); timeLCRight=Time[n-1]; ) ObjectCreate(nameObj,OBJ_TREND,0,timeLCLeft,cenaLCLeft,timeLCRight,cenaLCRight); if (ExtTypeLineChannels<2) ObjectSet(nameObj,OBJPROP_RAY,ExtRay); ObjectSet(nameObj,OBJPROP_COLOR,ExtLCColor); ObjectSet(nameObj,OBJPROP_STYLE,ExtLCChannelsStyle); ObjectSet(nameObj,OBJPROP_WIDTH,ExtLCChannelsWidth); if (dinamic) break; ) ) // Channels with the trend line, the first point of which at the turn of the zigzag, // second point is built on a tangent to the market in the area covered by the channel. End. // Channels parallel to the line of the zigzag. Start. if (ExtTypeChannels==2) { if (dinamic) nul=DinamicChannels; else nul=1; for (i=1;i=peakRight;j--) // ????????? ?????? { sdvigH_=High[j] - (afrx[mChannels[i-1]] + tangens*(peakLeft-j)); sdvigL_=afrx[mChannels[i-1]] + tangens*(peakLeft-j)-Low[j]; if (sdvigH_>sdvigH) sdvigH=sdvigH_; if (sdvigL_>sdvigL) sdvigL=sdvigL_; ) if (ExtTypeLineChannels==0) { while (j>=0) { if (fTrend) { if (afrx[mChannels[i-1]] + tangens*(peakLeft-j)-Low[j]>sdvigL) break; ) else { if (High[j] - (afrx[mChannels[i-1]] + tangens*(peakLeft-j))>sdvigH) break; ) j--; ) ) if (j<0) j=0; nameObj="LTChannel" + i + ExtComplekt+"_"; if (ExtSave) { if (i!=DinamicChannels) nameObj=nameObj + save; ) ObjectDelete(nameObj); if (fTrend) { timeLTLeft=afr[mChannels[i-1]]; cenaLTLeft=afrx[mChannels[i-1]]-sdvigL; timeLTRight=Time[j]; cenaLTRight=afrx[mChannels[i-1]] + tangens*(peakLeft-j)-sdvigL; ) else { timeLTLeft=afr[mChannels[i-1]]; cenaLTLeft=afrx[mChannels[i-1]]+sdvigH; timeLTRight=Time[j]; cenaLTRight=afrx[mChannels[i-1]] + tangens*(peakLeft-j)+sdvigH; ) if (ExtTypeLineChannels==1 || ExtTypeLineChannels==3) { if (fTrend) { m=peakLeft; wrcenaL=cenaLTLeft; while (cenaLTLeft=peakRight) {m--; cenaLTLeft=wrcenaL+tangens*(peakLeft-m);} timeLTLeft=Time[m+1]; cenaLTLeft=wrcenaL+tangens*(peakLeft-m-1); n=peakRight; wrcenaR=cenaLTRight; while (cenaLTRight0) {n--; cenaLTRight=wrcenaL+tangens*(peakLeft-n);} timeLTRight=Time[n]; ) else { m=peakLeft; wrcenaL=cenaLTLeft; while (cenaLTLeft>=afrx[mChannels[i-1]] && m>=peakRight) {m--; cenaLTLeft=wrcenaL+tangens*(peakLeft-m);} timeLTLeft=Time[m+1]; cenaLTLeft=wrcenaL+tangens*(peakLeft-m-1); n=peakRight; wrcenaR=cenaLTRight; while (cenaLTRight>afrx[mChannels[i]] && n>0) {n--; cenaLTRight=wrcenaL+tangens*(peakLeft-n);} timeLTRight=Time[n]; ) ) ObjectCreate(nameObj,OBJ_TREND,0,timeLTLeft,cenaLTLeft,timeLTRight,cenaLTRight); if (ExtTypeLineChannels<2) ObjectSet(nameObj,OBJPROP_RAY,false); ObjectSet(nameObj,OBJPROP_COLOR,ExtLTColor); ObjectSet(nameObj,OBJPROP_STYLE,ExtLTChannelsStyle); ObjectSet(nameObj,OBJPROP_WIDTH,ExtLTChannelsWidth); nameObj="LCChannel" + i + ExtComplekt+"_"; if (ExtSave) { if (i!=DinamicChannels) nameObj=nameObj + save; ) ObjectDelete(nameObj); if (fTrend) { timeLCLeft=afr[mChannels[i-1]]; cenaLCLeft=afrx[mChannels[i-1]]+sdvigH; timeLCRight=afr[mChannels[i]]; cenaLCRight=afrx[mChannels[i]]+sdvigH; ) else { timeLCLeft=afr[mChannels[i-1]]; cenaLCLeft=afrx[mChannels[i-1]]-sdvigL; timeLCRight=afr[mChannels[i]]; cenaLCRight=afrx[mChannels[i]]-sdvigL; ) if (ExtTypeLineChannels==1 || ExtTypeLineChannels==3) { if (fTrend) { m=peakLeft; wrcenaL=cenaLCLeft; while (cenaLCLeft>afrx[mChannels[i-1]] && mafrx[mChannels[i]] && n1) { cena=(zz[peak2]+zz[peak1]+Close[peak1-1])/3; tangens=(zz[peak2]-zz[peak1])/(peak2-peak1); val=zz[peak1]; for (shift=peak1; shiftzz[peak1]) { if (val>cena) break; ) else { if (val0) { H_L=afrh[nb]-afrl[nc]; // height of the segment BC for (i=0; i<7; i++) { if (ExtFiboType==1) { mediana=line_pesavento[i]*H_L+afrl[nc]; tangens=(mediana-afrl[na])/(c_bar1+(1-line_pesavento[i])*c_bar2); cena=c_bar2*line_pesavento[i]*tangens+mediana; nameObj=vl+i+" " + ExtComplekt+"_"; ObjectDelete(nameObj); ObjectCreate(nameObj,OBJ_TREND,0,afr[na],afrl[na],afr[nc],cena); ObjectSetText(nameObj,"ZUP"+ExtComplekt+" zz"+ExtIndicator+" "+vl+" "+DoubleToStr(line_pesavento[i]*100,1)+""); ) else { mediana=line_fibo[i]*H_L+afrl[nc]; tangens=(mediana-afrl[na])/(c_bar1+(1-line_fibo[i])*c_bar2); cena=c_bar2*line_fibo[i]*tangens+mediana; nameObj=vl+i+" " + ExtComplekt+"_"; ObjectDelete(nameObj); ObjectCreate(nameObj,OBJ_TREND,0,afr[na],afrl[na],afr[nc],cena); ObjectSetText(nameObj,"ZUP"+ExtComplekt+" zz"+ExtIndicator+" "+vl+" "+DoubleToStr(line_fibo[i]*100,1)+""); ) ObjectSet(nameObj,OBJPROP_COLOR,color_line); ObjectSet(nameObj,OBJPROP_STYLE,ExtVLStyle); ObjectSet(nameObj,OBJPROP_WIDTH,ExtVLWidth); ) ) else { H_L=afrh[nc]-afrl[nb]; // ?????? ??????? ?? for (i=0; i<7; i++) { if (ExtFiboType==1) { mediana=afrh[nc]-line_pesavento[i]*H_L; tangens=(afrh[na]-mediana)/(c_bar1+(1-line_pesavento[i])*c_bar2); cena=mediana-c_bar2*line_pesavento[i]*tangens; nameObj=vl+i+" " + ExtComplekt+"_"; ObjectDelete(nameObj); ObjectCreate(nameObj,OBJ_TREND,0,afr[na],afrh[na],afr[nc],cena); ObjectSetText(nameObj,"ZUP"+ExtComplekt+" zz"+ExtIndicator+" "+vl+" "+DoubleToStr(line_pesavento[i]*100,1)+""); ) else { mediana=afrh[nc]-line_fibo[i]*H_L; tangens=(afrh[na]-mediana)/(c_bar1+(1-line_fibo[i])*c_bar2); cena=mediana-c_bar2*line_fibo[i]*tangens; nameObj=vl+i+" " + ExtComplekt+"_"; ObjectDelete(nameObj); ObjectCreate(nameObj,OBJ_TREND,0,afr[na],afrh[na],afr[nc],cena); ObjectSetText(nameObj,"ZUP"+ExtComplekt+" zz"+ExtIndicator+" "+vl+" "+DoubleToStr(line_fibo[i]*100,1)+""); ) ObjectSet(nameObj,OBJPROP_COLOR,color_line); ObjectSet(nameObj,OBJPROP_STYLE,ExtVLStyle); ObjectSet(nameObj,OBJPROP_WIDTH,ExtVLWidth); ) ) ) //-------------------------------------------------------- // Versum Levels. End. //-------------------------------------------------------- //-------------------------------------------------------- // Conclusion Andrews' Pitchfork static. Start. //-------------------------------------------------------- void screenPitchforkS() { int i; double a1,b1,c1,ab1,bc1,ab2,bc2,tangens,n1,cl1,ch1,cena; datetime ta1,tb1,tc1,tab2,tbc2,tcl1,tch1; int pitch_time[]={0,0,0}; double pitch_cena[]={0,0,0}; double TLine, m618=0.618, m382=0.382; if (ExtPitchforkCandle) { if (iBarShift(Symbol(),Period(),ExtDateTimePitchfork_3)==0) { if (ExtPitchfork_1_HighLow) { mPitchCena[2]=High[iBarShift(Symbol(),Period(),ExtDateTimePitchfork_3)]; ) else { mPitchCena[2]=Low[iBarShift(Symbol(),Period(),ExtDateTimePitchfork_3)]; ) ) ) if (ExtPitchforkCandle) { cena=mPitchCena[0]; if (ExtPitchfork_1_HighLow) { if (ExtCM_0_1A_2B_Static==1) { cena=mPitchCena[0]-(mPitchCena[0]-mPitchCena[1])*ExtCM_FiboStatic; ) else if (ExtCM_0_1A_2B_Static==4) { mPitchTimeSave=mPitchTime[0]; mPitchTime[0]=mPitchTime[1]; if (maxGipotenuza4(mPitchTime,mPitchCena)) { cena=mPitchCena[1]+(mPitchCena[2]-mPitchCena[1])*m618; ) else { cena=mPitchCena[1]+(mPitchCena[2]-mPitchCena[1])*m382; ) ) else if (ExtCM_0_1A_2B_Static==5) { mPitchTimeSave=mPitchTime[0]; mPitchTime[0]=mPitchTime[1]; if (maxGipotenuza5(mPitchTime,mPitchCena)) { cena=mPitchCena[1]+(mPitchCena[2]-mPitchCena[1])*m618; ) else { cena=mPitchCena[1]+(mPitchCena[2]-mPitchCena[1])*m382; ) ) else if (ExtCM_0_1A_2B_Static>1) { if (ExtCM_0_1A_2B_Static==2) mPitchTime[0]=mPitchTime[1]; cena=mPitchCena[1]+(mPitchCena[2]-mPitchCena[1])*ExtCM_FiboStatic; ) ) else { if (ExtCM_0_1A_2B_Static==1) { cena=mPitchCena[0]+(mPitchCena[1]-mPitchCena[0])*ExtCM_FiboStatic; ) else if (ExtCM_0_1A_2B_Static==4) { mPitchTimeSave=mPitchTime[0]; mPitchTime[0]=mPitchTime[1]; if (maxGipotenuza4(mPitchTime,mPitchCena)) { cena=mPitchCena[1]-(mPitchCena[1]-mPitchCena[2])*m618; ) else { cena=mPitchCena[1]-(mPitchCena[1]-mPitchCena[2])*m382; ) ) else if (ExtCM_0_1A_2B_Static==5) { mPitchTimeSave=mPitchTime[0]; mPitchTime[0]=mPitchTime[1]; if (maxGipotenuza5(mPitchTime,mPitchCena)) { cena=mPitchCena[1]-(mPitchCena[1]-mPitchCena[2])*m618; ) else { cena=mPitchCena[1]-(mPitchCena[1]-mPitchCena[2])*m382; ) ) else if (ExtCM_0_1A_2B_Static>1) { if (ExtCM_0_1A_2B_Static==2) mPitchTime[0]=mPitchTime[1]; cena=mPitchCena[1]-(mPitchCena[1]-mPitchCena[2])*ExtCM_FiboStatic; ) ) ) else { mPitchTime[0]=afr[mPitch[0]]; mPitchTime[1]=afr[mPitch[1]]; mPitchTime[2]=afr[mPitch[2]]; if (afrl[mPitch[0]]>0) { cena=afrl[mPitch[0]]; mPitchCena[0]=afrl[mPitch[0]]; mPitchCena[1]=afrh[mPitch[1]]; mPitchCena[2]=afrl[mPitch[2]]; if (ExtCM_0_1A_2B_Static==1) { cena=mPitchCena[0]+(mPitchCena[1]-mPitchCena[0])*ExtCM_FiboStatic; ) else if (ExtCM_0_1A_2B_Static==4) { mPitchTimeSave=mPitchTime[0]; mPitchTime[0]=mPitchTime[1]; if (maxGipotenuza4(mPitchTime,mPitchCena)) { cena=mPitchCena[1]-(mPitchCena[1]-mPitchCena[2])*m618; ) else { cena=mPitchCena[1]-(mPitchCena[1]-mPitchCena[2])*m382; ) ) else if (ExtCM_0_1A_2B_Static==5) { mPitchTimeSave=mPitchTime[0]; mPitchTime[0]=mPitchTime[1]; if (maxGipotenuza5(mPitchTime,mPitchCena)) { cena=mPitchCena[1]-(mPitchCena[1]-mPitchCena[2])*m618; ) else { cena=mPitchCena[1]-(mPitchCena[1]-mPitchCena[2])*m382; ) ) else if (ExtCM_0_1A_2B_Static>1) { if (ExtCM_0_1A_2B_Static==2) mPitchTime[0]=mPitchTime[1]; cena=mPitchCena[1]-(mPitchCena[1]-mPitchCena[2])*ExtCM_FiboStatic; ) ) else { cena=afrh[mPitch[0]]; mPitchCena[0]=afrh[mPitch[0]]; mPitchCena[1]=afrl[mPitch[1]]; mPitchCena[2]=afrh[mPitch[2]]; if (ExtCM_0_1A_2B_Static==1) { cena=mPitchCena[0]-(mPitchCena[0]-mPitchCena[1])*ExtCM_FiboStatic; ) else if (ExtCM_0_1A_2B_Static==4) { mPitchTimeSave=mPitchTime[0]; mPitchTime[0]=mPitchTime[1]; if (maxGipotenuza4(mPitchTime,mPitchCena)) { cena=mPitchCena[1]+(mPitchCena[2]-mPitchCena[1])*m618; ) else { cena=mPitchCena[1]+(mPitchCena[2]-mPitchCena[1])*m382; ) ) else if (ExtCM_0_1A_2B_Static==5) { mPitchTimeSave=mPitchTime[0]; mPitchTime[0]=mPitchTime[1]; if (maxGipotenuza5(mPitchTime,mPitchCena)) { cena=mPitchCena[1]+(mPitchCena[2]-mPitchCena[1])*m618; ) else { cena=mPitchCena[1]+(mPitchCena[2]-mPitchCena[1])*m382; ) ) else if (ExtCM_0_1A_2B_Static>1) { if (ExtCM_0_1A_2B_Static==2) mPitchTime[0]=mPitchTime[1]; cena=mPitchCena[1]+(mPitchCena[2]-mPitchCena[1])*ExtCM_FiboStatic; ) ) ) mPitchCena[0]=cena; if (ExtFiboFanStatic) {ExtFiboFanStatic=false; screenFiboFanS();} nameObj="pmedianaS" + ExtComplekt+"_"; ObjectDelete(nameObj); if (ExtSave) { if (ExtPitchforkCandle && iBarShift(Symbol(),Period(),ExtDateTimePitchfork_3)>0) { nameObj=nameObj + save; ) else { if (mPitch[2]>0) { nameObj=nameObj + save; ) ) ) coordinaty_1_2_mediany_AP(mPitchCena[0], mPitchCena[1], mPitchCena[2], mPitchTime[0], mPitchTime[1], mPitchTime[2], tab2, tbc2, ab1, bc1); pitch_time[0]=tab2;pitch_cena[0]=ab1; if (ExtPitchforkStatic==2) { ObjectCreate(nameObj,OBJ_TREND,0,tab2,ab1,tbc2,bc1); ObjectSet(nameObj,OBJPROP_STYLE,STYLE_DASH); ObjectSet(nameObj,OBJPROP_COLOR,ExtLinePitchforkS); ObjectSet(nameObj,OBJPROP_BACK,ExtBack); nameObj="1-2pmedianaS" + ExtComplekt+"_"; if (ExtSave) { if (ExtPitchforkCandle && iBarShift(Symbol(),Period(),ExtDateTimePitchfork_3)>0) { nameObj=nameObj + save; ) else { if (mPitch[2]>0) { nameObj=nameObj + save; ) ) ) ObjectDelete(nameObj); ObjectCreate(nameObj,OBJ_TEXT,0,tab2,ab1+3*Point); ObjectSetText(nameObj," 1/2 ML",9,"Arial", ExtLinePitchforkS); ) nameObj="pitchforkS" + ExtComplekt+"_"; if (ExtSave) { if (ExtPitchforkCandle && iBarShift(Symbol(),Period(),ExtDateTimePitchfork_3)>0) { nameObj=nameObj + save; ) else { if (mPitch[2]>0) { nameObj=nameObj + save; ) ) ) ObjectDelete(nameObj); if (ExtPitchforkStatic!=4) { pitch_time[0]=mPitchTime[0];pitch_cena[0]=mPitchCena[0]; if (ExtPitchforkStatic==3) pitch_cena[0]=ab1; ) pitch_time[1]=mPitchTime[1];pitch_cena[1]=mPitchCena[1]; pitch_time[2]=mPitchTime[2];pitch_cena[2]=mPitchCena[2]; ObjectCreate(nameObj,OBJ_PITCHFORK,0,pitch_time[0],pitch_cena[0],pitch_time[1],pitch_cena[1],pitch_time[2],pitch_cena[2]); ObjectSet(nameObj,OBJPROP_STYLE,ExtPitchforkStyle); ObjectSet(nameObj,OBJPROP_WIDTH,ExtPitchforkWidth); ObjectSet(nameObj,OBJPROP_COLOR,ExtLinePitchforkS); ObjectSet(nameObj,OBJPROP_BACK,ExtBack); if (ExtFiboFanMedianaStaticColor>0) { coordinaty_mediany_AP(pitch_cena[0], pitch_cena[1], pitch_cena[2], pitch_time[0], pitch_time[1], pitch_time[2], tb1, b1); nameObj="FanMedianaStatic" + ExtComplekt+"_"; /* if (ExtSave) { if (ExtPitchforkCandle && iBarShift(Symbol(),Period(),ExtDateTimePitchfork_3)>0) { nameObj=nameObj + save; ) else { if (mPitch[2]>0) { nameObj=nameObj + save; ) ) ) * / ObjectDelete(nameObj); ObjectSet(nameObj,OBJPROP_COLOR,CLR_NONE); ObjectCreate(nameObj,OBJ_FIBOFAN,0,pitch_time[0],pitch_cena[0],tb1,b1); ObjectSet(nameObj,OBJPROP_LEVELSTYLE,STYLE_DASH); ObjectSet(nameObj,OBJPROP_LEVELCOLOR,ExtFiboFanMedianaStaticColor); ObjectSet(nameObj,OBJPROP_BACK,ExtBack); if (ExtFiboType==0) { screenFibo_st(); ) else if (ExtFiboType==1) { screenFibo_Pesavento(); ) else if (ExtFiboType==2) { ObjectSet(nameObj,OBJPROP_FIBOLEVELS,Sizefi); for (i=0;i0) { nameObj=nameObj + save; ) else { if (mPitch[2]>0) { nameObj=nameObj + save; ) ) ) ObjectDelete(nameObj); if (pitch_cena[1]>pitch_cena[2]) { ObjectCreate(nameObj,OBJ_TREND,0,pitch_time[0],pitch_cena[0],pitch_time[1],pitch_cena[1]); ) else { ObjectCreate(nameObj,OBJ_TREND,0,pitch_time[0],pitch_cena[0],pitch_time[2],pitch_cena[2]); ) ObjectSet(nameObj,OBJPROP_STYLE,STYLE_SOLID); ObjectSet(nameObj,OBJPROP_COLOR,ExtLinePitchforkS); ObjectSet(nameObj,OBJPROP_BACK,ExtBack); ) if (ExtPivotZoneStaticColor>0 && ExtPitchforkStatic<4) PivotZone(pitch_time, pitch_cena, ExtPivotZoneStaticColor, "PivotZoneS"); if (ExtLTL) { nameObj="LTL" + ExtComplekt+"_"; if (ExtSave) { if (ExtPitchforkCandle && iBarShift(Symbol(),Period(),ExtDateTimePitchfork_3)>0) { nameObj=nameObj + save; ) else { if (mPitch[2]>0) { nameObj=nameObj + save; ) ) ) ObjectDelete(nameObj); if (pitch_cena[1]>pitch_cena[2]) { ObjectCreate(nameObj,OBJ_TREND,0,pitch_time[0],pitch_cena[0],pitch_time[2],pitch_cena[2]); ) else { ObjectCreate(nameObj,OBJ_TREND,0,pitch_time[0],pitch_cena[0],pitch_time[1],pitch_cena[1]); ) ObjectSet(nameObj,OBJPROP_STYLE,STYLE_SOLID); ObjectSet(nameObj,OBJPROP_COLOR,ExtLinePitchforkS); ObjectSet(nameObj,OBJPROP_BACK,ExtBack); ) //------------------------------------------------------- if (ExtUWL || ExtLWL) { n1=iBarShift(Symbol(),Period(),pitch_time[0])-(iBarShift(Symbol(),Period(),pitch_time[1])+iBarShift(Symbol(),Period(),pitch_time[2]))/2.0; ta1=pitch_time[0]; tb1=Time[0]; a1=pitch_cena[0]; tangens=(pitch_cena[0]-(pitch_cena[1]+pitch_cena[2])/2.0)/n1; b1=pitch_cena[0]-tangens*iBarShift(Symbol(),Period(),pitch_time[0]); ML_RL400(tangens, pitch_cena, pitch_time, tb1, b1, false); if (pitch_cena[1]>pitch_cena[2]) { if (ExtUWL) { ch1=pitch_cena[1]; tch1=pitch_time[1]; ) if (ExtLWL) { cl1=pitch_cena[2]; tcl1=pitch_time[2]; ) ) else { if (ExtUWL) { ch1=pitch_cena[2]; tch1=pitch_time[2]; ) if (ExtLWL) { cl1=pitch_cena[1]; tcl1=pitch_time[1]; ) ) if (ExtUWL) { nameObj="UWL" + ExtComplekt+"_"; if (ExtSave) { if (ExtPitchforkCandle && iBarShift(Symbol(),Period(),ExtDateTimePitchfork_3)>0) { nameObj=nameObj + save; ) else { if (mPitch[2]>0) { nameObj=nameObj + save; ) ) ) ObjectDelete(nameObj); ObjectCreate(nameObj,OBJ_FIBOCHANNEL,0,ta1,a1,tb1,b1,tch1,ch1); ObjectSet(nameObj,OBJPROP_LEVELCOLOR,ExtLinePitchforkS); ObjectSet(nameObj,OBJPROP_LEVELSTYLE,STYLE_DOT); ObjectSet(nameObj,OBJPROP_RAY,ExtLongWL); ObjectSet(nameObj,OBJPROP_BACK,ExtBack); ObjectSet(nameObj,OBJPROP_COLOR,CLR_NONE); UWL_LWL(ExtVisibleUWL,"U W L ",ExtFiboFreeUWL); ) if (ExtLWL) { nameObj="LWL" + ExtComplekt+"_"; if (ExtSave) { if (ExtPitchforkCandle && iBarShift(Symbol(),Period(),ExtDateTimePitchfork_3)>0) { nameObj=nameObj + save; ) else { if (mPitch[2]>0) { nameObj=nameObj + save; ) ) ) ObjectDelete(nameObj); ObjectCreate(nameObj,OBJ_FIBOCHANNEL,0,ta1,a1,tb1,b1,tcl1,cl1); ObjectSet(nameObj,OBJPROP_LEVELCOLOR,ExtLinePitchforkS); ObjectSet(nameObj,OBJPROP_LEVELSTYLE,STYLE_DOT); ObjectSet(nameObj,OBJPROP_RAY,ExtLongWL); ObjectSet(nameObj,OBJPROP_BACK,ExtBack); ObjectSet(nameObj,OBJPROP_COLOR,CLR_NONE); UWL_LWL(ExtVisibleLWL,"L W L ",ExtFiboFreeLWL); ) ) //------------------------------------------------------- if (ExtPitchforkStaticColor>0) { n1=iBarShift(Symbol(),Period(),pitch_time[0])-(iBarShift(Symbol(),Period(),pitch_time[1])+iBarShift(Symbol(),Period(),pitch_time[2]))/2.0; TLine=pitch_cena[1]-iBarShift(Symbol(),Period(),pitch_time[1])*(pitch_cena[0]-(pitch_cena[2]+pitch_cena[1])/2)/n1; nameObj="CL" + ExtComplekt+"_"; /* if (ExtSave) { if (ExtPitchforkCandle && iBarShift(Symbol(),Period(),ExtDateTimePitchfork_3)>0) { nameObj=nameObj + save; ) else { if (mPitch[2]>0) { nameObj=nameObj + save; ) ) ) * / ObjectDelete(nameObj); ObjectCreate(nameObj,OBJ_CHANNEL,0,pitch_time[1],pitch_cena[1],Time[0],TLine,pitch_time[2],pitch_cena[2]); ObjectSet(nameObj, OBJPROP_BACK, true); ObjectSet(nameObj, OBJPROP_COLOR, ExtPitchforkStaticColor); ) //------------------------------------------------------- if (ExtISLStatic) { _ISL("ISL_S", pitch_time, pitch_cena, ExtLinePitchforkS); ) //------------------------------------------------------- if (ExtRLStatic) { _RL("RLineS", pitch_time, pitch_cena, ExtLinePitchforkS); ) //------------------------------------------------------- if (ExtRedZoneStatic) { _RZ("RZS", ExtRZStaticValue, ExtRZStaticColor, pitch_time, pitch_cena); ) //-------------------------------------------------------- // Fib Time Zones in the static Andrews' Pitchfork fiboTimeX (); ) //-------------------------------------------------------- // Conclusion Andrews' Pitchfork static. End. //-------------------------------------------------------- //-------------------------------------------------------- // Conclusion UWL_LWL. Start. //-------------------------------------------------------- void UWL_LWL (bool visible, string WL, string fiboFree) { int i,j,k; string str; double fi; if (ExtFiboType==2) { j=quantityFibo (fiboFree); str=fiboFree; ) else { j=12; str="0.146,0.236,0.382,0.5,0.618,0.764,0.854,1,1.618,2.0,2.618,4.0"; ) ObjectSet(nameObj,OBJPROP_FIBOLEVELS,j+1); for (i=0;i<=j;i++) { k=StringFind(str, ",", 0); fi=StrToDouble(StringTrimLeft(StringTrimRight(StringSubstr(str,0,k)))); ObjectSet(nameObj,OBJPROP_FIRSTLEVEL+i,fi); if (visible) ObjectSetFiboDescription(nameObj, i, WL+DoubleToStr(fi*100,1)); if (k>=0) str=StringSubstr(str,k+1); ) ) //-------------------------------------------------------- // Conclusion UWL_LWL. End. //-------------------------------------------------------- //-------------------------------------------------------- // Fibo-Time. Start. //-------------------------------------------------------- void fiboTimeX () { bool ft1, ft2, ft3; color ftc1, ftc2, ftc3; ft1=ExtFiboTime1; ft2=ExtFiboTime2; ft3=ExtFiboTime3; ftc1=ExtFiboTime1C; ftc2=ExtFiboTime2C; ftc3=ExtFiboTime3C; if (ExtFiboTimeNum>2) { ft1=ExtFiboTime1x; ft2=ExtFiboTime2x; ft3=ExtFiboTime3x; ftc1=ExtFiboTime1Cx; ftc2=ExtFiboTime2Cx; ftc3=ExtFiboTime3Cx; int mft[]={0,0,0}; string aa=DoubleToStr(ExtFiboTimeNum,0); double ftmincena; mft[0]=StrToInteger(StringSubstr(aa,0,1)); mft[1]=StrToInteger(StringSubstr(aa,1,1)); mft[2]=StrToInteger(StringSubstr(aa,2,1)); ArraySort(mft,WHOLE_ARRAY,0,MODE_DESCEND); if (mft[0]<3) ExtFiboTimeNum=0; else { if (mft[1]==1) mft[1]++; if (mft[1]==0) {mft[1]=mft[0]-1; mft[2]=mft[1]-1;} if (mft[2]==0) mft[2]=mft[1]-1; ) if (afrx[mft[0]]afrx[mft[2]]) ftmincena=afrx[mft[2]]; ) if (ft1) { if (ExtFiboTimeNum>2) { nameObj="fiboTime1Free" + ExtComplekt+"_"; ) else { nameObj="fiboTime1" + ExtComplekt+"_"; ) if (ExtSave) { if (ExtFiboTimeNum>2) { nameObj=nameObj + save; ) else { if (ExtPitchforkCandle && iBarShift(Symbol(),Period(),ExtDateTimePitchfork_3)>0) { nameObj=nameObj + save; ) else { if (mPitch[2]>0) { nameObj=nameObj + save; ) ) ) ) ObjectDelete(nameObj); if (ExtFiboTimeNum>2) { ObjectCreate(nameObj,OBJ_FIBOTIMES,0,afr[mft[0]],ftmincena-5*Point,afr[mft[2]],ftmincena-5*Point); ) else { if (ExtPitchforkCandle) { if (!ExtPitchfork_1_HighLow) { if (mPitchCena[0]>mPitchCena[2]) { ObjectCreate(nameObj,OBJ_FIBOTIMES,0,mPitchTime[0],mPitchCena[2]-5*Point,mPitchTime[2],mPitchCena[2]-5*Point); ) else { ObjectCreate(nameObj,OBJ_FIBOTIMES,0,mPitchTime[0],mPitchCena[0]-5*Point,mPitchTime[2],mPitchCena[0]-5*Point); ) ) else { ObjectCreate(nameObj,OBJ_FIBOTIMES,0,mPitchTime[0],mPitchCena[1]-5*Point,mPitchTime[2],mPitchCena[1]-5*Point); ) ) else { if (afrl[mPitch[0]]>0) { if (afrl[mPitch[0]]>afrl[mPitch[2]]) { ObjectCreate(nameObj,OBJ_FIBOTIMES,0,mPitchTime[0],mPitchCena[2]-5*Point,mPitchTime[2],mPitchCena[2]-5*Point); ) else { ObjectCreate(nameObj,OBJ_FIBOTIMES,0,mPitchTime[0],mPitchCena[0]-5*Point,mPitchTime[2],mPitchCena[0]-5*Point); ) ) else { ObjectCreate(nameObj,OBJ_FIBOTIMES,0,mPitchTime[0],mPitchCena[1]-5*Point,mPitchTime[2],afrl[mPitch[1]]-5*Point); ) ) ) ObjectSet(nameObj,OBJPROP_LEVELCOLOR,ftc1); if (ExtFiboTimeNum>2) { fiboTime (nameObj, afr[mft[0]], afr[mft[2]]-afr[mft[0]], 0, "FT1_"); ) else { fiboTime (nameObj, mPitchTime[0], mPitchTime[2]-mPitchTime[0], 0, "FT1 "); ) ) if (ft2) { if (ExtFiboTimeNum>2) { nameObj="fiboTime2Free" + ExtComplekt+"_"; ) else { nameObj="fiboTime2" + ExtComplekt+"_"; ) if (ExtSave) { if (ExtFiboTimeNum>2) { nameObj=nameObj + save; ) else { if (ExtPitchforkCandle && iBarShift(Symbol(),Period(),ExtDateTimePitchfork_3)>0) { nameObj=nameObj + save; ) else { if (mPitch[2]>0) { nameObj=nameObj + save; ) ) ) ) ObjectDelete(nameObj); if (ExtFiboTimeNum>2) { ObjectCreate(nameObj,OBJ_FIBOTIMES,0,afr[mft[1]],(afrx[mft[2]]+afrx[mft[1]])/2,afr[mft[2]],(afrx[mft[2]]+afrx[mft[1]])/2); ) else { ObjectCreate(nameObj,OBJ_FIBOTIMES,0,mPitchTime[1],(mPitchCena[2]+mPitchCena[1])/2,mPitchTime[2],(mPitchCena[2]+mPitchCena[1])/2); ) ObjectSet(nameObj,OBJPROP_LEVELCOLOR,ftc2); if (ExtFiboTimeNum>2) { fiboTime (nameObj, afr[mft[1]], afr[mft[2]]-afr[mft[1]], 1, "FT2_"); ) else { fiboTime (nameObj, mPitchTime[1], mPitchTime[2]-mPitchTime[1], 1, "FT2 "); ) ) if (ft3) { datetime shiftTime; if (ExtFiboTimeNum>2) { shiftTime=afr[mft[1]]-afr[mft[0]]; nameObj="fiboTime3Free" + ExtComplekt+"_"; ) else { shiftTime=mPitchTime[1]-mPitchTime[0]; nameObj="fiboTime3" + ExtComplekt+"_"; ) if (ExtSave) { if (ExtFiboTimeNum>2) { nameObj=nameObj + save; ) else { if (ExtPitchforkCandle && iBarShift(Symbol(),Period(),ExtDateTimePitchfork_3)>0) { nameObj=nameObj + save; ) else { if (mPitch[2]>0) { nameObj=nameObj + save; ) ) ) ) ObjectDelete(nameObj); if (ExtFiboTimeNum>2) { ObjectCreate(nameObj,OBJ_FIBOTIMES,0,afr[mft[2]]-shiftTime,(afrx[mft[2]]+afrx[mft[1]])/2-8*Point,afr[mft[2]],(afrx[mft[2]]+afrx[mft[1]])/2-8*Point); ) else { ObjectCreate(nameObj,OBJ_FIBOTIMES,0,mPitchTime[2]-shiftTime,(mPitchCena[2]+mPitchCena[1])/2-8*Point,mPitchTime[2],(mPitchCena[2]+mPitchCena[1])/2-8*Point); ) ObjectSet(nameObj,OBJPROP_LEVELCOLOR,ftc3); if (ExtFiboTimeNum>2) { fiboTime (nameObj, afr[mft[2]]-shiftTime, shiftTime, 2, "FT3_"); ) else { fiboTime (nameObj, mPitchTime[2]-shiftTime, shiftTime, 2, "FT3 "); ) ) ) //-------------------------------------------------------- // Fibo-Time. End. //-------------------------------------------------------- //-------------------------------------------------------- // Fibo-Time. Start. //-------------------------------------------------------- void fiboTime (string nameObj, datetime t1, datetime t2, int number, string ftx) { string str, str1; double fi; int j,k; int ftvisibleDT; string ftvisible; if (ExtFiboTimeNum>2) { ftvisibleDT=ExtVisibleDateTimex; ftvisible=ExtVisibleNumberFiboTimex; ) else { ftvisibleDT=ExtVisibleDateTime; ftvisible=ExtVisibleNumberFiboTime; ) ObjectSet(nameObj,OBJPROP_COLOR,ExtObjectColor); ObjectSet(nameObj,OBJPROP_STYLE,ExtObjectStyle); ObjectSet(nameObj,OBJPROP_WIDTH,ExtObjectWidth); ObjectSet(nameObj,OBJPROP_LEVELSTYLE,STYLE_DOT); ObjectSet(nameObj,OBJPROP_BACK,ExtBack); if (ExtFiboType==1) // Fiby Fibo-Time with the numbers Pesavento. { str="0.382,0.5,0.618,0.707,0.786,0.886,1.0,1.272,1.414,1.618,2.0,2.414,2.618,3.0"; ) else if (ExtFiboType==0) // Fiby Fibo-Time with the standard numbers. { str="0.146,0.236,0.382,0.5,0.618,0.764,0.854,1.0,1.236,1.382,1.618,2.0,2.618,3.0,4.0"; ) else if (ExtFiboType==2) // Fiby Fibo-Time with user numbers. { if (number==0) { str=ExtFiboFreeFT1; ) else if (number==1) { str=ExtFiboFreeFT2; ) else if (number==2) { str=ExtFiboFreeFT3; ) ) j=quantityFibo (str); ObjectSet(nameObj,OBJPROP_FIBOLEVELS, j+3); ObjectSet(nameObj,OBJPROP_FIRSTLEVEL+0,0.0); ObjectSet(nameObj,OBJPROP_FIRSTLEVEL+1,1.0); if (ftvisibleDT && StringSubstr(ftvisible,number,1)=="1") { ObjectSetFiboDescription(nameObj, 0, ftx + "0" + " " + TimeToStr(t1,TIME_DATE|TIME_MINUTES)); ObjectSetFiboDescription(nameObj, 1, ftx + "1.0" + " " + TimeToStr(t1 + t2,TIME_DATE|TIME_MINUTES)); ) else { ObjectSetFiboDescription(nameObj, 0, ftx + "0"); ObjectSetFiboDescription(nameObj, 1, ftx + "1.0"); ) for (int i=0; i<=j; i++) { k=StringFind(str, ",", 0); str1=StringTrimLeft(StringTrimRight(StringSubstr(str,0,k))); fi=StrToDouble(str1); if (fi<1) str1=StringSubstr(str1,1); ObjectSet(nameObj,OBJPROP_FIRSTLEVEL+(i+2),fi+1); if (ftvisibleDT && StringSubstr(ftvisible,number,1)=="1") { ObjectSetFiboDescription(nameObj, i+2, ftx + str1 + " " + TimeToStr(t1 + t2*(fi+1),TIME_DATE|TIME_MINUTES)); ) else { ObjectSetFiboDescription(nameObj, i+2, ftx + str1); ) if (k>=0) str=StringSubstr(str,k+1); ) ) //-------------------------------------------------------- // Fibo-Time. End. //-------------------------------------------------------- //-------------------------------------------------------- // Counter Phib. Start. //-------------------------------------------------------- int quantityFibo (string sFibo) { int j=0,i,k; while (true) { k=StringFind(sFibo, ",",i+1); if (k>0) {j++; i=k;} else return (j); ) ) //-------------------------------------------------------- // Counter Phib. End. //-------------------------------------------------------- //-------------------------------------------------------- // Conclusion Andrews' Pitchfork dynamic. Start. //-------------------------------------------------------- void screenPitchforkD() { int i; double b1,ab1,bc1,ab2,bc2,d,cena,m618=0.618,m382=0.382; datetime tb1,tab2,tbc2; int pitch_time[]={0,0,0}; double pitch_cena[]={0,0,0}; mPitchTime[0]=afr[2]; mPitchTime[1]=afr[1]; mPitchTime[2]=afr[0]; mPitchCena[0]=afrx[2]; mPitchCena[1]=afrx[1]; mPitchCena[2]=afrx[0]; cena=afrx[2]; if (afrl[2]>0) { if (ExtCM_0_1A_2B_Dinamic==1) { cena=mPitchCena[0]+(mPitchCena[1]-mPitchCena[0])*ExtCM_FiboDinamic; ) else if (ExtCM_0_1A_2B_Dinamic==4) { mPitchTimeSave=mPitchTime[0]; mPitchTime[0]=mPitchTime[1]; if (maxGipotenuza4(mPitchTime,mPitchCena)) { cena=mPitchCena[1]-(mPitchCena[1]-mPitchCena[2])*m618; ) else { cena=mPitchCena[1]-(mPitchCena[1]-mPitchCena[2])*m382; ) ) else if (ExtCM_0_1A_2B_Dinamic==5) { mPitchTimeSave=mPitchTime[0]; mPitchTime[0]=mPitchTime[1]; if (maxGipotenuza5(mPitchTime,mPitchCena)) { cena=mPitchCena[1]-(mPitchCena[1]-mPitchCena[2])*m618; ) else { cena=mPitchCena[1]-(mPitchCena[1]-mPitchCena[2])*m382; ) ) else if (ExtCM_0_1A_2B_Dinamic>1) { if (ExtCM_0_1A_2B_Dinamic==2) mPitchTime[0]=mPitchTime[1]; cena=mPitchCena[1]-(mPitchCena[1]-mPitchCena[2])*ExtCM_FiboDinamic; ) ) else { if (ExtCM_0_1A_2B_Dinamic==1) { cena=mPitchCena[0]-(mPitchCena[0]-mPitchCena[1])*ExtCM_FiboDinamic; ) else if (ExtCM_0_1A_2B_Dinamic==4) { mPitchTimeSave=mPitchTime[0]; mPitchTime[0]=mPitchTime[1]; if (maxGipotenuza4(mPitchTime,mPitchCena)) { cena=mPitchCena[1]+(mPitchCena[2]-mPitchCena[1])*m618; ) else { cena=mPitchCena[1]+(mPitchCena[2]-mPitchCena[1])*m382; ) ) else if (ExtCM_0_1A_2B_Dinamic==5) { mPitchTimeSave=mPitchTime[0]; mPitchTime[0]=mPitchTime[1]; if (maxGipotenuza5(mPitchTime,mPitchCena)) { cena=mPitchCena[1]+(mPitchCena[2]-mPitchCena[1])*m618; ) else { cena=mPitchCena[1]+(mPitchCena[2]-mPitchCena[1])*m382; ) ) else if (ExtCM_0_1A_2B_Dinamic>1) { if (ExtCM_0_1A_2B_Dinamic==2) mPitchTime[0]=mPitchTime[1]; cena=mPitchCena[1]+(mPitchCena[2]-mPitchCena[1])*ExtCM_FiboDinamic; ) ) mPitchCena[0]=cena; coordinaty_1_2_mediany_AP(mPitchCena[0], mPitchCena[1], mPitchCena[2], mPitchTime[0], mPitchTime[1], mPitchTime[2], tab2, tbc2, ab1, bc1); pitch_time[0]=tab2;pitch_cena[0]=ab1; nameObj="pmedianaD" + ExtComplekt+"_"; ObjectDelete(nameObj); if (ExtPitchforkDinamic==2) { ObjectCreate(nameObj,OBJ_TREND,0,tab2,ab1,tbc2,bc1); ObjectSet(nameObj,OBJPROP_STYLE,STYLE_DASH); ObjectSet(nameObj,OBJPROP_COLOR,ExtLinePitchforkD); ObjectSet(nameObj,OBJPROP_BACK,ExtBack); nameObj="1-2pmedianaD" + ExtComplekt+"_"; ObjectDelete(nameObj); ObjectCreate(nameObj,OBJ_TEXT,0,tab2,ab1+3*Point); ObjectSetText(nameObj," 1/2 ML",9,"Arial", ExtLinePitchforkD); ) nameObj="pitchforkD" + ExtComplekt+"_"; ObjectDelete(nameObj); if (ExtPitchforkDinamic!=4) { pitch_time[0]=mPitchTime[0];pitch_cena[0]=mPitchCena[0]; if (ExtPitchforkDinamic==3) pitch_cena[0]=ab1; ) pitch_time[1]=mPitchTime[1];pitch_cena[1]=mPitchCena[1]; pitch_time[2]=mPitchTime[2];pitch_cena[2]=mPitchCena[2]; ObjectCreate(nameObj,OBJ_PITCHFORK,0,pitch_time[0],pitch_cena[0],pitch_time[1],pitch_cena[1],pitch_time[2],pitch_cena[2]); ObjectSet(nameObj,OBJPROP_STYLE,ExtPitchforkStyle); ObjectSet(nameObj,OBJPROP_WIDTH,ExtPitchforkWidth); ObjectSet(nameObj,OBJPROP_COLOR,ExtLinePitchforkD); ObjectSet(nameObj,OBJPROP_BACK,ExtBack); if (ExtPivotZoneDinamicColor>0 && ExtPitchforkDinamic<4) PivotZone(pitch_time, pitch_cena, ExtPivotZoneDinamicColor, "PivotZoneD"); if (ExtFiboFanMedianaDinamicColor>0) { coordinaty_mediany_AP(pitch_cena[0], pitch_cena[1], pitch_cena[2], pitch_time[0], pitch_time[1], pitch_time[2], tb1, b1); nameObj="FanMedianaDinamic" + ExtComplekt+"_"; ObjectDelete(nameObj); ObjectCreate(nameObj,OBJ_FIBOFAN,0,pitch_time[0],pitch_cena[0],tb1,b1); ObjectSet(nameObj,OBJPROP_LEVELSTYLE,STYLE_DASH); ObjectSet(nameObj,OBJPROP_LEVELCOLOR,ExtFiboFanMedianaDinamicColor); ObjectSet(nameObj,OBJPROP_BACK,ExtBack); if (ExtFiboType==0) { screenFibo_st(); ) else if (ExtFiboType==1) { screenFibo_Pesavento(); ) else if (ExtFiboType==2) { ObjectSet(nameObj,OBJPROP_FIBOLEVELS,Sizefi); for (i=0;i0) { nameObj=nameObj + save; ) else { if (mPitch[2]>0) { nameObj=nameObj + save; ) ) ) ObjectDelete(nameObj); ObjectCreate(nameObj,OBJ_FIBOCHANNEL,0,ta1,a1,tb1,b1,tc1,c1); ObjectSet(nameObj,OBJPROP_LEVELCOLOR,lineColor); ObjectSet(nameObj,OBJPROP_LEVELSTYLE,ExtISLStyle); ObjectSet(nameObj,OBJPROP_LEVELWIDTH,ExtISLWidth); ObjectSet(nameObj,OBJPROP_RAY,false); ObjectSet(nameObj,OBJPROP_BACK,ExtBack); ObjectSet(nameObj,OBJPROP_COLOR,CLR_NONE); if (ExtFiboType==0) { str="0.854,0.764,0.618,0.382,0.236,0.146"; ) else if (ExtFiboType==1) { str="0.886,0.786,0.618,0.382,0.236,0.146"; ) else if (ExtFiboType==2) { str=ExtFiboFreeISL; ) j=quantityFibo (str); ObjectSet(nameObj,OBJPROP_FIBOLEVELS,j+1); for (i=0;i<=j;i++) { k=StringFind(str, ",", 0); fi=StrToDouble(StringTrimLeft(StringTrimRight(StringSubstr(str,0,k)))); ObjectSet(nameObj,OBJPROP_FIRSTLEVEL+i,-fi); if (ExtVisibleISL) ObjectSetFiboDescription(nameObj, i," I S L "+DoubleToStr(fi*100,1)); if (k>=0) str=StringSubstr(str,k+1); ) ) //-------------------------------------------------------- // Conclusion ISL. End. //-------------------------------------------------------- //-------------------------------------------------------- // Conclusion RLine. Start. //-------------------------------------------------------- void _RL(string nameRL, datetime pitch_time[], double pitch_cena[], color lineColor) { string str; double fi; int i,j,k,n,nbase1,nbase2,mirror1,mirror2; double a1,b1,c1; datetime ta1,tb1,tc1; n=iBarShift(Symbol(),Period(),pitch_time[0])-(iBarShift(Symbol(),Period(),pitch_time[1])+iBarShift(Symbol(),Period(),pitch_time[2]))/2.0; nbase1=iBarShift(Symbol(),Period(),mPitchTime[1]); nbase2=iBarShift(Symbol(),Period(),mPitchTime[2]); if (nbase1+n<=Bars) { mirror1=1; mirror2=0; ta1=Time[nbase1+n]; tb1=Time[nbase2+n]; tc1=mPitchTime[1]; a1=(pitch_cena[0]-(mPitchCena[1]+mPitchCena[2])/2)+mPitchCena[1]; b1=(pitch_cena[0]-(mPitchCena[1]+mPitchCena[2])/2)+mPitchCena[2]; c1=mPitchCena[1]; ) else { mirror1=-1; mirror2=-1; ta1=mPitchTime[2]; tb1=mPitchTime[1]; tc1=Time[nbase2+n]; a1=mPitchCena[2]; b1=mPitchCena[1]; c1=(pitch_cena[0]-(mPitchCena[1]+mPitchCena[2])/2)+mPitchCena[2]; ) nameObj=nameRL + ExtComplekt+"_"; if (ExtSave && nameRL=="RLineS") { if (ExtPitchforkCandle && iBarShift(Symbol(),Period(),ExtDateTimePitchfork_3)>0) { nameObj=nameObj + save; ) else { if (mPitch[2]>0) { nameObj=nameObj + save; ) ) ) ObjectDelete(nameObj); ObjectCreate(nameObj,OBJ_FIBOCHANNEL,0,ta1,a1,tb1,b1,tc1,c1); ObjectSet(nameObj,OBJPROP_LEVELCOLOR,lineColor); if (ExtRLineBase) { ObjectSet(nameObj,OBJPROP_COLOR,CLR_NONE); ) else { ObjectSet(nameObj,OBJPROP_COLOR,lineColor); ) if (ExtFiboType==1) { if (ExtRL146) j=16; else j=14; str="0.382,0.5,0.618,0.707,0.786,0.886,1,1.128,1.272,1.414,1.618,2.0,2.414,2.618,4.0,0.146,0.236"; ) else if (ExtFiboType==0) { if (ExtRL146) j=12; else j=11; str="0.236,0.382,0.5,0.618,0.764,0.854,1,1.236,1.618,2.0,2.618,4.0,0.146"; ) else if (ExtFiboType==2) { j=quantityFibo (ExtFiboFreeRL); str=ExtFiboFreeRL; ) ObjectSet(nameObj,OBJPROP_LEVELSTYLE,STYLE_DOT); ObjectSet(nameObj,OBJPROP_RAY,false); ObjectSet(nameObj,OBJPROP_BACK,ExtBack); ObjectSet(nameObj,OBJPROP_FIBOLEVELS,j+1); for (i=0;i<=j;i++) { k=StringFind(str, ",", 0); fi=StrToDouble(StringTrimLeft(StringTrimRight(StringSubstr(str,0,k)))); ObjectSet(nameObj,OBJPROP_FIRSTLEVEL+i,mirror2+mirror1*fi); if (ExtVisibleRL) ObjectSetFiboDescription(nameObj, i, " RL "+DoubleToStr(fi*100,1)); if (k>=0) str=StringSubstr(str,k+1); ) ) //-------------------------------------------------------- // Conclusion RLine. End. //-------------------------------------------------------- //-------------------------------------------------------- // Conclusion RedZone. Start. //-------------------------------------------------------- void _RZ(string nameRZ, double RZValue, color RZColor, datetime pitch_time[], double pitch_cena[]) { int i,j,k,n,_nbase1,_nbase2; double b1,hRZ,delta,h=0,hbase,tangens23,tangensMediana,n1,nbase0,nbase1,nbase2; datetime tb1; nbase0=iBarShift(Symbol(),Period(),pitch_time[0]); nbase1=iBarShift(Symbol(),Period(),pitch_time[1]); nbase2=iBarShift(Symbol(),Period(),pitch_time[2]); _nbase1=iBarShift(Symbol(),Period(),pitch_time[1]); _nbase2=iBarShift(Symbol(),Period(),pitch_time[2]); tangens23=(pitch_cena[2]-pitch_cena[1])/(nbase1-nbase2); n1=nbase0-(nbase1+nbase2)/2; tangensMediana=((pitch_cena[2]+pitch_cena[1])/2-pitch_cena[0])/n1; hbase=pitch_cena[0]-(pitch_cena[1]-(nbase0-nbase1)*tangens23); hRZ=hbase*RZValue; if (pitch_cena[1]>pitch_cena[2]) { for (i=_nbase1-1;i>=_nbase2;i--) { delta=(pitch_cena[1]+(_nbase1-i)*tangens23)-High[i]; if (delta=_nbase2;i--) { delta=(pitch_cena[1]+(_nbase1-i)*tangens23)-Low[i]; if (delta>h) h=delta; ) ) if (infoTF) { if (nameRZ=="RZS") { info_RZS_RL=DoubleToStr(MathAbs(100*h/hbase),1); ) else if (nameRZ=="RZD") { info_RZD_RL=DoubleToStr(MathAbs(100*h/hbase),1); ) ) if (MathAbs(hRZ)=0) tb1=Time[n]; else tb1=Time[0]+MathAbs(n)*60*Period(); b1=pitch_cena[2]+i*tangens23-hRZ; nameObj=nameRZ + ExtComplekt+"_"; ObjectDelete(nameObj); ObjectCreate(nameObj,OBJ_CHANNEL,0,pitch_time[2],pitch_cena[2],tb1,b1,pitch_time[1],pitch_cena[1]); ObjectSet(nameObj, OBJPROP_COLOR, RZColor); ObjectSet(nameObj, OBJPROP_BACK, true); ObjectSet(nameObj, OBJPROP_RAY, false); ) //-------------------------------------------------------- // Conclusion RedZone. End. //-------------------------------------------------------- //-------------------------------------------------------- // Sub calculating the coordinates 1 / 2 midpoint of Andrews' Pitchfork. Start. //-------------------------------------------------------- // Transmitted parameters of price and time of three points of Andrews' Pitchfork // and a link to the variables - // tAB2, tBC2 - time bars, through which held 1 / 2 median // AB2, BC2 - the price value of points through which to conduct a 1 / 2 median // void coordinaty_1_2_mediany_AP(double A_1, double B_2, double C_3, datetime T_1, datetime T_2, datetime T_3, datetime& tAB2, datetime& tBC2, double& AB2, double& BC2) { double tangens; int n1, n2, n3, nab2, nbc2; // number of bars, which are based on Andrews' Pitchfork n1=iBarShift(Symbol(),Period(),T_1); n2=iBarShift(Symbol(),Period(),T_2); n3=iBarShift(Symbol(),Period(),T_3); // slope of 1 / 2 midpoint of Andrews' Pitchfork tangens=(C_3 - A_1)/(n1 - n3); // number of bars, through which will be built 1 / 2 median nab2=MathCeil((n1+n2)/2.0); nbc2=MathCeil((n2+n3)/2.0); // value price points, through which will be built 1 / 2 median AB2=(A_1 + B_2)/2 - (nab2-(n1+n2)/2.0)*tangens; BC2=(B_2 + C_3)/2 - (nbc2-(n2+n3)/2.0)*tangens; // ????? ?????, ????? ??????? ????? ????????? 1/2 median tAB2=Time[nab2]; tBC2=Time[nbc2]; ) //-------------------------------------------------------- // Sub calculating the coordinates 1 / 2 midpoint of Andrews' Pitchfork. End. //-------------------------------------------------------- //-------------------------------------------------------- // Sub calculate the coordinates of a point on the midpoint of Andrews' Pitchfork. Start. //-------------------------------------------------------- // Transmitted parameters of price and time of three points of Andrews' Pitchfork // and a link to the variables - // tAB2, tBC2 - time bars, through which held 1 / 2 median // AB2, BC2 - the price value of points through which to conduct a 1 / 2 median // void coordinaty_mediany_AP(double A_1, double B_2, double C_3, datetime T_1, datetime T_2, datetime T_3, datetime& tB1, double& B1) { double tangens; int n1, n2, n3, nbc2; // number of bars, which are based on Andrews' Pitchfork n1=iBarShift(Symbol(),Period(),T_1); n2=iBarShift(Symbol(),Period(),T_2); n3=iBarShift(Symbol(),Period(),T_3); // the slope of the midpoint of Andrews' Pitchfork tangens=(A_1-(C_3+B_2)/2)/(n1 - (n3+n2)/2.0); // number of bar, through which the median nbc2=MathCeil((n2+n3)/2.0); // value price point, through which the median B1=(B_2 + C_3)/2 - ((n2+n3)/2.0-nbc2)*tangens; // time bar, through which the median tB1=Time[nbc2]; ) //-------------------------------------------------------- // Sub calculate the coordinates of a point on the midpoint of Andrews' Pitchfork. End. //-------------------------------------------------------- //-------------------------------------------------------- // Comparison of the hypotenuse for ExtCM_0_1A_2B = 4. Start. //------------------------------------------------------- bool maxGipotenuza4(datetime pitch_time1[], double pitch_cena1[]) { double k2,k3; datetime k4,k5; k2=MathAbs(pitch_cena1[0]-pitch_cena1[1])/ASBar; k3=MathAbs(pitch_cena1[1]-pitch_cena1[2])/ASBar; k4=iBarShift(NULL,GrossPeriod,mPitchTimeSave)-iBarShift(NULL,GrossPeriod,pitch_time1[1]); k5=iBarShift(NULL,GrossPeriod,pitch_time1[1])-iBarShift(NULL,GrossPeriod,pitch_time1[2]); if (k2*k2+k4*k4>k3*k3+k5*k5) return(true); else return(false); ) //-------------------------------------------------------- // Comparison of the hypotenuse for ExtCM_0_1A_2B = 4. End. //------------------------------------------------------- //-------------------------------------------------------- // Comparison of the hypotenuse for ExtCM_0_1A_2B = 5. Start. //------------------------------------------------------- bool maxGipotenuza5(datetime pitch_time1[], double pitch_cena1[]) { double k2,k3; datetime k4,k5; k2=MathAbs(pitch_cena1[0]-pitch_cena1[1])/Point; k3=MathAbs(pitch_cena1[1]-pitch_cena1[2])/Point; k4=iBarShift(NULL,GrossPeriod,mPitchTimeSave)-iBarShift(NULL,GrossPeriod,pitch_time1[1]); k5=iBarShift(NULL,GrossPeriod,pitch_time1[1])-iBarShift(NULL,GrossPeriod,pitch_time1[2]); if (k2*k2+k4*k4>k3*k3+k5*k5) return(true); else return(false); ) //-------------------------------------------------------- // Comparison of the hypotenuse for ExtCM_0_1A_2B = 5. End. //------------------------------------------------------- //-------------------------------------------------------- // Pivot Zone. Start. //------------------------------------------------------- void PivotZone(datetime pitch_time1[], double pitch_cena1[], color PivotZoneColor, string name) { datetime ta1, tb1; double a1, b1, d, n1; int m, m1, m2; ta1=pitch_time1[2]; a1=pitch_cena1[2]; m1=iBarShift(Symbol(),Period(),pitch_time1[0])-iBarShift(Symbol(),Period(),pitch_time1[1]); m2=iBarShift(Symbol(),Period(),pitch_time1[1])-iBarShift(Symbol(),Period(),pitch_time1[2]); m=iBarShift(Symbol(),Period(),pitch_time1[2]); n1=iBarShift(Symbol(),Period(),pitch_time1[0])-(iBarShift(Symbol(),Period(),pitch_time1[1])+iBarShift(Symbol(),Period(),pitch_time1[2]))/2.0; d=(pitch_cena1[0]-(pitch_cena1[1]+pitch_cena1[2])/2.0)/n1; if (m1>m2) { if (m1>m) { tb1=Time[0]+(m1-m)*Period()*60; ) else { tb1=Time[iBarShift(Symbol(),Period(),pitch_time1[2])-m1]; ) b1=pitch_cena1[0]-d*(2*m1+m2); ) else { if (m2>m) { tb1=Time[0]+(m2-m)*Period()*60; ) else { tb1=Time[iBarShift(Symbol(),Period(),pitch_time1[2])-m2]; ) b1=pitch_cena1[0]-d*(2*m2+m1); ) nameObj=name + ExtComplekt+"_"; ObjectDelete(nameObj); ObjectCreate(nameObj,OBJ_RECTANGLE,0,ta1,a1,tb1,b1); ObjectSetText(nameObj,"PZ "+Period_tf+" "+TimeToStr(tb1,TIME_DATE|TIME_MINUTES)); ObjectSet(nameObj, OBJPROP_BACK, ExtPivotZoneFramework); ObjectSet(nameObj, OBJPROP_COLOR, PivotZoneColor); ) //-------------------------------------------------------- // Pivot Zone. End. //------------------------------------------------------- //-------------------------------------------------------- // Defining the point of intersection RL400 median. Start. //------------------------------------------------------- // flag=true - calculated ISL // flag=false - calculated UWL / LWL void ML_RL400(double Tangens, double pitch_cena1[], datetime pitch_time1[], int& tB1, double& B1, bool flag) { int m, m1, m2; m1=iBarShift(Symbol(),Period(),pitch_time1[0]); m2=MathCeil((iBarShift(Symbol(),Period(),pitch_time1[1])+iBarShift(Symbol(),Period(),pitch_time1[2]))/2.0); m=(m1-m2)*4; if (m>m2) { tB1=Time[0]+(m-m2)*Period()*60; if (tB1<0) tB1=2133648000; if (flag) B1=pitch_cena1[1]-Tangens*(iBarShift(Symbol(),Period(),pitch_time1[1])+(tB1-Time[0])/(60*Period())); else B1=pitch_cena1[0]-Tangens*(iBarShift(Symbol(),Period(),pitch_time1[0])+(tB1-Time[0])/(60*Period())); ) else { tB1=Time[m2-m]; if (flag) B1=pitch_cena1[1]-Tangens*(iBarShift(Symbol(),Period(),pitch_time1[1])-iBarShift(Symbol(),Period(),tB1)); else B1=pitch_cena1[0]-Tangens*(iBarShift(Symbol(),Period(),pitch_time1[0])-iBarShift(Symbol(),Period(),tB1)); ) ) //-------------------------------------------------------- // Defining the point of intersection RL400 median. End. //------------------------------------------------------- //-------------------------------------------------------- // Conclusion arbitrary fiboveerov. Start. //-------------------------------------------------------- void screenFiboFan() { int i; double a1,b1; a1=afrx[mFan[0]]; b1=afrx[mFan[1]]; nameObj="FiboFan" + ExtComplekt+"_"; if (mFan[1]>0) { if (ExtSave) { nameObj=nameObj + save; ) ) ObjectDelete(nameObj); ObjectCreate(nameObj,OBJ_FIBOFAN,0,afr[mFan[0]],a1,afr[mFan[1]],b1); ObjectSet(nameObj,OBJPROP_LEVELSTYLE,ExtFanStyle); ObjectSet(nameObj,OBJPROP_LEVELWIDTH,ExtFanWidth); ObjectSet(nameObj,OBJPROP_LEVELCOLOR,ExtFiboFanColor); ObjectSet(nameObj,OBJPROP_BACK,ExtBack); ObjectSet(nameObj,OBJPROP_COLOR,ExtObjectColor); ObjectSet(nameObj,OBJPROP_STYLE,ExtObjectStyle); ObjectSet(nameObj,OBJPROP_WIDTH,ExtObjectWidth); if (ExtFiboType==0) { screenFibo_st(); ) else if (ExtFiboType==1) { screenFibo_Pesavento(); ) else if (ExtFiboType==2) { ObjectSet(nameObj,OBJPROP_FIBOLEVELS,Sizefi); for (i=0;i0) { if (ExtSave) { nameObj=nameObj + save; ) ) screenFibo_(ExtFiboS, " ", mFibo[0], mFibo[1]); ) //-------------------------------------------------------- // Conclusion Phib static. End. //-------------------------------------------------------- //-------------------------------------------------------- // Conclusion Phib dynamic. Start. //-------------------------------------------------------- void screenFiboD() { nameObj="fiboD" + ExtComplekt+"_"; screenFibo_(ExtFiboD, "", 1, 0); ) //-------------------------------------------------------- // Conclusion Phib dynamic. End. //-------------------------------------------------------- //-------------------------------------------------------- // Creating Phib. Start. //-------------------------------------------------------- void screenFibo_(color colorFibo, string otstup, int a1, int a2) { double fibo_0, fibo_100, fiboPrice, fiboPrice1; ObjectDelete(nameObj); if (!ExtFiboCorrectionExpansion) { fibo_0=afrx[a1];fibo_100=afrx[a2]; fiboPrice=afrx[a1]-afrx[a2];fiboPrice1=afrx[a2]; ) else { fibo_100=afrx[a1];fibo_0=afrx[a2]; fiboPrice=afrx[a2]-afrx[a1];fiboPrice1=afrx[a1]; ) if (!ExtFiboCorrectionExpansion) { ObjectCreate(nameObj,OBJ_FIBO,0,afr[a1],fibo_0,afr[a2],fibo_100); ) else { ObjectCreate(nameObj,OBJ_FIBO,0,afr[a2],fibo_0,afr[a1],fibo_100); ) ObjectSet(nameObj,OBJPROP_LEVELCOLOR,colorFibo); ObjectSet(nameObj,OBJPROP_COLOR,ExtObjectColor); ObjectSet(nameObj,OBJPROP_STYLE,ExtObjectStyle); ObjectSet(nameObj,OBJPROP_WIDTH,ExtObjectWidth); ObjectSet(nameObj,OBJPROP_LEVELSTYLE,ExtFiboStyle); ObjectSet(nameObj,OBJPROP_LEVELWIDTH,ExtFiboWidth); ObjectSet(nameObj,OBJPROP_BACK,ExtBack); if (ExtFiboType==0) { fibo_standart (fiboPrice, fiboPrice1,"-"+Period_tf+otstup); ) else if (ExtFiboType==1) { fibo_patterns(fiboPrice, fiboPrice1,"-"+Period_tf+otstup); ) else if (ExtFiboType==2) { fibo_custom (fiboPrice, fiboPrice1,"-"+Period_tf+otstup); ) ) //-------------------------------------------------------- // Creating Phib. End. //-------------------------------------------------------- //-------------------------------------------------------- // Fiby standard. Start. //-------------------------------------------------------- void fibo_standart(double fiboPrice,double fiboPrice1,string fibo) { double fi_1[]={0, 0.146, 0.236, 0.382, 0.5, 0.618, 0.764, 0.854, 1.0, 1.236, phi, 2.618, 4.236, 6.854}; string fitxt100_1[]={"0.0", "14.6", "23.6", "38.2", "50.0", "61.8", "76.4", "85.4", "100.0", "123.6", "161.8", "2.618", "423.6", "685.4"}; int i; Sizefi_1=14; if (!ExtFiboCorrectionExpansion) { ObjectSet(nameObj,OBJPROP_FIBOLEVELS,Sizefi_1); for (i=0;i0) { ObjectSet(nameObj,OBJPROP_FIRSTLEVEL+i+2,1+fi[i]); ObjectSetFiboDescription(nameObj, i+2, "Fe "+fitxt100[i]+" "+DoubleToStr(fiboPrice*(1+fi[i])+fiboPrice1, Digits)+fibo); ) ) ) ) //-------------------------------------------------------- // Fiby custom. End. //-------------------------------------------------------- //-------------------------------------------------------- // Conclusion Fibo Arcs static. Start. //-------------------------------------------------------- void screenFiboArcS() { double fibo_0, fibo_100, AutoScale; fibo_0=afrx[mArcS[0]];fibo_100=afrx[mArcS[1]]; if (ExtArcStaticScale>0) { AutoScale=ExtArcStaticScale; ) else { AutoScale=(MathAbs(fibo_0-fibo_100)/Point)/MathAbs(iBarShift(Symbol(),Period(),afr[mArcS[1]])-iBarShift(Symbol(),Period(),afr[mArcS[0]])); ) nameObj="FiboArcS" + ExtComplekt+"_"; if (ExtSave) { nameObj=nameObj + save; ) ObjectDelete(nameObj); ObjectCreate(nameObj,OBJ_FIBOARC,0,afr[mArcS[0]],fibo_0,afr[mArcS[1]],fibo_100); fiboArc(AutoScale, ExtArcStaticColor); ) //-------------------------------------------------------- // Conclusion Fibo Arcs static. End. //-------------------------------------------------------- //-------------------------------------------------------- // Conclusion Fibo Arcs dynamic. Start. //-------------------------------------------------------- void screenFiboArcD() { double fibo_0, fibo_100, AutoScale; fibo_0=afrx[mArcD[0]];fibo_100=afrx[mArcD[1]]; if (ExtArcDinamicScale>0) { AutoScale=ExtArcDinamicScale; ) else { AutoScale=(MathAbs(fibo_0-fibo_100)/Point)/MathAbs(iBarShift(Symbol(),Period(),afr[mArcD[1]])-iBarShift(Symbol(),Period(),afr[mArcD[0]])); ) nameObj="FiboArcD" + ExtComplekt+"_"; ObjectDelete(nameObj); ObjectCreate(nameObj, OBJ_FIBOARC,0,afr[mArcD[0]],fibo_0,afr[mArcD[1]],fibo_100); fiboArc(AutoScale, ExtArcDinamicColor); ) //-------------------------------------------------------- // Conclusion Fibo Arcs dynamic. End. //-------------------------------------------------------- //-------------------------------------------------------- // Fiby for Fibo Arcs. Start. //-------------------------------------------------------- void fiboArc(double AutoScale, color ArcColor) { ObjectSet(nameObj,OBJPROP_SCALE,AutoScale); ObjectSet(nameObj,OBJPROP_BACK,ExtBack); ObjectSet(nameObj,OBJPROP_COLOR,ExtObjectColor); ObjectSet(nameObj,OBJPROP_STYLE,ExtObjectStyle); ObjectSet(nameObj,OBJPROP_WIDTH,ExtObjectWidth); ObjectSet(nameObj,OBJPROP_ELLIPSE,true); ObjectSet(nameObj,OBJPROP_LEVELCOLOR,ArcColor); ObjectSet(nameObj,OBJPROP_LEVELSTYLE,ExtArcStyle); ObjectSet(nameObj,OBJPROP_LEVELWIDTH,ExtArcWidth); if (ExtFiboType==0) { fiboArc_st(); ) else if (ExtFiboType==1) { fiboArc_Pesavento(); ) else if (ExtFiboType==2) { fiboArc_custom(); ) ) //-------------------------------------------------------- // Fiby for Fibo Arcs. End. //-------------------------------------------------------- //-------------------------------------------------------- // Fiby for standard Fibo arcs. Start. //-------------------------------------------------------- void fiboArc_st() { double fi_1[]={0.0, 0.146, 0.236, 0.382, 0.5, 0.618, 0.764, 0.854, 1.0, 1.236, phi, 2.0, 2.618, 3.0, 4.236, 4.618}; string fitxt100_1[]={"0.0", "14.6", "23.6", "38.2", "50.0", "61.8", "76.4", "85.4", "100.0", "123.6", "161.8", "200.0", "261.8", "300.0", "423.6", "461.8"}; int i; Sizefi_1=16; ObjectSet(nameObj,OBJPROP_FIBOLEVELS,Sizefi_1); for (i=0;i= 0 && y2 >= 0) || (x2 <= 0 && y2 <= 0)) color lineColor = spiralColor1; else lineColor = spiralColor2; ObjectDelete(label); ObjectCreate(label, OBJ_TREND, 0, GetTime(timeShift1), price1, GetTime(timeShift2), price2, 0, 0); ObjectSet(label, OBJPROP_RAY, 0); ObjectSet(label, OBJPROP_COLOR, lineColor); ObjectSet(label, OBJPROP_STYLE, ExtSpiralStyle); ObjectSet(label, OBJPROP_WIDTH, ExtSpiralWidth); ) //+------------------------------------------------------------------+ //| | //+------------------------------------------------------------------+ datetime GetTime(int timeShift) { if(timeShift >= 0) return(Time[timeShift]); datetime time = Time[0] - Period()*timeShift*60; return(time); ) //+------------------------------------------------------------------+ //| | //+------------------------------------------------------------------+ double Scale() { double priceRange = WindowPriceMax(0) - WindowPriceMin(0); double barsCount = WindowBarsPerChart(); double chartScale = (priceRange / Point) / barsCount; return(chartScale*GPixels/VPixels); ) //+------------------------------------------------------------------+ //| | //+------------------------------------------------------------------+ //-------------------------------------------------------- // Options to draw a golden spiral. End. //-------------------------------------------------------- //-------------------------------------------------------- // Conclusion Fibo fans static. Start. //-------------------------------------------------------- void screenFiboFanS() { double fiboPrice1, fiboPrice2; nameObj="fiboFanS" + ExtComplekt+"_"; ObjectDelete(nameObj); if (ExtPitchforkCandle) { if (ExtPitchfork_1_HighLow) { fiboPrice1=mPitchCena[1];fiboPrice2=mPitchCena[2]; ) else { fiboPrice1=mPitchCena[1];fiboPrice2=mPitchCena[2]; ) ObjectCreate(nameObj,OBJ_FIBOFAN,0,mPitchTime[1],fiboPrice1,mPitchTime[2],fiboPrice2); ) else { if (afrl[mPitch[1]]>0) { fiboPrice1=afrl[mPitch[1]];fiboPrice2=afrh[mPitch[2]]; ) else { fiboPrice1=afrh[mPitch[1]];fiboPrice2=afrl[mPitch[2]]; ) ObjectCreate(nameObj,OBJ_FIBOFAN,0,afr[mPitch[1]],fiboPrice1,afr[mPitch[2]],fiboPrice2); ) ObjectSet(nameObj,OBJPROP_LEVELCOLOR,ExtFiboFanS); FiboFanLevel(); ) //-------------------------------------------------------- // Conclusion Fibo fans static. End. //-------------------------------------------------------- //-------------------------------------------------------- // Conclusion Fibo fans dynamic. Start. //-------------------------------------------------------- void screenFiboFanD() { double fiboPrice1, fiboPrice2; nameObj="fiboFanD" + ExtComplekt+"_"; ObjectDelete(nameObj); fiboPrice1=afrx[1];fiboPrice2=afrx[0]; ObjectCreate(nameObj,OBJ_FIBOFAN,0,afr[1],fiboPrice1,afr[0],fiboPrice2); ObjectSet(nameObj,OBJPROP_LEVELCOLOR,ExtFiboFanD); FiboFanLevel(); ) //-------------------------------------------------------- // Conclusion Fibo fans dynamic. End. //-------------------------------------------------------- //-------------------------------------------------------- // Levels Fibo fans. End. //-------------------------------------------------------- void FiboFanLevel() { if(ExtFiboFanExp) ObjectSet(nameObj,OBJPROP_FIBOLEVELS,6); else ObjectSet(nameObj,OBJPROP_FIBOLEVELS,4); ObjectSet(nameObj,OBJPROP_COLOR,ExtObjectColor); ObjectSet(nameObj,OBJPROP_STYLE,ExtObjectStyle); ObjectSet(nameObj,OBJPROP_WIDTH,ExtObjectWidth); ObjectSet(nameObj,OBJPROP_LEVELSTYLE,STYLE_DASH); ObjectSet(nameObj,OBJPROP_BACK,ExtBack); ObjectSet(nameObj,OBJPROP_FIRSTLEVEL+0,0.236); ObjectSet(nameObj,OBJPROP_FIRSTLEVEL+1,0.382); ObjectSet(nameObj,OBJPROP_FIRSTLEVEL+2,0.5); ObjectSet(nameObj,OBJPROP_FIRSTLEVEL+3,0.618); if (ExtFiboFanHidden) { ObjectSetFiboDescription(nameObj, 0, "23.6"); ObjectSetFiboDescription(nameObj, 1, "38.2"); ObjectSetFiboDescription(nameObj, 2, "50.0"); ObjectSetFiboDescription(nameObj, 3, "61.8"); ) if(ExtFiboFanExp) { if (ExtFiboType==0) { ObjectSet(nameObj,OBJPROP_FIRSTLEVEL+4,0.764); ObjectSet(nameObj,OBJPROP_FIRSTLEVEL+5,0.854); if (ExtFiboFanHidden) { ObjectSetFiboDescription(nameObj, 4, "76.4"); ObjectSetFiboDescription(nameObj, 5, "85.4"); ) ) else { ObjectSet(nameObj,OBJPROP_FIRSTLEVEL+4,0.786); ObjectSet(nameObj,OBJPROP_FIRSTLEVEL+5,0.886); if (ExtFiboFanHidden) { ObjectSetFiboDescription(nameObj, 4, "78.6"); ObjectSetFiboDescription(nameObj, 5, "88.6"); ) ) ) ) //-------------------------------------------------------- // Levels Fibo fans. Start. //-------------------------------------------------------- //-------------------------------------------------------- // Conclusion Fibonacci extensions. Start. //-------------------------------------------------------- void FiboExpansion() { if (ExtFiboExpansion>1) { int i; double znach1,znach2,fi_1[]; nameObj="fiboExpansion" + ExtComplekt+"_"; if (mExpansion[2]>0) { if (ExtSave) { nameObj=nameObj + save; ) ) ObjectDelete(nameObj); if (afrl[mExpansion[0]]>0) { ObjectCreate(nameObj,OBJ_EXPANSION,0,afr[mExpansion[0]],afrl[mExpansion[0]],afr[mExpansion[1]],afrh[mExpansion[1]],afr[mExpansion[2]],afrl[mExpansion[2]]); znach1=afrh[mExpansion[1]]-afrl[mExpansion[0]]; znach2=afrl[mExpansion[2]]; ) else { ObjectCreate(nameObj,OBJ_EXPANSION,0,afr[mExpansion[0]],afrh[mExpansion[0]],afr[mExpansion[1]],afrl[mExpansion[1]],afr[mExpansion[2]],afrh[mExpansion[2]]); znach1=-(afrh[mExpansion[0]]-afrl[mExpansion[1]]); znach2=afrh[mExpansion[2]]; ) ObjectSet(nameObj,OBJPROP_COLOR,ExtObjectColor); ObjectSet(nameObj,OBJPROP_STYLE,ExtObjectStyle); ObjectSet(nameObj,OBJPROP_WIDTH,ExtObjectWidth); ObjectSet(nameObj,OBJPROP_LEVELCOLOR,ExtFiboExpansionColor); ObjectSet(nameObj,OBJPROP_LEVELSTYLE,ExtExpansionStyle); ObjectSet(nameObj,OBJPROP_LEVELWIDTH,ExtExpansionWidth); ObjectSet(nameObj,OBJPROP_BACK,ExtBack); if (ExtFiboType==0) { FiboExpansion_st(znach1, znach2); ) else if (ExtFiboType==1) { FiboExpansion_Pesavento(znach1, znach2); ) else if (ExtFiboType==2) { ObjectSet(nameObj,OBJPROP_FIBOLEVELS,Sizefi); for (i=0;i=0; i--) { txt=ObjectName(i); if (StringFind(txt,"_" + ExtComplekt + "pl")>-1) ObjectDelete (txt); if (StringFind(txt,"_" + ExtComplekt + "ph")>-1) ObjectDelete (txt); ) ) //-------------------------------------------------------- // Deleting objects. End. // Remove the connecting lines and numbers. //-------------------------------------------------------- //-------------------------------------------------------- // Deleting objects. Start. // Remove the connecting lines and numbers. //-------------------------------------------------------- void delete_objects2(string txt1) { int i; string txt; for (i=ObjectsTotal(); i>=0; i--) { txt=ObjectName(i); if (StringFind(txt,txt1)>-1)ObjectDelete (txt); ) ) //-------------------------------------------------------- // Deleting objects. End. // Remove the connecting lines and numbers. //-------------------------------------------------------- //-------------------------------------------------------- // Deleting objects. Start. // Removal of triangles and a framework for point D pattern. //-------------------------------------------------------- void delete_objects3() { int i; string txt; for (i=ObjectsTotal(); i>=0; i--) { txt=ObjectName(i); if (StringFind(txt,"_"+ExtComplekt+"Triangle")>-1)ObjectDelete (txt); if (RangeForPointD>0) { txt=ObjectName(i); if (StringFind(txt,"_"+ExtComplekt+"PointD")>-1)ObjectDelete (txt); if (StringFind(txt,"_"+ExtComplekt+"PDL")>-1)ObjectDelete (txt); ) ArrayInitialize(PeakCenaX,0); ArrayInitialize(PeakCenaA,0); ArrayInitialize(PeakCenaB,0); ArrayInitialize(PeakCenaC,0); ArrayInitialize(PeakCenaD,0); ArrayInitialize(PeakTimeX,0); ArrayInitialize(PeakTimeA,0); ArrayInitialize(PeakTimeB,0); ArrayInitialize(PeakTimeC,0); ArrayInitialize(PeakTimeD,0); ) if (RangeForPointD>0) { FlagForD=true; ) ) //-------------------------------------------------------- // Deleting objects. End. // Removal of triangles and a framework for point D pattern. //-------------------------------------------------------- //-------------------------------------------------------- // Deleting objects. Start. // Remove the connecting lines and numbers. //-------------------------------------------------------- void delete_objects4() { int i; string txt; for (i=ObjectsTotal(); i>=0; i--) { txt=ObjectName(i); if (StringFind(txt,"_" + ExtComplekt + "pg")>-1) ObjectDelete (txt); ) ) //-------------------------------------------------------- // Deleting objects. End. // Remove the connecting lines and numbers. //-------------------------------------------------------- //-------------------------------------------------------- // Deleting objects. Start. // ???????? Equilibrium. //-------------------------------------------------------- void delete_objects5() { int i; string txt; for (i=ObjectsTotal(); i>=0; i--) { txt=ObjectName(i); if (StringFind(txt,"_"+ExtComplekt+"Equilibrium")>-1)ObjectDelete (txt); else if (StringFind(txt,"_"+ExtComplekt+"Reaction")>-1)ObjectDelete (txt); ) ) //-------------------------------------------------------- // Deleting objects. End. // ???????? Equilibrium. //-------------------------------------------------------- //-------------------------------------------------------- // Deleting objects. Start. // ???????? ???????. //-------------------------------------------------------- void delete_objects_spiral() { int i; for(i=0;i=0; i--) { txt=ObjectName(i); if (StringFind(txt,"NumberPeak" + "_" + ExtComplekt + "_")>-1) ObjectDelete (txt); ) ) //-------------------------------------------------------- // Deleting objects. End. // Deleting numbers of fractures of the zigzag. //-------------------------------------------------------- //-------------------------------------------------------- // Removing dynamic objects. Start. //-------------------------------------------------------- void delete_objects_dinamic() { int i; ObjectDelete("fiboD" + ExtComplekt+"_"); ObjectDelete("fiboFanD" + ExtComplekt+"_"); ObjectDelete("RLineD" + ExtComplekt+"_"); ObjectDelete("pitchforkD" + ExtComplekt+"_"); ObjectDelete("ISL_D" + ExtComplekt+"_"); ObjectDelete("RZD" + ExtComplekt+"_"); ObjectDelete("pmedianaD" + ExtComplekt+"_"); ObjectDelete("1-2pmedianaD" + ExtComplekt+"_"); ObjectDelete("fiboExpansion" + ExtComplekt+"_"); ObjectDelete("PivotZoneD" + ExtComplekt+"_"); ObjectDelete("FanMedianaDinamic" + ExtComplekt+"_"); ObjectDelete("FiboArcD" + ExtComplekt+"_"); if (ExtPivotZZ1Num==1) ObjectDelete("LinePivotZZ" + "1" + ExtComplekt+"_"); if (ExtPivotZZ2Num==1) ObjectDelete("LinePivotZZ" + "2" + ExtComplekt+"_"); for (i=0; i<7; i++) { nameObj="VLD"+i+" " + ExtComplekt+"_"; ObjectDelete(nameObj); ) ) //-------------------------------------------------------- // Removing dynamic objects. End. //-------------------------------------------------------- //---------------------------------------------------- // ZigZag (from MT4 slightly modified). Start. //---------------------------------------------------- void ZigZag_() { // ZigZag ?? ??. ??????. if (ExtMaxBar>0) _maxbarZZ=ExtMaxBar; else _maxbarZZ=Bars; int shift, back,lasthighpos,lastlowpos; double val,res; double curlow,curhigh,lasthigh,lastlow; int vDepth = 0; // int Depth; bool endCyklDirection=true; if (ExtIndicator==11) { bool endCykl=false; Depth = minDepth; // countGartley = 0; // Counter patterns countColor = 0; if (flagExtGartleyTypeSearch2==false) {delete_objects3(); countGartley = 0; vPatOnOff = 0;} if (ExtGartleyTypeSearch>0 && ExtHiddenPP==2 && flagExtGartleyTypeSearch2==false) delete_objects4(); ) else { Depth = minBars; minDepth = minBars; maxDepth = minBars; ) if (DirectionOfSearchMaxMin) vDepth = maxDepth; else vDepth = minDepth; while (endCyklDirection) { if (ExtIndicator==11) { if (ExtLabel>0) {ArrayInitialize(la,0.0); ArrayInitialize(ha,0.0);} ArrayInitialize(zz,0);ArrayInitialize(zzL,0);ArrayInitialize(zzH,0); if (DirectionOfSearchMaxMin) { if (vDepth < minDepth) { if (ExtGartleyTypeSearch>0 && ExtIndicator==11 && vPatOnOff==1) vDepth=minBarsToNumberPattern; else vDepth=minBars; endCykl=true; ) ) else { if (vDepth > maxDepth) { if (ExtGartleyTypeSearch>0 && ExtIndicator==11 && vPatOnOff==1) vDepth=minBarsToNumberPattern; else vDepth=minBars; endCykl=true; ) ) Depth = vDepth; if (DirectionOfSearchMaxMin) { vDepth--; ) else { vDepth++; ) if (flagExtGartleyTypeSearch2 && ExtGartleyTypeSearch==2 && vPatOnOff==1) {endCykl=true; Depth=minBarsToNumberPattern;} ) else { endCyklDirection=false; ) minBarsX=Depth; // ?????? ??????? ???? for(shift=_maxbarZZ-Depth; shift>=ExtMinBar; shift--) { val=Low[iLowest(NULL,0,MODE_LOW,Depth,shift)]; if(val==lastlow) val=0.0; else { lastlow=val; if((Low[shift]-val)>(ExtDeviation*Point)) val=0.0; else { for(back=1; back<=ExtBackstep; back++) { res=zzL[shift+back]; if((res!=0)&&(res>val)) zzL[shift+back]=0.0; ) ) ) if (Low[shift]==val) { zzL[shift]=val; if (ExtLabel>0) la[shift]=val; ) val=High[iHighest(NULL,0,MODE_HIGH,Depth,shift)]; if(val==lasthigh) val=0.0; else { lasthigh=val; if((val-High[shift])>(ExtDeviation*Point)) val=0.0; else { for(back=1; back<=ExtBackstep; back++) { res=zzH[shift+back]; if((res!=0)&&(res0) ha[shift]=val; ) ) // second major cycle lasthigh=-1; lasthighpos=-1; lastlow=-1; lastlowpos=-1; for(shift=_maxbarZZ-Depth; shift>=ExtMinBar; shift--) { curlow=zzL[shift]; curhigh=zzH[shift]; if((curlow==0)&&(curhigh==0)) continue; if(curhigh!=0) { if(lasthigh>0) { if(lasthigh0) { if(lastlow>curlow) zzL[lastlowpos]=0; else zzL[shift]=0; ) if((curlow=ExtMinBar; shift--) { zz[shift]=zzL[shift]; if(shift>=_maxbarZZ-Depth) {zzH[shift]=0.0; zzL[shift]=0.0; zz[shift]=0.0;} else { res=zzH[shift]; if(res!=0.0) { zz[shift]=res; ) ) ) NoGorb(Depth); // delete the humps of the zigzag if (ExtIndicator!=11 && ExtLabel>0) // puts labels on bars, where there is a new beam and the turn of the zigzag { Metka(); ) // search patterns if (ExtIndicator==11) { if (ExtLabel>0) // puts labels on bars, where there is a new beam and the turn of the zigzag { Metka(); ) if (endCykl) { return(0); ) _Gartley("ExtIndicator=11_" + Depth+"/"+ExtDeviation+"/"+ExtBackstep, Depth); if (ExtGartleyTypeSearch==0 && vPatOnOff==1) { return(0); ) } // search patterns of the end ) ) //-------------------------------------------------------- // ZigZag from MT. End. //-------------------------------------------------------- //-------------------------------------------------------- // Correction emerging humps zigzag. Start. //-------------------------------------------------------- void NoGorb(int Depth) { double vel1, vel2, vel3, vel4; int bar1, bar2, bar3, bar4; int count; for(int bar=Bars-Depth; bar>=0; bar--) { if (zz[bar]!=0) { count++; vel4=vel3;bar4=bar3; vel3=vel2;bar3=bar2; vel2=vel1;bar2=bar1; vel1=zz[bar];bar1=bar; if (count<3) continue; if ((vel3vel2)&&(vel2>vel1)) {zz[bar2]=0;zzL[bar2]=0;zzH[bar2]=0;bar=bar3+1;} if ((vel2==vel1)&&(vel1!=0 )) {zz[bar1]=0;zzL[bar1]=0;zzH[bar1]=0;bar=bar3+1;} ) ) ) //-------------------------------------------------------- // Correction emerging humps zigzag. End. //-------------------------------------------------------- //-------------------------------------------------------- // Placement of labels. Start. //-------------------------------------------------------- void Metka() { int shift, metka=0; // =0 - before the first fracture ZZ. = 1 - looking for tags highs. = 2 - looking for tags minima. for(shift=Bars-1; shift>=0; shift--) { if (zz[shift]>0) { if (zzH[shift]>0) { metka=2; la[shift]=0; shift--; ) else { metka=1; ha[shift]=0; shift--; ) ) if (metka==0) { ha[shift]=0; la[shift]=0; ) else if (metka==1) { if (ha[shift]>0) metka=0; la[shift]=0; ) else if (metka==2) { if (la[shift]>0) metka=0; ha[shift]=0; ) ) ) //-------------------------------------------------------- // Placement of labels. End. //-------------------------------------------------------- //-------------------------------------------------------- // Search patterns Gartley. Start. //-------------------------------------------------------- void _Gartley(string _Depth, int Depth) { int i, j, k, m; double min_DeltaGartley = (1 - ExtDeltaGartley); double max_DeltaGartley = (1 + ExtDeltaGartley); double vl0382 = min_DeltaGartley * 0.382; double vh05 = max_DeltaGartley * 0.5; double vl0618 = min_DeltaGartley * 0.618; double vh0618 = max_DeltaGartley * 0.618; double vl0786 = min_DeltaGartley * 0.786; double vh0786 = max_DeltaGartley * 0.786; double vl0886 = min_DeltaGartley * 0.886; double vh0886 = max_DeltaGartley * 0.886; double vl1128 = min_DeltaGartley * 1.128; double vl1272 = min_DeltaGartley * 1.272; double vl1618 = min_DeltaGartley * phi; double vh1618 = max_DeltaGartley * phi; double vl2236 = min_DeltaGartley * 2.236; double vh2236 = max_DeltaGartley * 2.236; double vh2618 = max_DeltaGartley * 2.618; double vh3618 = max_DeltaGartley * 3.618; double LivelDA1382,LivelDA1618,LivelDA2,LivelDA2618,LivelDA3618,LivelDA4618,LivelDC1382,LivelDC1618,LivelDC2,LivelDC2618,LivelDC3618,LivelDC4618; double LevelForD; datetime timeLineD; double bartoD; int aXABCD[6]; // ?????? ????? ? ??????? XABCD ????????? double retXD; double retXB; double retBD; double retAC; double XA, BC; double vDelta0 = 0.000001; int vNull = 0; int X=1,A=2,B=3,C=4,D=5; string nameObj1, nameObj2; string vBull = "Bullish"; string vBear = "Bearish"; string vGartley = "Gartley"; string vBat = "Bat"; string vButterfly = "Butterfly"; string vCrab = "Crab"; int aNumBarPeak[]; color colorPattern; if (ExtIndicator!=11) delete_objects3(); if ((ExtGartleyTypeSearch==0 && ExtIndicator==11) || ExtIndicator!=11) vPatOnOff = 0; vBullBear = ""; vNamePattern = ""; maxPeak = 0; // for(shift=Bars-1; shift>=0; shift--) for(shift=ExtMaxBar-1; shift>=0; shift--) { if (zz[shift]>0) maxPeak++; ) ArrayResize(aNumBarPeak, maxPeak); shift = 0; j = 0; // while ((shift < Bars) && (j < maxPeak)) while ((shift < ExtMaxBar) && (j < maxPeak)) { if (zz[shift] != 0) { aNumBarPeak[j] = shift; j++; ) shift++; ) if (j5 && ExtIndicator<11 && GrossPeriod>Period()) { bartoD=maxBarToD; ) else { if (patternInfluence) { bartoD=AllowedBandPatternInfluence*(aNumBarPeak[4]-aNumBarPeak[0]); ) else { bartoD=maxBarToD; ) ) k = 0; while ((k < j) && (k + 5 <= maxPeak) && (aNumBarPeak[k] > -1) && (aXABCD[D] < bartoD+2)) { aXABCD[X] = aNumBarPeak[k + 4]; aXABCD[A] = aNumBarPeak[k + 3]; aXABCD[B] = aNumBarPeak[k + 2]; aXABCD[C] = aNumBarPeak[k + 1]; aXABCD[D] = aNumBarPeak[k]; if ((zz[aXABCD[A]] > zz[aXABCD[C]]) && (zz[aXABCD[C]] > zz[aXABCD[B]]) && (zz[aXABCD[B]] > zz[aXABCD[X]]) && (zz[aXABCD[X]] > zz[aXABCD[D]]) && ((zz[aXABCD[C]] - zzL[aXABCD[D]]) >= (zz[aXABCD[A]] - zz[aXABCD[B]]) * ExtCD)) { vBullBear = vBull; ) else if ((zz[aXABCD[A]] > zz[aXABCD[C]]) && (zz[aXABCD[C]] > zz[aXABCD[B]]) && (zz[aXABCD[B]] > zz[aXABCD[D]]) && (zz[aXABCD[D]] > zz[aXABCD[X]]) && ((zz[aXABCD[C]] - zz[aXABCD[D]]) >= (zz[aXABCD[A]] - zz[aXABCD[B]]) * ExtCD)) { vBullBear = vBull; ) else if ((zz[aXABCD[X]] > zz[aXABCD[D]]) && (zz[aXABCD[D]] > zz[aXABCD[B]]) && (zz[aXABCD[B]] > zz[aXABCD[C]]) && (zz[aXABCD[C]] > zz[aXABCD[A]]) && ((zz[aXABCD[D]] - zz[aXABCD[C]]) >= (zz[aXABCD[B]] - zz[aXABCD[A]]) * ExtCD)) { vBullBear = vBear; ) else if ((zz[aXABCD[D]] > zz[aXABCD[X]]) && (zz[aXABCD[X]] > zz[aXABCD[B]]) && (zz[aXABCD[B]] > zz[aXABCD[C]]) && (zz[aXABCD[C]] > zz[aXABCD[A]]) && ((zz[aXABCD[D]] - zz[aXABCD[C]]) >= (zz[aXABCD[B]] - zz[aXABCD[A]]) * ExtCD)) { vBullBear = vBear; ) if (vBullBear!="") { if (vBullBear == vBull) { retXB = (zz[aXABCD[A]] - zz[aXABCD[B]]) / (zz[aXABCD[A]] - zz[aXABCD[X]] + vDelta0); retXD = (zz[aXABCD[A]] - zz[aXABCD[D]]) / (zz[aXABCD[A]] - zz[aXABCD[X]] + vDelta0); retBD = (zz[aXABCD[C]] - zz[aXABCD[D]]) / (zz[aXABCD[C]] - zz[aXABCD[B]] + vDelta0); retAC = (zz[aXABCD[C]] - zz[aXABCD[B]]) / (zz[aXABCD[A]] - zz[aXABCD[B]] + vDelta0); if (RangeForPointD>0 && FlagForD) { XA=zz[aXABCD[A]] - zz[aXABCD[X]]; BC=zz[aXABCD[C]] - zz[aXABCD[B]]; ) ) else if (vBullBear == vBear) { retXB = (zz[aXABCD[B]] - zz[aXABCD[A]]) / (zz[aXABCD[X]] - zz[aXABCD[A]] + vDelta0); retXD = (zz[aXABCD[D]] - zz[aXABCD[A]]) / (zz[aXABCD[X]] - zz[aXABCD[A]] + vDelta0); retBD = (zz[aXABCD[D]] - zz[aXABCD[C]]) / (zz[aXABCD[B]] - zz[aXABCD[C]] + vDelta0); retAC = (zz[aXABCD[B]] - zz[aXABCD[C]]) / (zz[aXABCD[B]] - zz[aXABCD[A]] + vDelta0); if (RangeForPointD>0 && FlagForD) { XA=zz[aXABCD[X]] - zz[aXABCD[A]]; BC=zz[aXABCD[B]] - zz[aXABCD[C]]; ) ) if ((retAC >= vl0382) && (retAC <= vh0886) && (retXD >= vl0618) && (retXD <= vh0786) && (retBD >= vl1128) && (retBD <= vh2236) && (retXB >= vl0382) && (retXB <= vh0618)) { vNamePattern=vGartley; // Gartley if (RangeForPointD>0 && FlagForD) { if (vBullBear == vBull) { LevelForDmin = MathMax(zz[aXABCD[A]]-XA*vh0786,zz[aXABCD[C]]-BC*vh2236); LevelForDmax = MathMin(zz[aXABCD[A]]-XA*vl0618,zz[aXABCD[C]]-BC*vl1128); if (RangeForPointD==2) { LivelDA1382 = zz[aXABCD[A]]-(zz[aXABCD[A]]-zz[aXABCD[B]])*1.382; LivelDA1618 = zz[aXABCD[A]]-(zz[aXABCD[A]]-zz[aXABCD[B]])*phi; LivelDA2 = zz[aXABCD[A]]-(zz[aXABCD[A]]-zz[aXABCD[B]])*2; LivelDA2618 = zz[aXABCD[A]]-(zz[aXABCD[A]]-zz[aXABCD[B]])*(1+phi); LivelDA3618 = zz[aXABCD[A]]-(zz[aXABCD[A]]-zz[aXABCD[B]])*(2+phi); LivelDA4618 = zz[aXABCD[A]]-(zz[aXABCD[A]]-zz[aXABCD[B]])*(3+phi); LivelDC1382 = zz[aXABCD[C]]-(zz[aXABCD[C]]-zz[aXABCD[B]])*1.382; LivelDC1618 = zz[aXABCD[C]]-(zz[aXABCD[C]]-zz[aXABCD[B]])*phi; LivelDC2 = zz[aXABCD[C]]-(zz[aXABCD[C]]-zz[aXABCD[B]])*2; LivelDC2618 = zz[aXABCD[C]]-(zz[aXABCD[C]]-zz[aXABCD[B]])*(1+phi); LivelDC3618 = zz[aXABCD[C]]-(zz[aXABCD[C]]-zz[aXABCD[B]])*(2+phi); LivelDC4618 = zz[aXABCD[C]]-(zz[aXABCD[C]]-zz[aXABCD[B]])*(3+phi); ) ) else if (vBullBear == vBear) { LevelForDmin = MathMax(zz[aXABCD[A]]+XA*vl0618,zz[aXABCD[C]]+BC*vl1128); LevelForDmax = MathMin(zz[aXABCD[A]]+XA*vh0786,zz[aXABCD[C]]+BC*vh2236); if (RangeForPointD==2) { LivelDA1382 = zz[aXABCD[A]]+(zz[aXABCD[B]]-zz[aXABCD[A]])*1.382; LivelDA1618 = zz[aXABCD[A]]+(zz[aXABCD[B]]-zz[aXABCD[A]])*phi; LivelDA2 = zz[aXABCD[A]]+(zz[aXABCD[B]]-zz[aXABCD[A]])*2; LivelDA2618 = zz[aXABCD[A]]+(zz[aXABCD[B]]-zz[aXABCD[A]])*(1+phi); LivelDA3618 = zz[aXABCD[A]]+(zz[aXABCD[B]]-zz[aXABCD[A]])*(2+phi); LivelDA4618 = zz[aXABCD[A]]+(zz[aXABCD[B]]-zz[aXABCD[A]])*(3+phi); LivelDC1382 = zz[aXABCD[C]]+(zz[aXABCD[B]]-zz[aXABCD[C]])*1.382; LivelDC1618 = zz[aXABCD[C]]+(zz[aXABCD[B]]-zz[aXABCD[C]])*phi; LivelDC2 = zz[aXABCD[C]]+(zz[aXABCD[B]]-zz[aXABCD[C]])*2; LivelDC2618 = zz[aXABCD[C]]+(zz[aXABCD[B]]-zz[aXABCD[C]])*(1+phi); LivelDC3618 = zz[aXABCD[C]]+(zz[aXABCD[B]]-zz[aXABCD[C]])*(2+phi); LivelDC4618 = zz[aXABCD[C]]+(zz[aXABCD[B]]-zz[aXABCD[C]])*(3+phi); ) ) ) ) else if ((retAC >= vl0382) && (retAC <= vh0886) && (retXD >= vl1272) && (retXD <= vh1618) && (retBD >= vl1272) && (retBD <= vh2618) && (retXB >= vl0618) && (retXB <= vh0886)) { vNamePattern=vButterfly; // Butterfly if (RangeForPointD>0 && FlagForD) { if (vBullBear == vBull) { LevelForDmin = MathMax(zz[aXABCD[A]]-XA*vh1618,zz[aXABCD[C]]-BC*vh2618); LevelForDmax = MathMin(zz[aXABCD[A]]-XA*vl1272,zz[aXABCD[C]]-BC*vl1272); if (RangeForPointD==2) { LivelDA1382 = zz[aXABCD[A]]-(zz[aXABCD[A]]-zz[aXABCD[B]])*1.382; LivelDA1618 = zz[aXABCD[A]]-(zz[aXABCD[A]]-zz[aXABCD[B]])*phi; LivelDA2 = zz[aXABCD[A]]-(zz[aXABCD[A]]-zz[aXABCD[B]])*2; LivelDA2618 = zz[aXABCD[A]]-(zz[aXABCD[A]]-zz[aXABCD[B]])*(1+phi); LivelDA3618 = zz[aXABCD[A]]-(zz[aXABCD[A]]-zz[aXABCD[B]])*(2+phi); LivelDA4618 = zz[aXABCD[A]]-(zz[aXABCD[A]]-zz[aXABCD[B]])*(3+phi); LivelDC1382 = zz[aXABCD[C]]-(zz[aXABCD[C]]-zz[aXABCD[B]])*1.382; LivelDC1618 = zz[aXABCD[C]]-(zz[aXABCD[C]]-zz[aXABCD[B]])*phi; LivelDC2 = zz[aXABCD[C]]-(zz[aXABCD[C]]-zz[aXABCD[B]])*2; LivelDC2618 = zz[aXABCD[C]]-(zz[aXABCD[C]]-zz[aXABCD[B]])*(1+phi); LivelDC3618 = zz[aXABCD[C]]-(zz[aXABCD[C]]-zz[aXABCD[B]])*(2+phi); LivelDC4618 = zz[aXABCD[C]]-(zz[aXABCD[C]]-zz[aXABCD[B]])*(3+phi); ) ) else if (vBullBear == vBear) { LevelForDmin = MathMax(zz[aXABCD[A]]+XA*vl1272,zz[aXABCD[C]]+BC*vl1272); LevelForDmax = MathMin(zz[aXABCD[A]]+XA*vh1618,zz[aXABCD[C]]+BC*vh2618); if (RangeForPointD==2) { LivelDA1382 = zz[aXABCD[A]]+(zz[aXABCD[B]]-zz[aXABCD[A]])*1.382; LivelDA1618 = zz[aXABCD[A]]+(zz[aXABCD[B]]-zz[aXABCD[A]])*phi; LivelDA2 = zz[aXABCD[A]]+(zz[aXABCD[B]]-zz[aXABCD[A]])*2; LivelDA2618 = zz[aXABCD[A]]+(zz[aXABCD[B]]-zz[aXABCD[A]])*(1+phi); LivelDA3618 = zz[aXABCD[A]]+(zz[aXABCD[B]]-zz[aXABCD[A]])*(2+phi); LivelDA4618 = zz[aXABCD[A]]+(zz[aXABCD[B]]-zz[aXABCD[A]])*(3+phi); LivelDC1382 = zz[aXABCD[C]]+(zz[aXABCD[B]]-zz[aXABCD[C]])*1.382; LivelDC1618 = zz[aXABCD[C]]+(zz[aXABCD[B]]-zz[aXABCD[C]])*phi; LivelDC2 = zz[aXABCD[C]]+(zz[aXABCD[B]]-zz[aXABCD[C]])*2; LivelDC2618 = zz[aXABCD[C]]+(zz[aXABCD[B]]-zz[aXABCD[C]])*(1+phi); LivelDC3618 = zz[aXABCD[C]]+(zz[aXABCD[B]]-zz[aXABCD[C]])*(2+phi); LivelDC4618 = zz[aXABCD[C]]+(zz[aXABCD[B]]-zz[aXABCD[C]])*(3+phi); ) ) ) ) else if ((retAC >= vl0382) && (retAC <= vh0886) && (retXD >= vl1618) && (retXD <= vh1618) && (retBD >= vl2236) && (retBD <= vh3618) && (retXB >= vl0382) && (retXB <= vh0618)) { vNamePattern=vCrab; // Crab if (RangeForPointD>0 && FlagForD) { if (vBullBear == vBull) { LevelForDmin = MathMax(zz[aXABCD[A]]-XA*vh1618,zz[aXABCD[C]]-BC*vh3618); LevelForDmax = MathMin(zz[aXABCD[A]]-XA*vl1618,zz[aXABCD[C]]-BC*vl2236); if (RangeForPointD==2) { LivelDA1382 = zz[aXABCD[A]]-(zz[aXABCD[A]]-zz[aXABCD[B]])*1.382; LivelDA1618 = zz[aXABCD[A]]-(zz[aXABCD[A]]-zz[aXABCD[B]])*phi; LivelDA2 = zz[aXABCD[A]]-(zz[aXABCD[A]]-zz[aXABCD[B]])*2; LivelDA2618 = zz[aXABCD[A]]-(zz[aXABCD[A]]-zz[aXABCD[B]])*(1+phi); LivelDA3618 = zz[aXABCD[A]]-(zz[aXABCD[A]]-zz[aXABCD[B]])*(2+phi); LivelDA4618 = zz[aXABCD[A]]-(zz[aXABCD[A]]-zz[aXABCD[B]])*(3+phi); LivelDC1382 = zz[aXABCD[C]]-(zz[aXABCD[C]]-zz[aXABCD[B]])*1.382; LivelDC1618 = zz[aXABCD[C]]-(zz[aXABCD[C]]-zz[aXABCD[B]])*phi; LivelDC2 = zz[aXABCD[C]]-(zz[aXABCD[C]]-zz[aXABCD[B]])*2; LivelDC2618 = zz[aXABCD[C]]-(zz[aXABCD[C]]-zz[aXABCD[B]])*(1+phi); LivelDC3618 = zz[aXABCD[C]]-(zz[aXABCD[C]]-zz[aXABCD[B]])*(2+phi); LivelDC4618 = zz[aXABCD[C]]-(zz[aXABCD[C]]-zz[aXABCD[B]])*(3+phi); ) ) else if (vBullBear == vBear) { LevelForDmin = MathMax(zz[aXABCD[A]]+XA*vl1618,zz[aXABCD[C]]+BC*vl2236); LevelForDmax = MathMin(zz[aXABCD[A]]+XA*vh1618,zz[aXABCD[C]]+BC*vh3618); if (RangeForPointD==2) { LivelDA1382 = zz[aXABCD[A]]+(zz[aXABCD[B]]-zz[aXABCD[A]])*1.382; LivelDA1618 = zz[aXABCD[A]]+(zz[aXABCD[B]]-zz[aXABCD[A]])*phi; LivelDA2 = zz[aXABCD[A]]+(zz[aXABCD[B]]-zz[aXABCD[A]])*2; LivelDA2618 = zz[aXABCD[A]]+(zz[aXABCD[B]]-zz[aXABCD[A]])*(1+phi); LivelDA3618 = zz[aXABCD[A]]+(zz[aXABCD[B]]-zz[aXABCD[A]])*(2+phi); LivelDA4618 = zz[aXABCD[A]]+(zz[aXABCD[B]]-zz[aXABCD[A]])*(3+phi); LivelDC1382 = zz[aXABCD[C]]+(zz[aXABCD[B]]-zz[aXABCD[C]])*1.382; LivelDC1618 = zz[aXABCD[C]]+(zz[aXABCD[B]]-zz[aXABCD[C]])*phi; LivelDC2 = zz[aXABCD[C]]+(zz[aXABCD[B]]-zz[aXABCD[C]])*2; LivelDC2618 = zz[aXABCD[C]]+(zz[aXABCD[B]]-zz[aXABCD[C]])*(1+phi); LivelDC3618 = zz[aXABCD[C]]+(zz[aXABCD[B]]-zz[aXABCD[C]])*(2+phi); LivelDC4618 = zz[aXABCD[C]]+(zz[aXABCD[B]]-zz[aXABCD[C]])*(3+phi); ) ) ) ) else if ((retAC >= vl0382) && (retAC <= vh0886) && (retXD >= vl0886) && (retXD <= vh0886) && (retBD >= vl1272) && (retBD <= vh2618) && (retXB >= vl0382) && (retXB <= vh0618)) { vNamePattern=vBat; // Bat if (RangeForPointD>0 && FlagForD) { if (vBullBear == vBull) { LevelForDmin = MathMax(zz[aXABCD[A]]-XA*vh0886,zz[aXABCD[C]]-BC*vh2618); LevelForDmax = MathMin(zz[aXABCD[A]]-XA*vl0886,zz[aXABCD[C]]-BC*vl1272); if (RangeForPointD==2) { LivelDA1382 = zz[aXABCD[A]]-(zz[aXABCD[A]]-zz[aXABCD[B]])*1.382; LivelDA1618 = zz[aXABCD[A]]-(zz[aXABCD[A]]-zz[aXABCD[B]])*phi; LivelDA2 = zz[aXABCD[A]]-(zz[aXABCD[A]]-zz[aXABCD[B]])*2; LivelDA2618 = zz[aXABCD[A]]-(zz[aXABCD[A]]-zz[aXABCD[B]])*(1+phi); LivelDA3618 = zz[aXABCD[A]]-(zz[aXABCD[A]]-zz[aXABCD[B]])*(2+phi); LivelDA4618 = zz[aXABCD[A]]-(zz[aXABCD[A]]-zz[aXABCD[B]])*(3+phi); LivelDC1382 = zz[aXABCD[C]]-(zz[aXABCD[C]]-zz[aXABCD[B]])*1.382; LivelDC1618 = zz[aXABCD[C]]-(zz[aXABCD[C]]-zz[aXABCD[B]])*phi; LivelDC2 = zz[aXABCD[C]]-(zz[aXABCD[C]]-zz[aXABCD[B]])*2; LivelDC2618 = zz[aXABCD[C]]-(zz[aXABCD[C]]-zz[aXABCD[B]])*(1+phi); LivelDC3618 = zz[aXABCD[C]]-(zz[aXABCD[C]]-zz[aXABCD[B]])*(2+phi); LivelDC4618 = zz[aXABCD[C]]-(zz[aXABCD[C]]-zz[aXABCD[B]])*(3+phi); ) ) else if (vBullBear == vBear) { LevelForDmin = MathMax(zz[aXABCD[A]]+XA*vl0886,zz[aXABCD[C]]+BC*vl1272); LevelForDmax = MathMin(zz[aXABCD[A]]+XA*vh0886,zz[aXABCD[C]]+BC*vh2618); if (RangeForPointD==2) { LivelDA1382 = zz[aXABCD[A]]+(zz[aXABCD[B]]-zz[aXABCD[A]])*1.382; LivelDA1618 = zz[aXABCD[A]]+(zz[aXABCD[B]]-zz[aXABCD[A]])*phi; LivelDA2 = zz[aXABCD[A]]+(zz[aXABCD[B]]-zz[aXABCD[A]])*2; LivelDA2618 = zz[aXABCD[A]]+(zz[aXABCD[B]]-zz[aXABCD[A]])*(1+phi); LivelDA3618 = zz[aXABCD[A]]+(zz[aXABCD[B]]-zz[aXABCD[A]])*(2+phi); LivelDA4618 = zz[aXABCD[A]]+(zz[aXABCD[B]]-zz[aXABCD[A]])*(3+phi); LivelDC1382 = zz[aXABCD[C]]+(zz[aXABCD[B]]-zz[aXABCD[C]])*1.382; LivelDC1618 = zz[aXABCD[C]]+(zz[aXABCD[B]]-zz[aXABCD[C]])*phi; LivelDC2 = zz[aXABCD[C]]+(zz[aXABCD[B]]-zz[aXABCD[C]])*2; LivelDC2618 = zz[aXABCD[C]]+(zz[aXABCD[B]]-zz[aXABCD[C]])*(1+phi); LivelDC3618 = zz[aXABCD[C]]+(zz[aXABCD[B]]-zz[aXABCD[C]])*(2+phi); LivelDC4618 = zz[aXABCD[C]]+(zz[aXABCD[B]]-zz[aXABCD[C]])*(3+phi); ) ) ) ) ) if ((vNamePattern != "") && (aXABCD[D] < bartoD+2)) { if (ExtGartleyTypeSearch>0 && ExtIndicator==11) { for (m=0;m<=countGartley;m++) { if (PeakCenaX[m]==zz[aXABCD[X]] && PeakCenaA[m]==zz[aXABCD[A]] && PeakCenaB[m]==zz[aXABCD[B]] && PeakCenaC[m]==zz[aXABCD[C]] && PeakCenaD[m]==zz[aXABCD[D]]) { if (PeakTimeX[m]==Time[aXABCD[X]] && PeakTimeA[m]==Time[aXABCD[A]] && PeakTimeB[m]==Time[aXABCD[B]] && PeakTimeC[m]==Time[aXABCD[C]] && PeakTimeD[m]==Time[aXABCD[D]]) {k++; break;} ) ) if (m<=countGartley) { vBullBear = ""; vNamePattern = ""; continue; ) if (ArraySize(PeakCenaX)zz[aXABCD[A]]) { for (i=aXABCD[X]-1;i>=aXABCD[A];i--) { delta=Low[i]-(zz[aXABCD[X]]+(aXABCD[X]-i)*tangens); if (delta=aXABCD[C];i--) { delta=Low[i]-(zz[aXABCD[B]]+(aXABCD[B]-i)*tangens); if (delta=aXABCD[A];i--) { delta=High[i]-(zz[aXABCD[X]]+(aXABCD[X]-i)*tangens); if (delta>h_ea) h_ea=delta; ) for (i=aXABCD[B]-1;i>=aXABCD[C];i--) { delta=High[i]-(zz[aXABCD[B]]+(aXABCD[B]-i)*tangens); if (delta>h_ec) h_ec=delta; ) ) ) nameObj="_"+ExtComplekt+"Equilibrium_" + countGartley; ObjectDelete(nameObj); ObjectCreate(nameObj,OBJ_TREND,0,Time[aXABCD[X]],zz[aXABCD[X]],Time[aXABCD[B]],zz[aXABCD[B]]); ObjectSet(nameObj,OBJPROP_COLOR,ColorEquilibrium); ObjectSet(nameObj,OBJPROP_STYLE,EquilibriumStyle); ObjectSet(nameObj,OBJPROP_WIDTH,EquilibriumWidth); nameObj="_"+ExtComplekt+"Reaction1_" + countGartley; ObjectDelete(nameObj); ObjectCreate(nameObj,OBJ_TREND,0,Time[aXABCD[C]],zz[aXABCD[B]]+tangens*(aXABCD[B]-aXABCD[C])-h_ec,Time[0],zz[aXABCD[B]]+tangens*aXABCD[B]-h_ec); ObjectSet(nameObj,OBJPROP_COLOR,ColorReaction); ObjectSet(nameObj,OBJPROP_STYLE,EquilibriumStyle); ObjectSet(nameObj,OBJPROP_WIDTH,EquilibriumWidth); nameObj="_"+ExtComplekt+"Reaction2_" + countGartley; ObjectDelete(nameObj); ObjectCreate(nameObj,OBJ_TREND,0,Time[aXABCD[C]],zz[aXABCD[B]]+tangens*(aXABCD[B]-aXABCD[C])-h_ea,Time[0],zz[aXABCD[B]]+tangens*aXABCD[B]-h_ea); ObjectSet(nameObj,OBJPROP_COLOR,ColorReaction); ObjectSet(nameObj,OBJPROP_STYLE,EquilibriumStyle); ObjectSet(nameObj,OBJPROP_WIDTH,EquilibriumWidth); // Equilibrium=false; ) nameObj1="_"+ExtComplekt+"Triangle1_" + countGartley + "_" + _Depth + "_" + aXABCD[D] + "_" +vBullBear + " " + vNamePattern; nameObj2="_"+ExtComplekt+"Triangle2_" + countGartley + "_" + _Depth + "_" + aXABCD[D] + "_" +vBullBear + " " + vNamePattern; vPatOnOff = 1; //--------------------------------------------- if(f==1 && ExtIndicator!=11) { f=0; if(ExtPlayAlert) { Alert (Symbol()," ",Period()," a new pattern "); PlaySound("alert.wav"); ) if (ExtSendMail) _SendMail("There was a pattern","on " + Symbol() + " " + Period() + " pattern " + vBullBear + " " + vNamePattern); ) //--------------------------------------------- if (vBullBear == vBull) { ObjectCreate(nameObj1,OBJ_TRIANGLE,0,Time[aXABCD[X]],zz[aXABCD[X]],Time[aXABCD[B]],zz[aXABCD[B]],Time[aXABCD[A]],zz[aXABCD[A]]); ObjectSet(nameObj1,OBJPROP_COLOR,colorPattern); ObjectCreate(nameObj2,OBJ_TRIANGLE,0,Time[aXABCD[B]],zz[aXABCD[B]],Time[aXABCD[D]],zz[aXABCD[D]],Time[aXABCD[C]],zz[aXABCD[C]]); ObjectSet(nameObj2,OBJPROP_COLOR,colorPattern); ) else { ObjectCreate(nameObj1,OBJ_TRIANGLE,0,Time[aXABCD[X]],zz[aXABCD[X]],Time[aXABCD[B]],zz[aXABCD[B]],Time[aXABCD[A]],zz[aXABCD[A]]); ObjectSet(nameObj1,OBJPROP_COLOR,colorPattern); ObjectCreate(nameObj2,OBJ_TRIANGLE,0,Time[aXABCD[B]],zz[aXABCD[B]],Time[aXABCD[D]],zz[aXABCD[D]],Time[aXABCD[C]],zz[aXABCD[C]]); ObjectSet(nameObj2,OBJPROP_COLOR,colorPattern); ) if (RangeForPointD>0) // ????? ?????????????? ??? ???? ????? D { if (FlagForD) { // FlagForD=false; for (j=aXABCD[D];j<=aXABCD[C]-1;j++) { if (vBullBear == vBull) { if (LevelForDmax>=Low[j]) TimeForDmax = Time[j]; ) else if (vBullBear == vBear) { if (LevelForDmin<=High[j]) TimeForDmin = Time[j]; ) ) if (vBullBear == vBull) { TimeForDmin = TimeForDmax+((LevelForDmax-LevelForDmin)/((zz[aXABCD[C]]-zz[aXABCD[D]])/(aXABCD[C]-aXABCD[D]+1)))*Period()*60; ) else if (vBullBear == vBear) { TimeForDmax = TimeForDmin+((LevelForDmax-LevelForDmin)/((zz[aXABCD[D]]-zz[aXABCD[C]])/(aXABCD[C]-aXABCD[D]+1)))*Period()*60; ) /* //?? if ((NumberPattern-1==countGartley-1 && ExtGartleyTypeSearch>0) || ExtGartleyTypeSearch==0) { TimeForDmaxToNumberPattern = TimeForDmax; TimeForDminToNumberPattern = TimeForDmin; ) * / if (TimeForDmin>TimeForDmax) { timeLineD=TimeForDmin; TimeForDmin=TimeForDmax; TimeForDmax=timeLineD; ) else { timeLineD=TimeForDmax; ) if (LevelForDmin>LevelForDmax) { LevelForD=LevelForDmin; LevelForDmin=LevelForDmax; LevelForDmax=LevelForD; ) nameObj="_"+ExtComplekt+"PointD_" + countGartley + ""; ObjectCreate(nameObj,OBJ_RECTANGLE,0,TimeForDmin,LevelForDmin,TimeForDmax,LevelForDmax); ObjectSet(nameObj, OBJPROP_BACK, false); ObjectSet(nameObj, OBJPROP_COLOR, ExtColorRangeForPointD); if (RangeForPointD==2) { if (LevelForDmax>=LivelDA1382 && LivelDA1382>=LevelForDmin) { nameObj="_"+ExtComplekt+"PDLA1382_" + countGartley + ""; ObjectCreate(nameObj,OBJ_TREND,0,Time[aXABCD[C]],LivelDA1382,timeLineD,LivelDA1382); ObjectSet(nameObj, OBJPROP_COLOR, ExtLineForPointD_AB); ObjectSet(nameObj, OBJPROP_RAY, false); ) if (LevelForDmax>=LivelDA1618 && LivelDA1618>=LevelForDmin) { nameObj="_"+ExtComplekt+"PDLA1618_" + countGartley + ""; ObjectCreate(nameObj,OBJ_TREND,0,Time[aXABCD[C]],LivelDA1618,timeLineD,LivelDA1618); ObjectSet(nameObj, OBJPROP_COLOR, ExtLineForPointD_AB); ObjectSet(nameObj, OBJPROP_RAY, false); ) if (LevelForDmax>=LivelDA2 && LivelDA2>=LevelForDmin) { nameObj="_"+ExtComplekt+"PDLA2_" + countGartley + ""; ObjectCreate(nameObj,OBJ_TREND,0,Time[aXABCD[C]],LivelDA2,timeLineD,LivelDA2); ObjectSet(nameObj, OBJPROP_COLOR, ExtLineForPointD_AB); ObjectSet(nameObj, OBJPROP_RAY, false); ) if (LevelForDmax>=LivelDA2618 && LivelDA2618>=LevelForDmin) { nameObj="_"+ExtComplekt+"PDLA2618_" + countGartley + ""; ObjectCreate(nameObj,OBJ_TREND,0,Time[aXABCD[C]],LivelDA2618,timeLineD,LivelDA2618); ObjectSet(nameObj, OBJPROP_COLOR, ExtLineForPointD_AB); ObjectSet(nameObj, OBJPROP_RAY, false); ) if (LevelForDmax>=LivelDA3618 && LivelDA3618>=LevelForDmin) { nameObj="_"+ExtComplekt+"PDLA3618_" + countGartley + ""; ObjectCreate(nameObj,OBJ_TREND,0,Time[aXABCD[C]],LivelDA3618,timeLineD,LivelDA3618); ObjectSet(nameObj, OBJPROP_COLOR, ExtLineForPointD_AB); ObjectSet(nameObj, OBJPROP_RAY, false); ) if (LevelForDmax>=LivelDA4618 && LivelDA4618>=LevelForDmin) { nameObj="_"+ExtComplekt+"PDLA4618_" + countGartley + ""; ObjectCreate(nameObj,OBJ_TREND,0,Time[aXABCD[C]],LivelDA4618,timeLineD,LivelDA4618); ObjectSet(nameObj, OBJPROP_COLOR, ExtLineForPointD_AB); ObjectSet(nameObj, OBJPROP_RAY, false); ) if (LevelForDmax>=LivelDC1382 && LivelDC1382>=LevelForDmin) { nameObj="_"+ExtComplekt+"PDLC1382_" + countGartley + ""; ObjectCreate(nameObj,OBJ_TREND,0,Time[aXABCD[C]],LivelDC1382,timeLineD,LivelDC1382); ObjectSet(nameObj, OBJPROP_COLOR, ExtLineForPointD_BC); ObjectSet(nameObj, OBJPROP_RAY, false); ) if (LevelForDmax>=LivelDC1618 && LivelDC1618>=LevelForDmin) { nameObj="_"+ExtComplekt+"PDLC1618_" + countGartley + ""; ObjectCreate(nameObj,OBJ_TREND,0,Time[aXABCD[C]],LivelDC1618,timeLineD,LivelDC1618); ObjectSet(nameObj, OBJPROP_COLOR, ExtLineForPointD_BC); ObjectSet(nameObj, OBJPROP_RAY, false); ) if (LevelForDmax>=LivelDC2 && LivelDC2>=LevelForDmin) { nameObj="_"+ExtComplekt+"PDLC2_" + countGartley + ""; ObjectCreate(nameObj,OBJ_TREND,0,Time[aXABCD[C]],LivelDC2,timeLineD,LivelDC2); ObjectSet(nameObj, OBJPROP_COLOR, ExtLineForPointD_BC); ObjectSet(nameObj, OBJPROP_RAY, false); ) if (LevelForDmax>=LivelDC2618 && LivelDC2618>=LevelForDmin) { nameObj="_"+ExtComplekt+"PDLC2618_" + countGartley + ""; ObjectCreate(nameObj,OBJ_TREND,0,Time[aXABCD[C]],LivelDC2618,timeLineD,LivelDC2618); ObjectSet(nameObj, OBJPROP_COLOR, ExtLineForPointD_BC); ObjectSet(nameObj, OBJPROP_RAY, false); ) if (LevelForDmax>=LivelDC3618 && LivelDC3618>=LevelForDmin) { nameObj="_"+ExtComplekt+"PDLC3618_" + countGartley + ""; ObjectCreate(nameObj,OBJ_TREND,0,Time[aXABCD[C]],LivelDC3618,timeLineD,LivelDC3618); ObjectSet(nameObj, OBJPROP_COLOR, ExtLineForPointD_BC); ObjectSet(nameObj, OBJPROP_RAY, false); ) if (LevelForDmax>=LivelDC4618 && LivelDC4618>=LevelForDmin) { nameObj="_"+ExtComplekt+"PDLC4618_" + countGartley + ""; ObjectCreate(nameObj,OBJ_TREND,0,Time[aXABCD[C]],LivelDC4618,timeLineD,LivelDC4618); ObjectSet(nameObj, OBJPROP_COLOR, ExtLineForPointD_BC); ObjectSet(nameObj, OBJPROP_RAY, false); ) ) if (ExtGartleyTypeSearch>0 && ExtIndicator==11 && ExtHiddenPP==2) { k1=MathCeil((aXABCD[X]+aXABCD[B])/2); nameObj="_" + ExtComplekt + "pgtxt" + Time[aXABCD[B]] + "_" + Time[aXABCD[X]]; ObjectCreate(nameObj,OBJ_TEXT,0,Time[k1],(zz[aXABCD[B]]+zz[aXABCD[X]])/2); ObjectSetText(nameObj,DoubleToStr(retXB,3),ExtSizeTxt,"Arial", ExtNotFibo); nameObj="_" + ExtComplekt + "pg" + Time[aXABCD[B]] + "_" + Time[aXABCD[X]]; ObjectCreate(nameObj,OBJ_TREND,0,Time[aXABCD[X]],zz[aXABCD[X]],Time[aXABCD[B]],zz[aXABCD[B]]); ObjectSet(nameObj,OBJPROP_RAY,false); ObjectSet(nameObj,OBJPROP_STYLE,STYLE_DOT); ObjectSet(nameObj,OBJPROP_COLOR,ExtLine); ObjectSet(nameObj,OBJPROP_BACK,ExtBack); k1=MathCeil((aXABCD[X]+aXABCD[D])/2); nameObj="_" + ExtComplekt + "pgtxt" + Time[aXABCD[D]] + "_" + Time[aXABCD[X]]; ObjectCreate(nameObj,OBJ_TEXT,0,Time[k1],(zz[aXABCD[D]]+zz[aXABCD[X]])/2); ObjectSetText(nameObj,DoubleToStr(retXD,3),ExtSizeTxt,"Arial", ExtNotFibo); nameObj="_" + ExtComplekt + "pg" + Time[aXABCD[D]] + "_" + Time[aXABCD[X]]; ObjectCreate(nameObj,OBJ_TREND,0,Time[aXABCD[X]],zz[aXABCD[X]],Time[aXABCD[D]],zz[aXABCD[D]]); ObjectSet(nameObj,OBJPROP_RAY,false); ObjectSet(nameObj,OBJPROP_STYLE,STYLE_DOT); ObjectSet(nameObj,OBJPROP_COLOR,ExtLine); ObjectSet(nameObj,OBJPROP_BACK,ExtBack); k1=MathCeil((aXABCD[B]+aXABCD[D])/2); nameObj="_" + ExtComplekt + "pgtxt" + Time[aXABCD[D]] + "_" + Time[aXABCD[B]]; ObjectCreate(nameObj,OBJ_TEXT,0,Time[k1],(zz[aXABCD[D]]+zz[aXABCD[B]])/2); ObjectSetText(nameObj,DoubleToStr(retBD,3),ExtSizeTxt,"Arial", ExtNotFibo); nameObj="_" + ExtComplekt + "pg" + Time[aXABCD[D]] + "_" + Time[aXABCD[B]]; ObjectCreate(nameObj,OBJ_TREND,0,Time[aXABCD[B]],zz[aXABCD[B]],Time[aXABCD[D]],zz[aXABCD[D]]); ObjectSet(nameObj,OBJPROP_RAY,false); ObjectSet(nameObj,OBJPROP_STYLE,STYLE_DOT); ObjectSet(nameObj,OBJPROP_COLOR,ExtLine); ObjectSet(nameObj,OBJPROP_BACK,ExtBack); k1=MathCeil((aXABCD[A]+aXABCD[C])/2); nameObj="_" + ExtComplekt + "pgtxt" + Time[aXABCD[C]] + "_" + Time[aXABCD[A]]; ObjectCreate(nameObj,OBJ_TEXT,0,Time[k1],(zz[aXABCD[C]]+zz[aXABCD[A]])/2); ObjectSetText(nameObj,DoubleToStr(retAC,3),ExtSizeTxt,"Arial", ExtNotFibo); nameObj="_" + ExtComplekt + "pg" + Time[aXABCD[C]] + "_" + Time[aXABCD[A]]; ObjectCreate(nameObj,OBJ_TREND,0,Time[aXABCD[A]],zz[aXABCD[A]],Time[aXABCD[C]],zz[aXABCD[C]]); ObjectSet(nameObj,OBJPROP_RAY,false); ObjectSet(nameObj,OBJPROP_STYLE,STYLE_DOT); ObjectSet(nameObj,OBJPROP_COLOR,ExtLine); ObjectSet(nameObj,OBJPROP_BACK,ExtBack); ) ) ) // vBullBear = ""; // vNamePattern = ""; return(0); ) else { vBullBear = ""; vNamePattern = ""; vBullBearToNumberPattern = ""; vNamePatternToNumberPattern = ""; ) k++; if (patternInfluence) { if (!(ExtIndicator>5 && ExtIndicator<11 && GrossPeriod>Period())) { bartoD=AllowedBandPatternInfluence*(aNumBarPeak[k+4]-aNumBarPeak[k]); ) ) ) ) //-------------------------------------------------------- // Search patterns Gartley. End. //-------------------------------------------------------- //---------------------------------------------------- // ZigZag Alex slightly modified. Start. //---------------------------------------------------- void ang_AZZ_() { int i,n; // cbi=Bars-IndicatorCounted()-1; if (ExtMaxBar>0) cbi=ExtMaxBar; else cbi=Bars-1; //--------------------------------- for (i=cbi; i>=ExtMinBar; i--) { //------------------------------------------------- // remember the importance of trend direction fs and the average price of si on the previous bar if (tisi+di && Low[i]si-Low[i]) si=High[i]-di; // The deviation from the average price Haya more deflection gear // else if (High[i]-si=si+di) si=High[i]-di; // else if (Low[i]si+di) si=High[i]-di; // ) ) // Calculation of the initial value of the average price if (i>cbi-1) {si=(High[i]+Low[i])/2;} // Determine the trend for the current bar if (si>sip) fs=1; // Upward trend if (si0) { ha[i]=High[i]; la[bi]=Low[bi]; la[i]=0; tmh=Time[i]; ha[i]=High[i]; la[i]=0; // stamped marks on the upward beam ) ) if (fs==2 && fsp==1) // Trend changed from upward to downward { lm=Low[i]; ai=iBarShift(Symbol(),Period(),tai); zz[ai]=High[ai]; zzH[ai]=High[ai]; tbi=Time[i]; si=Low[i]+di; fsp=fs; sip=si; if (ExtLabel>0) { ha[ai]=High[ai]; ha[i]=0; la[i]=Low[i]; tml=Time[i]; ha[i]=0; la[i]=Low[i]; // stamped marks on the downlink beam ) ) // Continued trenda. Trending. if (fs==1 && High[i]>hm) {hm=High[i]; tai=Time[i]; si=High[i]-di;} if (fs==2 && Low[i]=0; n--) {zzH[n]=0; zz[n]=0; if (ExtLabel>0) ha[n]=0;} zz[ai0]=High[ai0]; zzH[ai0]=High[ai0]; zzL[ai0]=0; if (ExtLabel>0) ha[ai0]=High[ai0]; ) if (fs==2) { for (n=ai0-1; n>=0; n--) {zzL[n]=0; zz[n]=0; if (ExtLabel>0) la[n]=0;} zz[bi0]=Low[bi0]; zzL[bi0]=Low[bi0]; zzH[bi0]=0; if (ExtLabel>0) la[bi0]=Low[bi0]; ) if (ExtLabel>0) { if (fs==1) {aim=iBarShift(Symbol(),0,tmh); if (aim0) cbi=ExtMaxBar; else cbi=Bars-1; //--------------------------------- for (i=cbi; i>=ExtMinBar; i--) { //------------------------------------------------- // Set the initial values of minimum and maximum bar if (lLast==0) {lLast=Low[i];hLast=High[i]; if (ExtIndicator==3) di=hLast-lLast;} // Determine the direction of the trend to the first point of the change in trend. // Or to the point of beginning of the first ray of the left edge. if (fs==0) { if (lLastLow[i] && hLast>High[i]) {fs=2; lLast=Low[i]; si=Low[i]; bi=i; tbi=Time[i]; if (ExtIndicator==3) di=High[i]-Low[i];} // downward trend ) if (ti0) {countBar--; if (i==0 && countBar==0) fcount0=true;} // Stop. Determining the future direction of the trend. if (fs==1) { if (hLast>High[i] && !fh) fh=true; if (i==0) { if (Close[i+1]Low[i+1] && High[i+1]i+1 && fh && !fcount0) {fs=2; countBar=minBars; fh=false;} if (fs==2) // Trend changed from upward to downward at the previous bar { zz[ai0]=High[ai0]; zzH[ai0]=High[ai0]; lLast=Low[i+1]; if (ExtIndicator==3) di=High[i+1]-Low[i+1]; si=Low[i+1]; bi=i+1; tbi=Time[i+1]; if (ExtLabel>0) { ha[ai0]=High[ai0]; tml=Time[i+1]; ha[i+1]=0; la[i+1]=Low[i+1]; // stamped marks on the downlink beam ) else if (chHL && chHL_PeakDet_or_vts) {ha[i+1]=si+di; la[i+1]=si;} ) ) else { if (Close[i]Low[i] && High[i]0) { ha[ai]=High[ai]; tml=Time[i]; ha[i]=0; la[i]=Low[i]; // stamped marks on the downlink beam ) else if (chHL && chHL_PeakDet_or_vts) {ha[i]=si+di; la[i]=si;} ) ) ) else // fs==2 { if (lLasthLast && fl) {fs=1; countBar=minBars; fl=false;} if (countBar==0 && si+dilLast && bi0>i+1 && fl && !fcount0) {fs=1; countBar=minBars; fl=false;} if (fs==1) // Trend changed from downward to upward in the previous bar { zz[bi0]=Low[bi0]; zzL[bi0]=Low[bi0]; hLast=High[i+1]; if (ExtIndicator==3) di=High[i+1]-Low[i+1]; si=High[i+1]; ai=i+1; tai=Time[i+1]; if (ExtLabel>0) { la[bi0]=Low[bi0]; tmh=Time[i+1]; ha[i+1]=High[i+1]; la[i+1]=0; // stamped marks on the upward beam ) else if (chHL && chHL_PeakDet_or_vts) {ha[i+1]=si; la[i+1]=si-di;} ) ) else { if (Close[i]>hLast && fl) {fs=1; countBar=minBars; fl=false;} if (countBar==0 && si+dilLast && fl) {fs=1; countBar=minBars; fl=false;} if (fs==1) // Tredn changed from downward to upward { zz[bi]=Low[bi]; zzL[bi]=Low[bi]; hLast=High[i]; if (ExtIndicator==3) di=High[i]-Low[i]; si=High[i]; ai=i; tai=Time[i]; if (ExtLabel>0) { la[bi]=Low[bi]; tmh=Time[i]; ha[i]=High[i]; la[i]=0; // stamped marks on the upward beam ) else if (chHL && chHL_PeakDet_or_vts==1) {ha[i]=si; la[i]=si-di;} ) ) ) ) // Continuing trend if (fs==1 && High[i]>si) {ai=i; tai=Time[i]; hLast=High[i]; si=High[i]; countBar=minBars; fh=false; if (ExtIndicator==3) di=High[i]-Low[i];} if (fs==2 && Low[i]=0; n--) {zzH[n]=0; zz[n]=0; if (ExtLabel>0) ha[n]=0;} zz[ai0]=High[ai0]; zzH[ai0]=High[ai0]; zzL[ai0]=0; if (ExtLabel>0) ha[ai0]=High[ai0]; ) if (fs==2) { for (n=ai0-1; n>=0; n--) {zzL[n]=0; zz[n]=0; if (ExtLabel>0) la[n]=0;} zz[bi0]=Low[bi0]; zzL[bi0]=Low[bi0]; zzH[bi0]=0; if (ExtLabel>0) la[bi0]=Low[bi0]; ) if (ExtLabel>0) { if (fs==1) {aim=iBarShift(Symbol(),0,tmh); if (aim0) { ArrayInitialize(la,0.0); ArrayInitialize(ha,0.0); ) GetHigh(0,Bars,0.0,0); // final cutting lasthigh=-1; lasthighpos=-1; lastlow=-1; lastlowpos=-1; for(shift=Bars; shift>=0; shift--) { curlow=zzL[shift]; curhigh=zzH[shift]; if((curlow==0)&&(curhigh==0)) continue; //--- if(curhigh!=0) { if(lasthigh>0) { if(lasthigh0) { if(lastlow>curlow) zzL[lastlowpos]=0; else zzL[shift]=0; ) //--- if((curlow=0; shift--) { zz[shift]=zzL[shift]; res=zzH[shift]; if(res!=0.0) zz[shift]=res; ) if (ExtLabel>0) // ??????????? ????? { for(shift=Bars-1; shift>=0; shift--) { if (zz[shift]>0) { if (zzH[shift]>0) { peak=High[shift]; wrpeak=Low[shift]; ha[shift]=High[shift]; la[shift]=0; metka=2; shift--; ) else { peak=Low[shift]; wrpeak=High[shift]; la[shift]=Low[shift]; ha[shift]=0; metka=1; shift--; ) ) if (metka==1) { if (wrpeakminSize*Point) {metka=0; ha[shift]=High[shift];} ) else { wrpeak=High[shift]; ) ) else if (metka==2) { if (wrpeak>Low[shift]) { if (peak-Low[shift]>minSize*Point) {metka=0; la[shift]=Low[shift];} ) else { wrpeak=Low[shift]; ) ) ) ) ) void GetHigh(int start, int end, double price, int step) { int count=end-start; if (count<=0) return; int i=iHighest(NULL,0,MODE_HIGH,count+1,start); double val=High[i]; if ((val-price)>(minSize*Point)) { zzH[i]=val; if (i==start) {GetLow(start+step,end-step,val,1-step); if (zzL[start-1]>0) zzL[start]=0; return;} if (i==end) {GetLow(start+step,end-step,val,1-step); if (zzL[end+1]>0) zzL[end]=0; return;} GetLow(start,i-1,val,0); GetLow(i+1,end,val,0); ) ) void GetLow(int start, int end, double price, int step) { int count=end-start; if (count<=0) return; int i=iLowest(NULL,0,MODE_LOW,count+1,start); double val=Low[i]; if ((price-val)>(minSize*Point)) { zzL[i]=val; if (i==start) {GetHigh(start+step,end-step,val,1-step); if (zzH[start-1]>0) zzH[start]=0; return;} if (i==end) {GetHigh(start+step,end-step,val,1-step); if (zzH[end+1]>0) zzH[end]=0; return;} GetHigh(start,i-1,val,0); GetHigh(i+1,end,val,0); ) ) //-------------------------------------------------------- // ZigZag tauber. End. //-------------------------------------------------------- //---------------------------------------------------- // Swing Gann. Start. //---------------------------------------------------- void GannSwing() { int i,n; // Variables swings Gunn double lLast_m=0, hLast_m=0; int countBarExt=0; // counter external bars int countBarl=0,countBarh=0; fs=0; ti=0; // lLast, hLast - minimum and maximum active bar // lLast_m, hLast_m - minimum and maximum "intermediate" bars ArrayInitialize(zz,0.0); ArrayInitialize(zzL,0.0); ArrayInitialize(zzH,0.0); if (ExtLabel>0) { ArrayInitialize(la,0.0); ArrayInitialize(ha,0.0); ) // cbi=Bars-IndicatorCounted()-1; //--------------------------------- // cbi=Bars-1; if (ExtMaxBar>0) cbi=ExtMaxBar; else cbi=Bars-1; for (i=cbi; i>=ExtMinBar; i--) { //------------------------------------------------- // Set the initial values of minimum and maximum bar if (lLast==0) {lLast=Low[i]; hLast=High[i]; ai=i; bi=i;} if (ti!=Time[i]) { ti=Time[i]; if (lLast_m==0 && hLast_m==0) { if (lLast>Low[i] && hLastLow[i] && hLast>=High[i]) // Trend in the current bar downward { lLast_m=Low[i];hLast_m=0;countBarh=0;countBarExt=0; if (fs!=2) countBarl++; else {lLast=Low[i]; hLast=High[i]; lLast_m=0; hLast_m=0; bi=i; tbi=Time[i];} ) ) else if (lLast_m>0 && hLast_m>0) // Outside bar (previous) { if (lLast_m>Low[i] && hLast_mLow[i] && hLast_m>=High[i]) // Trend in the current bar downward { lLast_m=Low[i];hLast_m=0;countBarh=0;countBarExt=0; if (fs!=2) countBarl++; else {lLast=Low[i]; hLast=High[i]; lLast_m=0; hLast_m=0; bi=i; tbi=Time[i];} ) ) else if (lLast_m>0) { if (lLast_m>Low[i] && hLastLow[i] && hLast>=High[i]) // Trend in the current bar downward { lLast_m=Low[i];hLast_m=0;countBarh=0;countBarExt=0; if (fs!=2) countBarl++; else {lLast=Low[i]; hLast=High[i]; lLast_m=0; hLast_m=0; bi=i; tbi=Time[i];} ) ) else if (hLast_m>0) { if (lLast>Low[i] && hLast_mLow[i] && hLast_m>=High[i]) // Trend in the current bar downward { lLast_m=Low[i];hLast_m=0;countBarh=0;countBarExt=0; if (fs!=2) countBarl++; else {lLast=Low[i]; hLast=High[i]; lLast_m=0; hLast_m=0; bi=i; tbi=Time[i];} ) ) // Determine the direction of the trend. if (fs==0) { if (lLasthLast_m) // inner bar { lLast=Low[i]; hLast=High[i]; ai=i; bi=i; countBarl=0;countBarh=0;countBarExt=0; ) if (countBarh>countBarl && countBarh>countBarExt && countBarh>minBars) { lLast=Low[i]; hLast=High[i]; lLast_m=0; hLast_m=0; fs=1;countBarh=0;countBarl=0;countBarExt=0; zz[bi]=Low[bi]; zzL[bi]=Low[bi]; zzH[bi]=0; ai=i; tai=Time[i]; ) else if (countBarl>countBarh && countBarl>countBarExt && countBarl>minBars) { lLast=Low[i]; hLast=High[i]; lLast_m=0; hLast_m=0; fs=2;countBarl=0;countBarh=0;countBarExt=0; zz[ai]=High[ai]; zzH[ai]=High[ai]; zzL[ai]=0; bi=i; tbi=Time[i]; ) ) else { if (lLast_m==0 && hLast_m==0) { countBarl=0;countBarh=0;countBarExt=0; ) // ????????? ?????????? if (fs==1) { if (countBarl>countBarh && countBarl>countBarExt && countBarl>minBars) // Determines the point of changing trends. { // remember the importance of trend direction fs on the previous bar ai=iBarShift(Symbol(),Period(),tai); fs=2; countBarl=0; zz[ai]=High[ai]; zzH[ai]=High[ai]; zzL[ai]=0; bi=i; if (ExtLabel>0) { ha[ai]=High[ai]; la[ai]=0; // tagging to maximum tml=Time[i]; ha[i]=0; la[i]=Low[i]; // stamped marks on the downlink beam ) tbi=Time[i]; lLast=Low[i]; hLast=High[i]; lLast_m=0; hLast_m=0; for (n=0;countBarExtHigh[i+n+1]) {countBarExt++; countBarh++; lLast=Low[i+n+1]; hLast=High[i+n+1]; hLast_m=High[i];} else break; ) lLast=Low[i]; hLast=High[i]; ) ) // Trend downward if (fs==2) { if (countBarh>countBarl && countBarh>countBarExt && countBarh>minBars) // Determines the point of changing trends. { // remember the importance of trend direction fs on the previous bar bi=iBarShift(Symbol(),Period(),tbi); fs=1; countBarh=0; zz[bi]=Low[bi]; zzL[bi]=Low[bi]; zzH[bi]=0; ai=i; if (ExtLabel>0) { ha[bi]=0; la[bi]=Low[bi]; // tagging at the minima tmh=Time[i]; ha[i]=High[i]; la[i]=0; // stamped marks on the upward beam ) tai=Time[i]; lLast=Low[i]; hLast=High[i]; lLast_m=0; hLast_m=0; for (n=0;countBarExtHigh[i+n+1]) {countBarExt++; countBarl++; lLast=Low[i+n+1]; hLast=High[i+n+1]; lLast_m=Low[i];} else break; ) lLast=Low[i]; hLast=High[i]; ) ) ) ) if (i==0) { if (hLast0) {ha[ai]=High[ai]; la[ai]=0;} // parade Tag ) else if (lLast>Low[i] && fs==2) // Trend in the current bar downward { bi=i; tbi=Time[i]; zz[bi]=Low[bi]; zzL[bi]=Low[bi]; zzH[bi]=0; if (ExtLabel>0) {la[bi]=Low[bi]; ha[bi]=0;} // parade Tag ) //=================================================================================================== // Zero bar. Calculation of the first ray ZigZag-a ai0=iBarShift(Symbol(),Period(),tai); bi0=iBarShift(Symbol(),Period(),tbi); if (bi0>1) if (fs==1) { for (n=bi0-1; n>=0; n--) {zzH[n]=0.0; zz[n]=0.0; if (ExtLabel>0) ha[n]=0;} zz[ai0]=High[ai0]; zzH[ai0]=High[ai0]; zzL[ai0]=0.0; if (ExtLabel>0) ha[ai0]=High[ai0]; ) if (ai0>1) if (fs==2) { for (n=ai0-1; n>=0; n--) {zzL[n]=0.0; zz[n]=0.0; if (ExtLabel>0) la[n]=0;} zz[bi0]=Low[bi0]; zzL[bi0]=Low[bi0]; zzH[bi0]=0.0; if (ExtLabel>0) la[bi0]=Low[bi0]; ) if (ExtLabel>0) { if (fs==1) {aim=iBarShift(Symbol(),0,tmh); if (aim0) { // datetime nen_time=iTime(NULL,GrossPeriod,ExtMinBar); datetime nen_time=iTime(NULL,GrossPeriod,0); int i=0, j=0; // j - number of bar with a maximum peak (minimum minimum) the strip nen-ZigZag double nen_dt=0, last_j=0, last_nen=0; //last_j - the maximum value of the maximum (minimum wage) in the strip nen_ZigZag int limit, big_limit, bigshift=0; int i_metka=-1, i_metka_m=-1, k, m, jm; bool fl_metka=false; double last_jm=0, last_nen_m=0; // if (ExtLabel>0) metka=1; else metka=0; if (ExtMaxBar>0) _maxbarZZ=ExtMaxBar; else _maxbarZZ=Bars; if (init_zz) { limit=_maxbarZZ-1; big_limit=iBars(NULL,GrossPeriod)-1; ) else { limit=iBarShift(NULL,0,afr[2]); big_limit=iBarShift(NULL,GrossPeriod,afr[2]); ) while (bigshift=nen_time) { if (ExtIndicator==6) { if (ExtLabel>0) { ha[i]=iCustom(NULL,GrossPeriod,"ZigZag_new_nen4",minBars,ExtDeviation,ExtBackstep,1,1,bigshift); la[i]=iCustom(NULL,GrossPeriod,"ZigZag_new_nen4",minBars,ExtDeviation,ExtBackstep,1,2,bigshift); ) nen_ZigZag[i]=iCustom(NULL,GrossPeriod,"ZigZag_new_nen4",minBars,ExtDeviation,ExtBackstep,0,0,bigshift); ) else if (ExtIndicator==7) { if (ExtLabel>0) { ha[i]=iCustom(NULL,GrossPeriod,"DT_ZZ_nen",minBars,1,1,bigshift); la[i]=iCustom(NULL,GrossPeriod,"DT_ZZ_nen",minBars,1,2,bigshift); ) nen_ZigZag[i]=iCustom(NULL,GrossPeriod,"DT_ZZ_nen",minBars,0,0,bigshift); ) else if (ExtIndicator==8) nen_ZigZag[i]=iCustom(NULL,GrossPeriod,"CZigZag",minBars,ExtDeviation,0,bigshift); else if (ExtIndicator==10) { if (ExtLabel>0) { ha[i]=iCustom(NULL,GrossPeriod,"Swing_ZZ_1",minBars,1,1,bigshift); la[i]=iCustom(NULL,GrossPeriod,"Swing_ZZ_1",minBars,1,2,bigshift); ) nen_ZigZag[i]=iCustom(NULL,GrossPeriod,"Swing_ZZ_1",minBars,1,0,bigshift); ) i++; ) else {bigshift++;nen_time=iTime(NULL,GrossPeriod,bigshift);} ) if (init_zz) // Processing history { double i1=0, i2=0; init_zz=false; for (i=limit;i>ExtMinBar;i--) // determine the direction of the first beam { if (nen_ZigZag[i]>0) { if (i1==0) i1=nen_ZigZag[i]; else if (i1>0 && i1!=nen_ZigZag[i]) i2=nen_ZigZag[i]; if (i2>0) { if (i1>i2) hi_nen=true; else hi_nen=false; break; ) ) ) ) else // real-time { if (afrl[2]>0) hi_nen=false; else hi_nen=true; ) for (i=limit;i>=0;i--) { // if (i0) { if (ExtLabel==2) { if (i_metka_m>=0 && !fl_metka) { m=i_metka_m-GrossPeriod/Period(); for (k=i_metka_m; k>m; k--) { ha[k]=0; la[k]=0; ) if (hi_nen) ha[jm]=last_nen_m; else la[jm]=last_nen_m; jm=0; last_nen_m=0; last_jm=0; i_metka_m=-1; ) if (i_metka<0) i_metka=i; ) fl_metka=true; if (nen_dt>0 && nen_dt!=nen_ZigZag[i]) { if (i_metka>=0 && fl_metka) { m=i_metka-GrossPeriod/Period(); for (k=i_metka; k>m; k--) { ha[k]=0; la[k]=0; ) if (hi_nen) ha[j]=last_nen; else la[j]=last_nen; i_metka=i; ) if (hi_nen) {hi_nen=false;zzH[j]=last_nen;} else {hi_nen=true;zzL[j]=last_nen;} last_j=0;nen_dt=0;zz[j]=last_nen; ) if (hi_nen) { nen_dt=nen_ZigZag[i]; if (last_jLow[i]) {j=i;last_j=Low[i];last_nen=nen_ZigZag[i];} ) if (nen_dt>0 && i==0) // definition of a fracture at zero bar GrossPeriod { if (i_metka>=0 && fl_metka) { m=i_metka-GrossPeriod/Period(); for (k=i_metka; k>m; k--) { ha[k]=0; la[k]=0; ) if (hi_nen) ha[j]=last_nen; else la[j]=last_nen; fl_metka=false; ) zz[j]=last_nen; if (hi_nen) zzH[j]=last_nen; else zzL[j]=last_nen; ) ) else { if (last_j>0 && fl_metka) { if (i_metka>=0 && fl_metka) { m=i_metka-GrossPeriod/Period(); for (k=i_metka; k>m; k--) { ha[k]=0; la[k]=0; ) if (hi_nen) ha[j]=last_nen; else la[j]=last_nen; ) fl_metka=false; if (hi_nen) {hi_nen=false;zzH[j]=last_nen;} else {hi_nen=true;zzL[j]=last_nen;} last_j=0;nen_dt=0;zz[j]=last_nen; i_metka=-1; ) if (ExtLabel==2) { if ((ha[i]>0 || la[i]>0) && !fl_metka) { if (i_metka_m<0) { i_metka_m=i; jm=i; if (hi_nen) { last_jm=High[i];last_nen_m=ha[i]; ) else { last_jm=Low[i];last_nen_m=la[i]; ) ) if (hi_nen) { if (last_nen_m>last_jm) {jm=i;last_jm=High[i];} ) else { if (last_nen_mzzbarhigh) {curbar=zzbarhigh; curpr=High[zzbarhigh];} if(zzbarlow==zzbarhigh){curbar=zzbarlow;curpr=funk1(zzbarlow, n);} ArrayResize(Mbar,ExtPoint); ArrayResize(Mprice,ExtPoint); j=0; endpr=curpr; endbar=curbar; Mbar[j]=curbar; Mprice[j]=curpr; EP--; if(curpr==Low[curbar]) flag=true; else flag=false; fl=flag; i=curbar+1; while(EP>0) { if(flag) { while(i<=Bars-1) { curbar1=iHighest(NULL,0,MODE_HIGH,n,i); curbar2=iHighest(NULL,0,MODE_HIGH,n,curbar1); if(curbar1==curbar2){curbar=curbar1;curpr=High[curbar];flag=false;i=curbar+1;j++;break;} else i=curbar2; ) Mbar[j]=curbar; Mprice[j]=curpr; EP--; ) if(EP==0) break; if(!flag) { while(i<=Bars-1) { curbar1=iLowest(NULL,0,MODE_LOW,n,i); curbar2=iLowest(NULL,0,MODE_LOW,n,curbar1); if(curbar1==curbar2){curbar=curbar1;curpr=Low[curbar];flag=true;i=curbar+1;j++;break;} else i=curbar2; ) Mbar[j]=curbar; Mprice[j]=curpr; EP--; ) ) /* fix vertices */ if(Mprice[0]==Low[Mbar[0]])fd=true; else fd=false; for(k=0;k<=ExtPoint-1;k++) { if(k==0) { if(fd==true) { Mbar[k]=iLowest(NULL,0,MODE_LOW,Mbar[k+1]-Mbar[k],Mbar[k]);Mprice[k]=Low[Mbar[k]];endbar=minBars; ) if(fd==false) { Mbar[k]=iHighest(NULL,0,MODE_HIGH,Mbar[k+1]-Mbar[k],Mbar[k]);Mprice[k]=High[Mbar[k]];endbar=minBars; ) ) if(k=0 && a=a; i--) {zzH[i]=zzH[i-a]; zzL[i]=zzL[i-a];} for(;i>=0;i--) {zzH[i]=0; zzL[i]=0;} } } else { ii=barz; H1=ii+1; L1=ii; H2=ii+3; L2=ii+2; L2p=Low[L2];H2p=High[H2]; L1p=Low[L1];H1p=High[H1]; H3=H2; H3p=H2p; L3=L2; L3p=L2p; ) act_time=Time[1]; for(c=0; ii>=0; c++, ii--) { // if(c>tb) if(zzFill) zz[ii+mnm]=MathMax(zzL[ii+mnm],zzH[ii+mnm]); // if(c>tb) if(zzFill) zz[ii]=MathMax(zzL[ii],zzH[ii]); H=ii; L=ii; Hp= High[H]; Lp= Low[L]; //------------------------------------------------------------------------------------- if(H2=H1p ) { H1=H; H1p=Hp; if( H1p>H2p ) { zzH[H2]=0; H1=H; H1p=Hp; H2=H1; H2p=H1p; L1=H1; L1p=H1p; zzH[H2]=H2p; } } else if( Lp<=L1p ) { L1=L; L1p=Lp; x=ray_value(L2,L2p,H2+(L2-H3)*0.5,H2p+(L2p-H3p)*0.5,L1); if( L1p<=L2p//????? ???????? L1p<=L2p*0.75+H2p*0.25 or any other conditions || tb*tb*Point<(H2p-L1p)*(H2-L1)) { //???????? ??? Low L4=L3; L4p=L3p; L3=L2; L3p=L2p; L2=L1; L2p=L1p; H1=L1; H1p=L1p; zzL[L2]=L2p; } } } //-------------------------------------------------------------- if(L2=H1p ) { H1=H; H1p=Hp; x=ray_value(H2,H2p,L2+0.5*(H2-L3),L2p+0.5*(H2p-L3p),H1); if( H1p>=H2p//????? ? ???: H1p>=H2p*0.75+L2p*0.25 || tb*tb*Point<(H1p-L2p)*(L2-H1)) { //???????? ??? High H4=H3; H4p=H3p; H3=H2; H3p=H2p; H2=H1; H2p=H1p; L1=H1; L1p=H1p; zzH[H2]=H2p; } } }//-------------------------------------------------------------------------------- }//for for(ii=bb-1; ii>=0; ii--) zz[ii]=MathMax(zzL[ii],zzH[ii]); }//°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°° // SQZZ by tovaroved.lv. ?????. //--------------------------------------------------------======================================================================= //-------------------------------------------------------- // ZZ_2L_nen . ??????. //#property copyright "Copyright © 2007, wellx. ver 0.07 alpha" //#property link "aveliks@gmail.com" //-------------------------------------------------------- void ZZ_2L_nen() { int count = IndicatorCounted(); int k, i,shift,cnt, pos,curhighpos,curlowpos; if (Bars-count-1>2) { count=0; NewBarTime=0; countbars=0; realcnt=0; ArrayInitialize(zz,0); ArrayInitialize(zzL,0); ArrayInitialize(zzH,0); ) for (k=(Bars-count-1);k>=0;k--) { // Print("Prev-Bars :",Bars); if(( NewBarTime==Time[0]) || (realcnt==Bars)) first=false; else first=true; //-------------------------------------------------------------------- //Find the first point of the indicator //-------------------------------------------------------------------- if (first) { lastlowpos=Bars-1; lasthighpos=Bars-1; zzL[Bars-1]=0.0; zzH[Bars-1]=0.0; zz[Bars-1]=0.0; realcnt=2; for(shift=(Bars-2); shift>=0; shift--) { if ((High[shift]>High[shift+1]) && (Low[shift]>=Low[shift+1])) { zzL[shift]=0.0; zzH[shift]=High[shift]; zz[shift]=High[shift]; lasthighpos=shift; lasthigh=High[shift]; lastlow=Low[Bars-1]; pos=shift; first=false; //Print("First ", Bars ," ",shift," ",zz[shift]," ",zzH[shift]," ",zzL[shift]); break; ) if ((High[shift]<=High[shift+1]) && (Low[shift]High[shift+1]) && (Low[shift](Low[shift+1]-Low[shift])) { zzL[shift]=0.0; zzH[shift]=High[shift]; zz[shift]=High[shift]; zzL[shift]=0.0; lasthighpos=shift; lasthigh=High[shift]; lastlow=Low[Bars-1]; pos=shift; first=false; //Print("First ", Bars ," ",shift," ",zz[shift]," ",zzH[shift]," ",zzL[shift]); break; ) if ((High[shift]-High[shift+1])<(Low[shift+1]-Low[shift])) { zzL[shift]=Low[shift]; zzH[shift]=0.0; zz[shift]=Low[shift]; lasthighpos=shift; lasthigh=High[shift]; lastlow=Low[Bars-1]; pos=shift; first=false; //Print("First ", Bars ," ",shift," ",zz[shift]," ",zzH[shift]," ",zzL[shift]); break; ) if ((High[shift]-High[shift+1])==(Low[shift+1]-Low[shift])) { zzL[shift]=0.0; zzH[shift]=0.0; zz[shift]=0.0; ) ) if ((High[shift]Low[shift+1])) { zzL[shift]=0.0; zzH[shift]=0.0; zz[shift]=0.0; ) pos=shift; realcnt=realcnt+1; ) // Print("Start-Bars :",Bars," Realcnt ", realcnt, " Point " , Point); //------------------------------------------------------------------------- // here begins working off the main loop ?? //------------------------------------------------------------------------- for(shift=pos-1; shift>=0; shift--) { if ((High[shift]>High[shift+1]) && (Low[shift]>=Low[shift+1])) { if (lasthighposHigh[lasthighpos]) { zzL[shift]=0.0; zzH[shift]=High[shift]; zz[shift]=High[shift]; zz[lasthighpos]=0.0; if (shift!=0) lasthighpos=shift; lasthigh=High[shift]; if (lastlowpos!=Bars) { // ???? ?????????? ??????? ????? ????? ) ) ) if (lasthighpos>lastlowpos) { if ((((High[shift]-Low[lastlowpos])>(StLevel*Point)) && ((lastlowpos-shift)>=minBars)) || ((High[shift]-Low[lastlowpos])>=(BigLevel*Point))) { zzL[shift]=0.0; zzH[shift]=High[shift]; zz[shift]=High[shift]; //zz[lasthighpos]=0.0; if (shift!=0) lasthighpos=shift; lasthigh=High[shift]; ) ) ) if ((High[shift]<=High[shift+1]) && (Low[shift]lasthighpos) { if ((((High[lasthighpos]-Low[shift])>(StLevel*Point)) && ((lasthighpos-shift)>=minBars)) || ((High[lasthighpos]-Low[shift])>=(BigLevel*Point))) { zzL[shift]=Low[shift]; zzH[shift]=0.0; zz[shift]=Low[shift]; //zz[lastlowpos]=0.0; if (shift!=0) lastlowpos=shift; lastlow=Low[shift]; ) ) ) if ((High[shift]>High[shift+1]) && (Low[shift]High[lasthighpos]) { zzL[shift]=0.0; zzH[shift]=High[shift]; zz[shift]=High[shift]; zz[lasthighpos]=0.0; if (shift!=0) lasthighpos=shift; lasthigh=High[shift]; ) ) ) realcnt=realcnt+1; // if (shift<=0) //Print("Main ",shift," LastHighPos ",lasthighpos," LastHigh ",lasthigh," LastLowPos ", lastlowpos," LastLow ", lastlow , " ",zz[shift]," ",zzH[shift]," ",zzL[shift]); ) first=false; countbars=Bars; NewBarTime=Time[0]; ) //**************************************************************************************************** // // Handling zero bar // //**************************************************************************************************** else //if (!first) { if (realcnt!=Bars) { first=True; return(0); ) if (Close[0]>=lasthigh) { if (lastlowposlastlow) { if ((((High[0]-Low[lastlowpos])>(StLevel*Point)) && ((lastlowpos)>=minBars)) || ((High[0]-Low[lastlowpos])>(BigLevel*Point))) { zzL[0]=0.0; zzH[0]=High[0]; zz[0]=High[0]; lasthigh=High[0]; // lasthighpos=0; //Print("H2 "); ) ) ) if (lastlowpos>lasthighpos) { if (High[0]>=lasthigh) { zz[lasthighpos]=0.0; zz[0]=High[0]; zzL[0]=0.0; zzH[0]=High[0]; lasthighpos=0; lasthigh=High[0]; //Print("H3 "); ) ) //lasthigh=High[0]; ) if (Close[0]<=lastlow) { if (lastlowposlasthighpos) { if (High[0](StLevel*Point)) && ((lasthighpos-shift)>=minBars)) || ((High[lasthighpos]-Low[shift])>(BigLevel*Point))) { zz[0]=Low[0]; zzL[0]=Low[0]; zzH[0]=0.0; lastlow=Low[0]; // lastlowpos=0; //Print("L3 "); ) ) ) //lastlow=Low[0]; ) //Print( Bars," ", Open[0], " ", Low[0]," ",High[0]," ",Close[0]); //Print("Zero ",0," LastHighPos ",lasthighpos," LastHigh ",lasthigh," LastLowPos ", lastlowpos," LastLow ", lastlow , " ",zz[0]," ",zzH[0]," ",zzL[0]); //Print("Bars :",Bars); // Print("Zero - Bars :",Bars," Realcnt ", realcnt); ) return(0); ) ) //-------------------------------------------------------- // ZZ_2L_nen . ?????. //#property copyright "Copyright © 2007, wellx. ver 0.07 alpha" //#property link "aveliks@gmail.com" //-------------------------------------------------------- //-------------------------------------------------------- // Indicator i-vts. Start. //-------------------------------------------------------- //+------------------------------------------------------------------+ //| i-VTS.mq4 | //| Tahir & KimIV | //| http://www.kimiv.ru | //| | //| 06.12.2005 Indicator VTS | //+------------------------------------------------------------------+ // // This indicator Igor Kim moved from MQL to MQ4 // void i_vts() // { int LoopBegin, sh; if (NumberOfBars==0) LoopBegin=Bars-1; else LoopBegin=NumberOfBars-1; LoopBegin=MathMin(Bars-25, LoopBegin); for (sh=LoopBegin; sh>=0; sh--) { GetValueVTS("", 0, NumberOfVTS, sh); ha[sh]=ms[0]; la[sh]=ms[1]; ) ) void i_vts1() // { int LoopBegin, sh; if (NumberOfBars==0) LoopBegin=Bars-1; else LoopBegin=NumberOfBars-1; LoopBegin=MathMin(Bars-25, LoopBegin); for (sh=LoopBegin; sh>=0; sh--) { GetValueVTS("", 0, NumberOfVTS1, sh); ham[sh]=ms[0]; lam[sh]=ms[1]; ) ) //+------------------------------------------------------------------+ //------- The connection is external modules ------------------------- //+------------------------------------------------------------------+ //| Options: | //| sym - Tool Name | //| tf - timeframe (number of minutes) | //| ng - group number | //| nb - number of bar | //| ms - array signals | //+------------------------------------------------------------------+ void GetValueVTS(string sym, int tf, int ng, int nb) { if (sym=="") sym=Symbol(); double f1, f2, s1, s2; f1=iClose(sym, tf, nb)-3*iATR(sym, tf, 10, nb); f2=iClose(sym, tf, nb)+3*iATR(sym, tf, 10, nb); for (int i=1; i<=ng; i++) { s1=iClose(sym, tf, nb+i)-3*iATR(sym, tf, 10, nb+i); s2=iClose(sym, tf, nb+i)+3*iATR(sym, tf, 10, nb+i); if (f1s2) f2=s2; ) ms[0]=f2; // top line ms[1]=f1; // bottom line ) //+------------------------------------------------------------------+ //-------------------------------------------------------- // Indicator i-vts. End. //-------------------------------------------------------- //-------------------------------------------------------- // Parameters of different timeframes. Start. //-------------------------------------------------------- void info_TF() { string info, info1, info2, info3, txt, regim, perc; int i; double pips; openTF[0]=iOpen(NULL,PERIOD_MN1,0); closeTF[0]=iClose(NULL,PERIOD_MN1,0); lowTF[0]=iLow(NULL,PERIOD_MN1,0); highTF[0]=iHigh(NULL,PERIOD_MN1,0); openTF[1]=iOpen(NULL,PERIOD_W1,0); closeTF[1]=iClose(NULL,PERIOD_W1,0); lowTF[1]=iLow(NULL,PERIOD_W1,0); highTF[1]=iHigh(NULL,PERIOD_W1,0); openTF[2]=iOpen(NULL,PERIOD_D1,0); closeTF[2]=iClose(NULL,PERIOD_D1,0); lowTF[2]=iLow(NULL,PERIOD_D1,0); highTF[2]=iHigh(NULL,PERIOD_D1,0); openTF[3]=iOpen(NULL,PERIOD_H4,0); closeTF[3]=iClose(NULL,PERIOD_H4,0); lowTF[3]=iLow(NULL,PERIOD_H4,0); highTF[3]=iHigh(NULL,PERIOD_H4,0); openTF[4]=iOpen(NULL,PERIOD_H1,0); closeTF[4]=iClose(NULL,PERIOD_H1,0); lowTF[4]=iLow(NULL,PERIOD_H1,0); highTF[4]=iHigh(NULL,PERIOD_H1,0); if (StringSubstr(info_comment,2,1)=="1") { if (minPercent>0) perc=DoubleToStr(MathAbs(minPercent),1); else perc="0.0"; switch (ExtIndicator) { case 0 : {regim=" | "+ ExtIndicator + " / " + minBars + " / " + ExtDeviation + " / " + ExtBackstep; break;} case 1 : {regim=" | "+ ExtIndicator + " / " + minSize + " / " + perc+" %"; break;} case 2 : {regim=" | "+ ExtIndicator + " / " + minBars + "/" + minSize; break;} case 3 : {regim=" | "+ ExtIndicator + " / " + minBars; break;} case 4 : {regim=" | "+ ExtIndicator + " / " + minSize; break;} case 5 : {regim=" | "+ ExtIndicator + " / " + minBars; break;} case 6 : {regim=" | "+ ExtIndicator + " / " + GrossPeriod + " / " + minBars + " / " + ExtDeviation + " / " + ExtBackstep; break;} case 7 : {regim=" | "+ ExtIndicator + " / " + GrossPeriod + " / " + minBars; break;} case 8 : {regim=" | "+ ExtIndicator + " / " + GrossPeriod + " / " + minBars + " / " + ExtDeviation; break;} case 10 : {regim=" | "+ ExtIndicator + " / " + GrossPeriod + " / " + minBars; break;} case 11 : {regim=" | "+ ExtIndicator + " / " + Depth + " / " + ExtDeviation + " / " + ExtBackstep; break;} case 12 : {regim=" | "+ ExtIndicator + " / " + minSize; break;} case 13 : {regim=" | "+ ExtIndicator + " / " + minBars + " / " + minSize; break;} case 14 : {regim=" | "+ ExtIndicator + " / " + StLevel + " / " + BigLevel + " / " + minBars; break;} ) ) info=""; if (StringSubstr(info_comment,0,1)=="1") { for (i=0;i<5;i++) { pips=(highTF[i]-lowTF[i])/Point; if (pips>0) { if (openTF[i]==closeTF[i]) {txt=" = ";} else if (openTF[i]!=closeTF[i] && MathAbs((highTF[i]-lowTF[i])/(openTF[i]-closeTF[i]))>=6.6) {txt=" -|- ";} else if (openTF[i]>closeTF[i]) {txt=" \/ ";} else if (openTF[i]0) { if (afrh[1]!=0) info1=info1+" "+DoubleToStr(100*MathAbs(afrh[1]-afrl[0])/afrh[1],2)+" %"; ) else { if (afrl[1]!=0) info1=info1+" "+DoubleToStr(100*MathAbs(afrh[0]-afrl[1])/afrl[1],2)+" %"; ) ) info1=info1+regim; if (StringSubstr(info_comment,3,1)=="1") { if (ExtGartleyTypeSearch==0) countGartley++; if (RangeForPointD>0 && vNamePatternToNumberPattern != "") { info2=" It is found " + countGartley + " patterns - for pattern N " + NumberPattern + " - " + vBullBearToNumberPattern + " " + vNamePatternToNumberPattern + " - " + DoubleToStr(LevelForDminToNumberPattern,Digits) + " < Range of the prices D < " + DoubleToStr(LevelForDmaxToNumberPattern,Digits) + ""; ) else info2=""; ) if (StringSubstr(info_comment,4,1)=="1") { if (info_RZS_RL=="") { info=""; ) else { info="RL_Static="+info_RZS_RL + " "; ) info3=info; if (info_RZD_RL=="") { info3=info; ) else { info3=info+"RL_Dinamic="+info_RZD_RL; ) ) Comment(info1,"\n",info2,"\n",""+info3); close_TF=Close[0]; ) //-------------------------------------------------------- // Parameters of different timeframes. End. //-------------------------------------------------------- //-------------------------------------------------------- // Changing the size of arrays. Start. //-------------------------------------------------------- void arrResize(int size) { ArrayResize(fi,size); ArrayResize(fitxt,size); ArrayResize(fitxt100,size); ) //-------------------------------------------------------- // Changing the size of arrays. Start. //-------------------------------------------------------- //-------------------------------------------------------- // Create arrays of numbers. Start. //-------------------------------------------------------- void array_() { for (int i=0; i<65; i++) { numberFibo [i]=0; numberPesavento [i]=0; numberGartley [i]=0; numberGilmorQuality [i]=0; numberGilmorGeometric [i]=0; numberGilmorHarmonic [i]=0; numberGilmorArithmetic[i]=0; numberGilmorGoldenMean[i]=0; numberSquare [i]=0; numberCube [i]=0; numberRectangle [i]=0; numberExt [i]=0; ) number [0]=0.111; numbertxt [0]=".111"; numberCube [0]=1; number [1]=0.125; numbertxt [1]=".125"; numberMix [1]=1; numberGilmorHarmonic [1]=1; number [2]=0.146; numbertxt [2]=".146"; numberFibo [2]=1; numberGilmorGeometric [2]=1; number [3]=0.167; numbertxt [3]=".167"; numberGilmorArithmetic[3]=1; number [4]=0.177; numbertxt [4]=".177"; numberGilmorHarmonic [4]=1; numberSquare [4]=1; number [5]=0.186; numbertxt [5]=".186"; numberGilmorGeometric [5]=1; number [6]=0.192; numbertxt [6]=".192"; numberCube [6]=1; number [7]=0.2; numbertxt [7]=".2"; numberRectangle [7]=1; number [8]=0.236; numbertxt [8]=".236"; numberFibo [8]=1; numberMix [8]=1; numberGilmorGeometric [8]=1; numberGilmorGoldenMean[8]=1; number [9]=0.25; numbertxt [9]=".25"; numberPesavento [9]=1; numberGilmorQuality [9]=1; numberGilmorHarmonic [9]=1; numberSquare [9]=1; number [10]=0.3; numbertxt [10]=".3"; numberGilmorGeometric [10]=1; numberGilmorGoldenMean[10]=1; number [11]=0.333; numbertxt [11]=".333"; numberGilmorArithmetic[11]=1; numberCube [11]=1; number [12]=0.354; numbertxt [12]=".354"; numberGilmorHarmonic [12]=1; numberSquare [12]=1; number [13]=0.382; numbertxt [13]=".382"; numberFibo [13]=1; numberPesavento [13]=1; numberGartley [13]=1; numberGilmorQuality [13]=1; numberGilmorGeometric [13]=1; number [14]=0.447; numbertxt [14]=".447"; numberGartley [14]=1; numberRectangle [14]=1; number [15]=0.486; numbertxt [15]=".486"; numberGilmorGeometric [15]=1; numberGilmorGoldenMean[15]=1; number [16]=0.5; numbertxt [16]=".5"; numberFibo [16]=1; numberPesavento [16]=1; numberGartley [16]=1; numberGilmorQuality [16]=1; numberGilmorHarmonic [16]=1; numberSquare [16]=1; number [17]=0.526; numbertxt [17]=".526"; numberGilmorGeometric [17]=1; number [18]=0.577; numbertxt [18]=".577"; numberGilmorArithmetic[18]=1; numberCube [18]=1; number [19]=0.618; numbertxt [19]=".618"; numberFibo [19]=1; numberPesavento [19]=1; numberGartley [19]=1; numberGilmorQuality [19]=1; numberGilmorGeometric [19]=1; numberGilmorGoldenMean[19]=1; number [20]=0.667; numbertxt [20]=".667"; numberGilmorQuality [20]=1; numberGilmorArithmetic[20]=1; number [21]=0.707; numbertxt [21]=".707"; numberPesavento [21]=1; numberGartley [21]=1; numberGilmorHarmonic [21]=1; numberSquare [21]=1; number [22]=0.764; numbertxt [22]=".764"; numberFibo [22]=1; number [23]=0.786; numbertxt [23]=".786"; numberPesavento [23]=1; numberGartley [23]=1; numberGilmorQuality [23]=1; numberGilmorGeometric [23]=1; numberGilmorGoldenMean[23]=1; number [24]=0.809; numbertxt [24]=".809"; numberExt [24]=1; number [25]=0.841; numbertxt [25]=".841"; numberPesavento [25]=1; number [26]=0.854; numbertxt [26]=".854"; numberFibo [26]=1; numberMix [26]=1; number [27]=0.874; numbertxt [27]=".874"; numberExt [27]=1; number [28]=0.886; numbertxt [28]=".886"; numberGartley [28]=1; number [29]=1.0; numbertxt [29]="1."; numberFibo [29]=1; numberPesavento [29]=1; numberGartley [29]=1; numberGilmorQuality [29]=1; numberGilmorGeometric [29]=1; number [30]=1.128; numbertxt [30]="1.128"; numberPesavento [30]=1; numberGartley [30]=1; number [31]=1.236; numbertxt [31]="1.236"; numberFibo [31]=1; number [32]=1.272; numbertxt [32]="1.272"; numberPesavento [32]=1; numberGartley [32]=1; numberGilmorQuality [32]=1; numberGilmorGeometric [32]=1; numberGilmorGoldenMean[32]=1; number [33]=1.309; numbertxt [33]="1.309"; numberExt [33]=1; number [34]=1.414; numbertxt [34]="1.414"; numberPesavento [34]=1; numberGartley [34]=1; numberGilmorHarmonic [34]=1; numberSquare [34]=1; number [35]=1.5; numbertxt [35]="1.5"; // numberPesavento [35]=1; numberGilmorArithmetic[35]=1; number [36]=phi; numbertxt [36]="1.618"; numberFibo [36]=1; numberPesavento [36]=1; numberGartley [36]=1; numberGilmorQuality [36]=1; numberGilmorGeometric [36]=1; numberGilmorGoldenMean[36]=1; number [37]=1.732; numbertxt [37]="1.732"; numberMix [37]=1; numberGilmorQuality [37]=1; numberGilmorArithmetic[37]=1; numberCube [37]=1; number [38]=1.75; numbertxt [38]="1.75"; numberGilmorQuality [38]=1; number [39]=1.902; numbertxt [39]="1.902"; numberMix [39]=1; numberGilmorGeometric [39]=1; number [40]=2.0; numbertxt [40]="2."; numberPesavento [40]=1; numberGartley [40]=1; numberGilmorQuality [40]=1; numberGilmorHarmonic [40]=1; numberSquare [40]=1; number [41]=2.058; numbertxt [41]="2.058"; numberGilmorGeometric [41]=1; numberGilmorGoldenMean[41]=1; number [42]=2.236; numbertxt [42]="2.236"; numberGartley [42]=1; numberGilmorQuality [42]=1; numberRectangle [42]=1; number [43]=2.288; numbertxt [43]="2.288"; numberExt [43]=1; number [44]=2.5; numbertxt [44]="2.5"; numberGilmorQuality [44]=1; number [45]=2.618; numbertxt [45]="2.618"; numberPesavento [45]=1; numberGartley [45]=1; numberGilmorQuality [45]=1; numberGilmorGeometric [45]=1; numberGilmorGoldenMean[45]=1; number [46]=2.828; numbertxt [46]="2.828"; numberGilmorHarmonic [46]=1; numberSquare [46]=1; number [47]=3.0; numbertxt [47]="3.0"; numberGilmorQuality [47]=1; numberGilmorArithmetic[47]=1; numberCube [47]=1; number [48]=3.142; numbertxt [48]="3.142"; numberGartley [48]=1; number [49]=3.236; numbertxt [49]="3.236"; numberExt [49]=1; number [50]=3.33; numbertxt [50]="3.33"; numberGilmorQuality [50]=1; numberGilmorGeometric [50]=1; numberGilmorGoldenMean[50]=1; numberExt [50]=1; number [51]=3.464; numbertxt [51]="3.464"; numberExt [51]=1; number [52]=3.618; numbertxt [52]="3.618"; numberGartley [52]=1; number [53]=4.0; numbertxt [53]="4."; numberPesavento [53]=1; numberGilmorHarmonic [53]=1; numberSquare [53]=1; number [54]=4.236; numbertxt [54]="4.236"; numberFibo [54]=1; numberGilmorQuality [54]=1; numberGilmorGeometric [54]=1; numberExt [54]=1; number [55]=4.472; numbertxt [55]="4.472"; numberExt [55]=1; number [56]=5.0; numbertxt [56]="5."; numberRectangle [56]=1; number [57]=5.2; numbertxt [57]="5.2"; numberCube [57]=1; number [58]=5.388; numbertxt [58]="5.388"; numberGilmorGeometric [58]=1; number [59]=5.657; numbertxt [59]="5.657"; numberGilmorHarmonic [59]=1; numberSquare [59]=1; number [60]=6.0; numbertxt [60]="6."; numberGilmorArithmetic[60]=1; number [61]=6.854; numbertxt [61]="6.854"; numberGilmorQuality [61]=1; numberGilmorGeometric [61]=1; number [62]=8.0; numbertxt [62]="8."; numberGilmorHarmonic [62]=1; number [63]=9.0; numbertxt [63]="9."; numberCube [63]=1; /* number []=; numbertxt []=; // ExtFiboType=0 numberFibo []=; // 0 numberPesavento []=; // 1 numberGartley []=; // 2 numberMix []=; // 3 numberGilmorQuality []=; // 4 numberGilmorGeometric []=; // 5 numberGilmorHarmonic []=; // 6 numberGilmorArithmetic[]=; // 7 numberGilmorGoldenMean[]=; // 8 numberSquare []=; // 9 numberCube []=; // 10 numberRectangle []=; // 11 numberExt []=; * / ) //-------------------------------------------------------- // Create arrays of numbers. End. //-------------------------------------------------------- //-------------------------------------------------------- // Determination of values and color numbers for patterns Pesavento. Start. //-------------------------------------------------------- void Pesavento_patterns() { if (ExtFiboType==1) { switch (ExtFiboChoice) { case 0 : {search_number(numberPesavento, ExtPesavento) ;break;} case 1 : {search_number(numberGartley, ExtGartley886) ;break;} case 2 : {search_number(numberGartley, ExtGartley886) ;break;} case 3 : {search_number(numberGilmorQuality, ExtPesavento) ;break;} case 4 : {search_number(numberGilmorGeometric, ExtPesavento) ;break;} case 5 : {search_number(numberGilmorHarmonic, ExtPesavento) ;break;} case 6 : {search_number(numberGilmorArithmetic, ExtPesavento) ;break;} case 7 : {search_number(numberGilmorGoldenMean, ExtPesavento) ;break;} case 8 : {search_number(numberSquare, ExtPesavento) ;break;} case 9 : {search_number(numberCube, ExtPesavento) ;break;} case 10 : {search_number(numberRectangle, ExtPesavento) ;break;} case 11 : {search_number(numberExt, ExtPesavento) ;break;} ) ) else { search_number(numberFibo, ExtPesavento); ) ) //-------------------------------------------------------- // Determination of values and color numbers for patterns Pesavento. End. //-------------------------------------------------------- //-------------------------------------------------------- // Search for the number of patterns Pesavento. Start. //-------------------------------------------------------- void search_number(int arr[], color cPattern) { int ki; colorPPattern=ExtNotFibo; if (ExtFiboChoice!=2) { if (ExtDeltaType==2) for (ki=kiPRZ;ki<=63;ki++) { if (arr[ki]>0) { if (MathAbs((number[ki]-kj)/number[ki])<=ExtDelta) {kk=number[ki]; txtkk=numbertxt[ki]; k2=-1; colorPPattern=cPattern; break;} ) ) if (ExtDeltaType==1) for (ki=kiPRZ;ki<=63;ki++) { if (arr[ki]>0) { if (MathAbs(number[ki]-kj)<=ExtDelta) {kk=number[ki]; txtkk=numbertxt[ki]; k2=-1; colorPPattern=cPattern; break;} ) ) ) else { if (ExtDeltaType==2) for (ki=kiPRZ;ki<=63;ki++) { if (arr[ki]>0) { if (MathAbs((number[ki]-kj)/number[ki])<=ExtDelta) {kk=number[ki]; txtkk=numbertxt[ki]; k2=-1; colorPPattern=cPattern; break;} ) else if (numberMix[ki]>0) if (MathAbs((number[ki]-kj)/number[ki])<=ExtDelta) {kk=number[ki]; txtkk=numbertxt[ki]; k2=-1; colorPPattern=ExtPesavento; break;} ) if (ExtDeltaType==1) for (ki=kiPRZ;ki<=63;ki++) { if (arr[ki]>0) { if (MathAbs(number[ki]-kj)<=ExtDelta) {kk=number[ki]; txtkk=numbertxt[ki]; k2=-1; colorPPattern=cPattern; break;} ) else if (numberMix[ki]>0) if (MathAbs(number[ki]-kj)<=ExtDelta) {kk=number[ki]; txtkk=numbertxt[ki]; k2=-1; colorPPattern=ExtPesavento; break;} ) ) ) //-------------------------------------------------------- // Search for the number of patterns Pesavento. End. //-------------------------------------------------------- //-------------------------------------------------------- // Sending a message by email. Start. //-------------------------------------------------------- void _SendMail(string subject, string some_text) { SendMail(subject, some_text); ) //-------------------------------------------------------- // Sending a message by email. End. //-------------------------------------------------------- //-------------------------------------------------------- // Convert string in color. Start. // Function write Integer. http://forum.mql4.com/ru/7134 //-------------------------------------------------------- color fStrToColor(string aName){ color tColor[]={ Black, DarkGreen, DarkSlateGray, Olive, Green, Teal, Navy, Purple, Maroon, Indigo, MidnightBlue, DarkBlue, DarkOliveGreen, SaddleBrown, ForestGreen, OliveDrab, SeaGreen, DarkGoldenrod, DarkSlateBlue, Sienna, MediumBlue, Brown, DarkTurquoise, DimGray, LightSeaGreen, DarkViolet, FireBrick, MediumVioletRed, MediumSeaGreen, Chocolate, Crimson, SteelBlue, Goldenrod, MediumSpringGreen, LawnGreen, CadetBlue, DarkOrchid, YellowGreen, LimeGreen, OrangeRed, DarkOrange, Orange, Gold, Yellow, Chartreuse, Lime, SpringGreen, Aqua, DeepSkyBlue, Blue, Magenta, Red, Gray, SlateGray, Peru, BlueViolet, LightSlateGray, DeepPink, MediumTurquoise, DodgerBlue, Turquoise, RoyalBlue, SlateBlue, DarkKhaki, IndianRed, MediumOrchid, GreenYellow, MediumAquamarine, DarkSeaGreen, Tomato, RosyBrown, Orchid, MediumPurple, PaleVioletRed, Coral, CornflowerBlue, DarkGray, SandyBrown, MediumSlateBlue, Tan, DarkSalmon, BurlyWood, HotPink, Salmon, Violet, LightCoral, SkyBlue, LightSalmon, Plum, Khaki, LightGreen, Aquamarine, Silver, LightSkyBlue, LightSteelBlue, LightBlue, PaleGreen, Thistle, PowderBlue, PaleGoldenrod, PaleTurquoise, LightGray, Wheat, NavajoWhite, Moccasin, LightPink, Gainsboro, PeachPuff, Pink, Bisque, LightGoldenrod, BlanchedAlmond, LemonChiffon, Beige, AntiqueWhite, PapayaWhip, Cornsilk, LightYellow, LightCyan, Linen, Lavender, MistyRose, OldLace, WhiteSmoke, Seashell, Ivory, Honeydew, AliceBlue, LavenderBlush, MintCream, Snow, White }; string tName[]={ "Black", "DarkGreen", "DarkSlateGray", "Olive", "Green", "Teal", "Navy", "Purple", "Maroon", "Indigo", "MidnightBlue", "DarkBlue", "DarkOliveGreen", "SaddleBrown", "ForestGreen", "OliveDrab", "SeaGreen", "DarkGoldenrod", "DarkSlateBlue", "Sienna", "MediumBlue", "Brown", "DarkTurquoise", "DimGray", "LightSeaGreen", "DarkViolet", "FireBrick", "MediumVioletRed", "MediumSeaGreen", "Chocolate", "Crimson", "SteelBlue", "Goldenrod", "MediumSpringGreen", "LawnGreen", "CadetBlue", "DarkOrchid", "YellowGreen", "LimeGreen", "OrangeRed", "DarkOrange", "Orange", "Gold", "Yellow", "Chartreuse", "Lime", "SpringGreen", "Aqua", "DeepSkyBlue", "Blue", "Magenta", "Red", "Gray", "SlateGray", "Peru", "BlueViolet", "LightSlateGray", "DeepPink", "MediumTurquoise", "DodgerBlue", "Turquoise", "RoyalBlue", "SlateBlue", "DarkKhaki", "IndianRed", "MediumOrchid", "GreenYellow", "MediumAquamarine", "DarkSeaGreen", "Tomato", "RosyBrown", "Orchid", "MediumPurple", "PaleVioletRed", "Coral", "CornflowerBlue", "DarkGray", "SandyBrown", "MediumSlateBlue", "Tan", "DarkSalmon", "BurlyWood", "HotPink", "Salmon", "Violet", "LightCoral", "SkyBlue", "LightSalmon", "Plum", "Khaki", "LightGreen", "Aquamarine", "Silver", "LightSkyBlue", "LightSteelBlue", "LightBlue", "PaleGreen", "Thistle", "PowderBlue", "PaleGoldenrod", "PaleTurquoise", "LightGray", "Wheat", "NavajoWhite", "Moccasin", "LightPink", "Gainsboro", "PeachPuff", "Pink", "Bisque", "LightGoldenrod", "BlanchedAlmond", "LemonChiffon", "Beige", "AntiqueWhite", "PapayaWhip", "Cornsilk", "LightYellow", "LightCyan", "Linen", "Lavender", "MistyRose", "OldLace", "WhiteSmoke", "Seashell", "Ivory", "Honeydew", "AliceBlue", "LavenderBlush", "MintCream", "Snow", "White" }; aName=StringTrimLeft(StringTrimRight(aName)); for(int i=0;i