Library "DataChart" Library to plot scatterplot or heatmaps for your own set of data samples
draw(this) draw contents of the chart object Parameters: this: Chart object Returns: current chart object
init(this) Initialize Chart object. Parameters: this: Chart object to be initialized Returns: current chart object
addSample(this, sample, trigger) Add sample data to chart using Sample object Parameters: this: Chart object sample: Sample object containing sample x and y values to be plotted trigger: Samples are added to chart only if trigger is set to true. Default value is true Returns: current chart object
addSample(this, x, y, trigger) Add sample data to chart using x and y values Parameters: this: Chart object x: x value of sample data y: y value of sample data trigger: Samples are added to chart only if trigger is set to true. Default value is true Returns: current chart object
addPriceSample(this, priceSampleData, config) Add price sample data - special type of sample designed to measure price displacements of events Parameters: this: Chart object priceSampleData: PriceSampleData object containing event driven displacement data of x and y config: PriceSampleConfig object containing configurations for deriving x and y from priceSampleData Returns: current chart object
Sample Sample data for chart Fields: xValue: x value of the sample data yValue: y value of the sample data
ChartProperties Properties of plotting chart Fields: title: Title of the chart suffix: Suffix for values. It can be used to reference 10X or 4% etc. Used only if format is not format.percent matrixSize: size of the matrix used for plotting chartType: Can be either scatterplot or heatmap. Default is scatterplot outliersStart: Indicates the percentile of data to filter out from the starting point to get rid of outliers outliersEnd: Indicates the percentile of data to filter out from the ending point to get rid of outliers. backgroundColor plotColor: color of plots on the chart. Default is color.yellow. Only used for scatterplot type heatmapColor: color of heatmaps on the chart. Default is color.red. Only used for heatmap type borderColor: border color of the chart table. Default is color.yellow. plotSize: size of scatter plots. Default is size.large format: data representation format in tooltips. Use mintick.percent if measuring any data in terms of percent. Else, use format.mintick showCounters: display counters which shows totals on each quadrants. These are single cell tables at the corners displaying number of occurences on each quadrant. showTitle: display title at the top center. Uses the title string set in the properties counterBackground: background color of counter table cells. Default is color.teal counterTextColor: text color of counter table cells. Default is color.white counterTextSize: size of counter table cells. Default is size.large titleBackground: background color of chart title. Default is color.maroon titleTextColor: text color of the chart title. Default is color.white titleTextSize: text size of the title cell. Default is size.large addOutliersToBorder: If set, instead of removing the outliers, it will be added to the border cells. useCommonScale: Use common scale for both x and y. If not selected, different scales are calculated based on range of x and y values from samples. Default is set to false. plotchar: scatter plot character. Default is set to ascii bullet.
ChartDrawing Chart drawing objects collection Fields: properties: ChartProperties object which determines the type and characteristics of chart being plotted titleTable: table containing title of the chart. mainTable: table containing plots or heatmaps. quadrantTables: Array of tables containing counters of all 4 quandrants
Chart Chart type which contains all the information of chart being plotted Fields: properties: ChartProperties object which determines the type and characteristics of chart being plotted samples: Array of Sample objects collected over period of time for plotting on chart. displacements: Array containing displacement values. Both x and y values displacementX: Array containing only X displacement values. displacementY: Array containing only Y displacement values. drawing: ChartDrawing object which contains all the drawing elements
PriceSampleConfig Configs used for adding specific type of samples called PriceSamples Fields: duration: impact duration for which price displacement samples are calculated. useAtrReference: Default is true. If set to true, price is measured in terms of Atr. Else is measured in terms of percentage of price. atrLength: atrLength to be used for measuring the price based on ATR. Used only if useAtrReference is set to true.
PriceSampleData Special type of sample called price sample. Can be used instead of basic Sample type Fields: trigger: consider sample only if trigger is set to true. Default is true. source: Price source. Default is close highSource: High price source. Default is high lowSource: Low price source. Default is low tr: True range value. Default is ta.tr
Siguiendo fielmente el espíritu TradingView, el autor ha publicado este código Pine como una biblioteca de código abierto, permitiendo que otros programadores de Pine en nuestra comunidad lo utilicen de nuevo. ¡Olé por el autor! Puede utilizar esta biblioteca de forma privada o en otras publicaciones de código abierto, pero tenga en cuenta que la reutilización de este código en una publicación se rige por las Normas internas.
La información y las publicaciones que ofrecemos, no implican ni constituyen un asesoramiento financiero, ni de inversión, trading o cualquier otro tipo de consejo o recomendación emitida o respaldada por TradingView. Puede obtener información adicional en las Condiciones de uso.