/*********************************************************************************************** Title: Curve-Fit Tool for eSignal By: Divergence Software, Inc. Web: http://www.sr-analyst.com ================================================================================================ Project Description: This tool allows you to plot best-fit polynomial curves through data points that you select with mouse clicks using a completely mouse-driven interface. You can create as many curves/lines as you like and they will remain on the chart until you explicitly delete them. You can extend the lines up to 1000 bars past the most current bar (default extension is 30 bars). Using polynomial functions to calculate and plot best fit curves is a popular method of constructing support/resistance levels. Most implementations (including my Gravity Bands and PolyBands indicators) use a fixed period or length and perform the calculation on all bars within that range. The Curve Fit Tool, on the other hand, allows you to select specific individual data points (i.e., which may be the most representative of the recent price move) and create a best fit line/curve based only on those data points, which is a much more refined process. Creating Best-Fit Curves ======================== You can select from 5 polynomial functions (these appear as buttons at the bottom-left of your chart when the indicator is loaded). Linr - Standard linear regression. Click once on the "Linr" button and then use your mouse to click on at least two data points on the chart. To select a data point just click your mouse near the high of a bar to select a bar high, or near the low of a bar to select a bar low. When done selecting data points, click on the "Fit" button and the linear regression will be calculated and drawn on the chart. Quad - Quadratic polynomial function, also called second-order polynomial. Click once on the "Quad" button and then use your mouse to click on at least three data points on the chart. To select a data point just click your mouse near the high of a bar to select a bar high, or near the low of a bar to select a bar low. When done selecting data points, click on the "Fit" button and the curve will be calculated and drawn on the chart. The quadratic function is f(x) = ax^2 + bx + c. Cube - Cubic polynomial function, also called third-order polynomial. Click once on the "Cube" button and then use your mouse to click on at least four data points on the chart. To select a data point just click your mouse near the high of a bar to select a bar high, or near the low of a bar to select a bar low. When done selecting data points, click on the "Fit" button and the curve will be calculated and drawn on the chart. The cubic function is f(x) = ax^3 + bx^2 + cx + d. Quar - Quartic polynomial function, also called fourth-order polynomial or biquadratic. Click once on the "Quar" button and then use your mouse to click on at least five data points on the chart. To select a data point just click your mouse near the high of a bar to select a bar high, or near the low of a bar to select a bar low. When done selecting data points, click on the "Fit" button and the curve will be calculated and drawn on the chart. The quartic function is f(x) = ax^4 + bx^3 + cx^2 + dx + e. Quin - Quintic polynomial function, also called fifth-order polynomial. Click once on the "Quin" button and then use your mouse to click on at least six data points on the chart. To select a data point just click your mouse near the high of a bar to select a bar high, or near the low of a bar to select a bar low. When done selecting data points, click on the "Fit" button and the curve will be calculated and drawn on the chart. The quintic function is g(x) = ax^5 + bx^4 + cx^3 + dx^2 + ex + f. When selecting data points, the only requirement is that the first data point you select must be the origin point, which means that the remaining data points MUST be to the right of that first point. You can create as many curves as you need, and of any type. The curve data will be stored with the chart so if you change intervals or symbols, any curves you created for a particular symbol/interval combination will always be remembered and displayed. Deleting Best-Fit Curves ======================== To remove an existing line/curve, just click once on its delete-tag. The delete-tag is a small diamond shape that you will see drawn near the origin point. The default delete-tag color is orange, but you can change it to whatever color you like. To remove ALL curves from a chart, click on the "Clear-All" button that you see at the bottom-left of your chart. This will remove all previously-drawn curves at once. Usage Notes =========== Please note that in eSignal v12 you must hold down the SHIFT key while clicking on any of the buttons or when selecting data points. This is not required in eSignal 10.x Indicator Parameters: ==================== Highlight Selected Data Select true or false. When true, the data points used in the calculation of Points?: the curve will be highlighted on the chart with small circles drawn above a bar (to indicate that the high of the bar was the selected data point) or drawn below a bar (to indicate that the low of the bar was the selected data point. If set to false then the data points will not be highlighted. Pending Highlight Color to use to highlight data points during the data point selection Color: process. The default color is black. Action Complete - Color to use to highlight data points after the calculation is complete and Highlight Color: the line has been drawn. The default color is magenta. Linear Poly Line Color: Color to use when plotting a linear polynomial best-fit line. The default is maroon. Thickness: Line thickness to use when plotting a linear polynomial best-fit line. Input a thickness between 1 and 10. The default value is 1. Line Type: Line type to use when plotting a linear polynomial best-fit line. Select from "Solid", "Dot", "Dash", "DashDot", and "DashDotDot". The default is "Solid". Quadratic Poly Line Color: Color to use when plotting a quadratic polynomial best-fit curve. The default is blue. Thickness: Line thickness to use when plotting a quadratic polynomial best-fit curve. Input a thickness between 1 and 10. The default value is 1. Line Type: Line type to use when plotting a quadratic polynomial best-fit curve. Select from "Solid", "Dot", "Dash", "DashDot", and "DashDotDot". The default is "Solid". Cubic Poly Line Color: Color to use when plotting a cubic polynomial best-fit curve. The default is green. Thickness: Line thickness to use when plotting a cubic polynomial best-fit curve. Input a thickness between 1 and 10. The default value is 1. Line Type: Line type to use when plotting a cubic polynomial best-fit curve. Select from "Solid", "Dot", "Dash", "DashDot", and "DashDotDot". The default is "Solid". Quartic Poly Line Color: Color to use when plotting a quartic polynomial best-fit curve. The default is purple. Thickness: Line thickness to use when plotting a quartic polynomial best-fit curve. Input a thickness between 1 and 10. The default value is 1. Line Type: Line type to use when plotting a quartic polynomial best-fit curve. Select from "Solid", "Dot", "Dash", "DashDot", and "DashDotDot". The default is "Solid". Quintic Poly Line Color: Color to use when plotting a quintic polynomial best-fit curve. The default is brown. Thickness: Line thickness to use when plotting a quintic polynomial best-fit curve. Input a thickness between 1 and 10. The default value is 1. Line Type: Line type to use when plotting a quintic polynomial best-fit curve. Select from "Solid", "Dot", "Dash", "DashDot", and "DashDotDot". The default is "Solid". Line Future Extension: Input the number of bars past the most current price bar that all curves and lines should be extended into the future. You can input a value between 0 and 1000. The default value is 30. Prompt Text Color: Color to use when displaying usage prompts at the bottom of the chart. The default is navy. Text Size: Font size to use for prompts. Input a value between 8 and 55. The default is 12. Delete Tag Color: Color to use when drawing the delete-tags associated with each line/curve. The default is orange. Tag Size: Font size to use for tags. Input a value between 8 and 55. The default is 12. Menu Button Size: Font size to use when drawing the button array at the bottom-left of the chart. Input a value between 8 and 55. The default is 11. Foreground Color: Menu text foreground color. The default is white. Button Active Color: Active button background color. The default is light blue. Clear-All Active Color: Background color for the "Clear-All" button when it is active. The default is light red. Button Inactive Color: Background color for inactive buttons. The default is grey. Horz Offset: The horizontal offset (in pixels) for the button array. The default value is 2. Vert Offset: The vertical offset (in pixels) for the button array. The default value is 13. Disclaimer: For educational purposes only! Obviously, no guarantees whatsoever and use at your own risk. **********************************************************************/