### Price Channel Configuration Example Source: https://doc.chart-img.com/index Example JSON configuration for generating a chart with the Price Channel study. It specifies chart dimensions, theme, and detailed overrides for high, low, and center price lines. ```json { "height": 300, "theme": "dark", "studies": [ { "name": "Price Channel", "input": { "in_0": 20, "in_1": 0 }, "override": { "Highprice Line.visible": true, "Highprice Line.linewidth": 1, "Highprice Line.plottype": "line", "Highprice Line.color": "rgb(245,0,87)", "Lowprice Line.visible": true, "Lowprice Line.linewidth": 1, "Lowprice Line.plottype": "line", "Lowprice Line.color": "rgb(245,0,87)", "Centerprice Line.visible": true, "Centerprice Line.linewidth": 1, "Centerprice Line.plottype": "line", "Centerprice Line.color": "rgb(33,150,243)" } } ] } ``` -------------------------------- ### Price Oscillator Configuration Example Source: https://doc.chart-img.com/index Example JSON configuration for generating a chart with the Price Oscillator study. This includes options to control the main pane visibility and study-specific input and override parameters. ```json { "height": 300, "theme": "dark", "override": { "showMainPane": false }, "studies": [ { "name": "Price Oscillator", "forceOverlay": false, "input": { "in_0": 10, "in_1": 21 }, "override": { "Plot.linewidth": 1, "Plot.plottype": "line", "Plot.color": "rgb(8,153,129)" } } ] } ``` -------------------------------- ### Example TradingView Chart URL Source: https://doc.chart-img.com/index This is an example URL for requesting a TradingView advanced chart. It includes parameters for height, symbol, interval, studies, and API key. ```url https://api.chart-img.com/v1/tradingview/advanced-chart?height=500&symbol=COINBASE:BTCUSD&interval=4h&studies=CCI:20,hlc3&key=YOUR_API_KEY ``` -------------------------------- ### Configure Long Position Drawing Source: https://doc.chart-img.com/index Sets up a 'Long Position' drawing on the chart, indicating potential trade entry, target, and stop prices. Requires start datetime, entry price, target price, and stop price. Styling overrides are not detailed in this example. ```JSON { "height": 400, "theme": "dark", "interval": "4h", "range": { "from": "2023-01-20T00:00:00.000Z", "to": "2023-02-12T00:00:00.000Z" }, "drawings": [ { "name": "Long Position", "input": { "startDatetime": "2023-02-09T00:00:00.000Z", "entryPrice": 22400, "targetPrice": 24000, "stopPrice": 22100 } } ] } ``` -------------------------------- ### Date Price Range Drawing Request Example Source: https://doc.chart-img.com/index This JSON object demonstrates how to configure a 'Date Price Range' drawing. It specifies the chart dimensions, theme, and the drawing's input parameters like start and end datetimes and prices. Optional override parameters such as fontSize can also be included. ```json { "height": 400, "theme": "dark", "drawings": [ { "name": "Date Price Range", "input": { "startDatetime": "2023-01-01T00:00:00.000Z", "startPrice": 16499, "endDatetime": "2023-01-18T00:00:00.000Z", "endPrice": 21650 }, "override": { "fontSize": 16 } } ] } ``` -------------------------------- ### Parabolic SAR Configuration Example Source: https://doc.chart-img.com/index Example JSON configuration for generating a chart with the Parabolic SAR study. It includes settings for chart height, theme, and study-specific inputs and overrides. ```json { "height": 300, "theme": "dark", "studies": [ { "name": "Parabolic SAR", "input": { "in_0": 0.02, "in_1": 0.02, "in_2": 0.2 }, "override": { "Plot.linewidth": 1, "Plot.plottype": "cross", "Plot.color": "rgb(33,150,243)" } } ] } ``` -------------------------------- ### Get TradingView Exchange Symbols (curl) Source: https://doc.chart-img.com/index Retrieves symbols for a specific TradingView exchange using curl. This example fetches symbols for the 'binance' exchange and saves the response to a JSON file. Remember to substitute 'YOUR_API_KEY' with your key. ```bash curl -G https://api.chart-img.com/v3/tradingview/exchange/binance \ -H "x-api-key: YOUR_API_KEY" \ -o exchange-binance.json ``` -------------------------------- ### Rectangle Drawing Request Example Source: https://doc.chart-img.com/index This JSON object illustrates a 'Rectangle' drawing request. It includes essential input parameters such as start and end datetimes and prices, along with an optional text label. The 'override' object allows customization of label alignment, line color, and background fill. ```json { "height": 400, "theme": "dark", "drawings": [ { "name": "Rectangle", "input": { "startDatetime": "2024-03-01T00:00:00.000Z", "startPrice": 52000, "endDatetime": "2024-05-10T00:00:00.000Z", "endPrice": 60000, "text": "RECTANGLE ZONE" }, "override": { "fontBold": true, "showLabel": true, "lineColor": "rgb(0,113,224)", "horzLabelAlign": "center", "vertLabelAlign": "middle" } } ] } ``` -------------------------------- ### JSON Response Examples (API v2/v3) Source: https://doc.chart-img.com/index These examples illustrate the JSON structure of error responses for different status codes in API v2 and v3. They cover scenarios like invalid requests, forbidden access, and server errors. ```json { "message": "Invalid Request" } ``` ```json { "message": "Forbidden" } ``` ```json { "message": "Layout Forbidden" } ``` ```json { "message": "Exceed Max Usage Resolution Limit (800x600)" } ``` ```json { "message": "Exceed Max Usage Parameter Limit (3)" } ``` ```json { "message": "Session Disconnected" } ``` ```json [ { "value": "INVALID", "msg": "must be a valid tradingview EXCHANGE:SYMBOL", "param": "symbol", "location": "body" }, { "value": "INVALID", "msg": "must be a supported interval", "param": "interval", "location": "body" } ] ``` ```json { "message": "Invalid Symbol" } ``` ```json { "message": "Invalid Interval" } ``` ```json { "message": "Too Many Requests" } ``` ```json { "message": "Limit Exceeded" } ``` ```json { "message": "Something Went Wrong" } ``` ```json { "message": "External Request Timeout" } ``` ```json { "message": "Endpoint request timed out" } ``` -------------------------------- ### API v3 Authentication Source: https://doc.chart-img.com/index API v3 offers flexible authentication. For POST requests, use the `x-api-key` header. For GET requests, you can use either the `x-api-key` header or the `key` query parameter. ```APIDOC ## API v3 Authentication For authenticated requests, a personal API key must be included in the `POST` request header `x-api-key`. For `GET` requests, the API key can be included in either the request header or as a query parameter named `key`. * **`POST`/`GET` Header `x-api-key`**: `YOUR_API_KEY` * **`GET` Query Parameter**: `?key=YOUR_API_KEY` ``` -------------------------------- ### Configure Rate of Change Chart Source: https://doc.chart-img.com/index This example demonstrates the configuration for the Rate of Change (ROC) indicator. It specifies the input length and various override options for the ROC line, including its width, type, color, and zero line properties. ```json { "height": 300, "theme": "dark", "override": { "showMainPane": false }, "studies": [ { "name": "Rate Of Change", "forceOverlay": false, "input": { "in_0": 9 }, "override": { "ROC.linewidth": 1, "ROC.plottype": "line", "ROC.color": "rgb(33,150,243)", "Zero Line.visible": true, "Zero Line.linestyle": 2, "Zero Line.linewidth": 1, "Zero Line.value": 0, "Zero Line.color": "rgb(120,123,134)" } } ] } ``` -------------------------------- ### Short Position Drawing Configuration Source: https://doc.chart-img.com/index Configures a 'Short Position' drawing on a chart. Requires start and end datetimes, entry price, target price, and stop price. Optional parameters allow customization of appearance and behavior. ```json { "height": 400, "theme": "dark", "interval": "4h", "range": { "from": "2023-01-20T00:00:00.000Z", "to": "2023-02-12T00:00:00.000Z" }, "drawings": [ { "name": "Short Position", "input": { "startDatetime": "2023-02-08T00:00:00.000Z", "endDatetime": "2023-02-15T00:00:00.000Z", "entryPrice": 23400, "targetPrice": 21800, "stopPrice": 23800 } } ] } ``` -------------------------------- ### Save TradingView Advanced Chart to Storage (curl) Source: https://doc.chart-img.com/index This command-line example demonstrates how to save a TradingView advanced chart to public storage using the Chart-Img API. It requires an API key and sends a JSON payload with chart details and studies. The output is saved to a JSON file. ```bash curl -X POST https://api.chart-img.com/v2/tradingview/advanced-chart/storage \ -H "x-api-key: YOUR_API_KEY" \ -H "content-type: application/json" \ -d "{\"symbol\":\"OTC:GBTC\",\"theme\":\"dark\",\"studies\":[{\"name\":\"Bollinger Bands\"},{\"name\":\"Volume\"},{\"name\":\"Relative Strength Index\"}]}" \ -o chart-img-01.json ``` -------------------------------- ### Configure Know Sure Thing Study Source: https://doc.chart-img.com/index This snippet demonstrates the configuration for the Know Sure Thing (KST) study. It includes input parameters for calculating the KST values and override options for customizing the appearance of the KST plot, signal line, and zero line. ```json { "height": 300, "theme": "dark", "override": { "showMainPane": false }, "studies": [ { "name": "Know Sure Thing", "forceOverlay": false, "input": { "in_0": 10, "in_1": 15, "in_2": 20, "in_3": 30, "in_4": 10, "in_5": 10, "in_6": 10, "in_7": 15, "in_8": 9 }, "override": { "KST.visible": true, "KST.linewidth": 1, "KST.plottype": "line", "KST.color": "rgb(8,153,129)", "Signal.visible": true, "Signal.linewidth": 1, "Signal.plottype": "line", "Signal.color": "rgb(242,54,69)", "Zero.visible": true, "Zero.linestyle": 2, "Zero.linewidth": 1, "Zero.value": 0, "Zero.color": "rgb(120,123,134)" } } ] } ``` -------------------------------- ### Arrow Marker Drawing Request Example Source: https://doc.chart-img.com/index This JSON object shows a request for an 'Arrow Marker' drawing. It defines the start and end points for the arrow using datetimes and prices, and includes an optional text label. Customization options in the 'override' object include font size, boldness, italics, and colors for text and the arrow itself. ```json { "height": 400, "theme": "dark", "drawings": [ { "name": "Arrow Marker", "input": { "startDatetime": "2022-12-05T00:00:00.000Z", "startPrice": 20600, "endDatetime": "2023-01-08T00:00:00.000Z", "endPrice": 17600, "text": "Big Arrow!" }, "override": { "fontSize": 18 } } ] } ``` -------------------------------- ### Ease of Movement Request Example (JSON) Source: https://doc.chart-img.com/index This JSON object configures the Ease of Movement (EoM) study. It specifies the study name, input parameters for divisor and length, and allows overriding plot properties. The `forceOverlay` parameter is set to false, indicating it should not overlay on the main price chart. ```JSON { "height": 300, "theme": "dark", "override": { "showMainPane": false }, "studies": [ { "name": "Ease of Movement", "forceOverlay": false, "input": { "in_0": 10000, "in_1": 14 }, "override": { "Plot.linewidth": 1, "Plot.plottype": "line", "Plot.color": "rgb(67,160,71)" } } ] } ``` -------------------------------- ### Configure Baseline Chart Style Source: https://doc.chart-img.com/index This snippet illustrates the configuration for the Baseline chart style. It includes parameters for line widths, base level percentage, transparency, and colors for the baseline, top, and bottom fills. The 'style' parameter must be set to 'baseline'. ```json { "style": "baseline", "theme": "dark", "height": 300, "override": { "style": { "baselineStyle.topLineWidth": 2, "baselineStyle.bottomLineWidth": 2, "baselineStyle.baseLevelPercentage": 50, "baselineStyle.transparency": 50, "baselineStyle.baselineColor": "rgb(117,134,150)", "baselineStyle.topLineColor": "rgb(8,153,129)", "baselineStyle.topFillColor1": "rgba(8,153,129,0.3)", "baselineStyle.topFillColor2": "rgba(8,153,129,0.1)", "baselineStyle.bottomLineColor": "rgb(242,54,69)", "baselineStyle.bottomFillColor1": "rgba(242,54,69,0.1)", "baselineStyle.bottomFillColor2": "rgba(242,54,69,0.3)", "baselineStyle.priceSource": "close" } } } ``` -------------------------------- ### Configure Detrended Price Oscillator Study Source: https://doc.chart-img.com/index This JSON configuration sets up the Detrended Price Oscillator (DPO) study. It specifies the study name, input parameters like period and centering, and override options for visual aspects such as line width, plot type, and color. The 'Zero' line's visibility and style can also be customized. ```json { "height": 300, "theme": "dark", "override": { "showMainPane": false }, "studies": [ { "name": "Detrended Price Oscillator", "forceOverlay": false, "input": { "in_0": 21, "in_1": false }, "override": { "DPO.linewidth": 1, "DPO.plottype": "line", "DPO.color": "rgb(67,160,71)", "Zero.visible": true, "Zero.linestyle": 2, "Zero.linewidth": 1, "Zero.value": 0, "Zero.color": "rgb(120,123,134)" } } ] } ``` -------------------------------- ### GET /v3/tradingview/exchange/ Source: https://doc.chart-img.com/index Retrieves symbols for a specific TradingView exchange. You can filter the results by symbol name or type. ```APIDOC ## GET /v3/tradingview/exchange/ ### Description Retrieves symbols for a specific TradingView exchange. You can filter the results by symbol name or type. ### Method GET ### Endpoint /v3/tradingview/exchange/ ### Parameters #### Path Parameters - **EXCHANGE_ID** (String) - Required - tradingview exchange ID #### Query Parameters - **symbol** (String) - Optional - filter by exchange symbol - **type** (String) - Optional - filter by exchange symbol type [`spot`, `swap`, `futures`, `index`, `stock`, `fund`, ...] exchange dependent ### Request Header - **x-api-key** (String) - Required - authentication API access key ### Response #### Success Response (200) - **updatedAt** (DateTime (ISO8601) / null) - when the payload is last updated - **payload** (Object[] / null) - list of tradingview exchange symbols #### Response Example ```json { "updatedAt": "2024-07-08T00:00:32.448Z", "payload": [ { "symbol": "BTCUSDT", "description": "Bitcoin / TetherUS", "type": "spot", "exchange": "BINANCE", "currency_code": "USDT", "currency-logoid": "crypto/XTVCUSDT", "base-currency-logoid": "crypto/XTVCBTC", "provider_id": "binance", "source2": { "id": "BINANCE", "name": "Binance", "description": "Binance" }, "source_id": "BINANCE", "typespecs": ["crypto"] }, ... ] } ``` ``` -------------------------------- ### Generate TradingView Mini Chart (curl) Source: https://doc.chart-img.com/index This command-line snippet demonstrates how to fetch a TradingView mini chart image using curl. It requires an API key and allows customization of symbol and interval. ```bash curl -G https://api.chart-img.com/v1/tradingview/mini-chart \ -H "Authorization: Bearer YOUR_API_KEY" \ -d "symbol=BINANCE:ETHUSDT" \ -d "interval=3M" \ -o chart-img.png ``` -------------------------------- ### GET /v1/tradingview/advanced-chart Source: https://doc.chart-img.com/index Captures a TradingView advanced chart image with various customization options including indicators and studies. ```APIDOC ## GET /v1/tradingview/advanced-chart ### Description Captures a TradingView advanced chart image. Allows customization of interval, dimensions, symbols, and technical studies. ### Method GET ### Endpoint /v1/tradingview/advanced-chart ### Parameters #### Query Parameters - **interval** (String) - Optional - The chart interval (e.g., `4h`, `1h`). - **height** (Integer) - Optional - Default: `220` - The height of the chart image in pixels (Min: `220`). - **width** (Integer) - Optional - Default: `350` - The width of the chart image in pixels (Min: `320`). - **symbol** (String) - Optional - The TradingView symbol (e.g., `BITSTAMP:ETHUSD`, `BINANCE:ADAUSDT`). Can be specified multiple times for multiple symbols. - **studies** (String) - Optional - The technical studies or indicators to display (e.g., `BB`, `RSI`, `MACD`, `EMA:12`). Can be specified multiple times for multiple studies. - **theme** (String) - Optional - Default: `dark` - The chart theme color. Allowed values: [`light`, `dark`]. - **format** (String) - Optional - Default: `png` - The chart image format. Allowed values: [`png`, `jpeg`]. ### Request Example 1 (Interval and Height) ```bash curl -G https://api.chart-img.com/v1/tradingview/advanced-chart \ -H "Authorization: Bearer YOUR_API_KEY" \ -d "interval=4h" \ -d "height=300" \ -o chart-img.png ``` ### Request Example 2 (Symbol, Height, and Studies) ```bash curl -G https://api.chart-img.com/v1/tradingview/advanced-chart \ -H "Authorization: Bearer YOUR_API_KEY" \ -d "symbol=BITSTAMP:ETHUSD" \ -d "height=300" \ -d "studies=BB" \ -o chart-img.png ``` ### Request Example 3 (Interval and Multiple Studies) ```bash curl -G https://api.chart-img.com/v1/tradingview/advanced-chart \ -H "Authorization: Bearer YOUR_API_KEY" \ -d "interval=1h" \ -d "studies=RSI" \ -d "studies=MACD" \ -o chart-img.png ``` ### Request Example 4 (Height, Multiple EMA Studies, and Symbol) ```bash curl -G https://api.chart-img.com/v1/tradingview/advanced-chart \ -H "Authorization: Bearer YOUR_API_KEY" \ -d "height=300" \ -d "studies=EMA:12" \ -d "studies=EMA:26" \ -d "symbol=BINANCE:ADAUSDT" \ -o chart-img.png ``` ### Response #### Success Response (200) Content-Type: `image/png`, `image/jpeg` - The response body will be the image file itself. #### Response Example (Conceptual) (The actual response is an image file, not JSON) ``` -------------------------------- ### GET /v1/tradingview/mini-chart Source: https://doc.chart-img.com/index Generates a mini TradingView chart image. You can customize the symbol, interval, theme, dimensions, and format. ```APIDOC ## GET /v1/tradingview/mini-chart ### Description Generates a mini TradingView chart image with various customization options. ### Method GET ### Endpoint /v1/tradingview/mini-chart ### Parameters #### Query Parameters - **symbol** (String) - Optional - Default: `BINANCE:BTCUSDT` - The TradingView symbol (e.g., `BINANCE:ETHUSDT`). - **interval** (String) - Optional - Default: `1M` - The chart interval. Allowed values: [`1D`, `1M`, `3M`, `1Y`, `5Y`, `ALL`]. - **theme** (String) - Optional - Default: `dark` - The chart theme color. Allowed values: [`light`, `dark`]. - **width** (Integer) - Optional - Default: `350` - The width of the chart image in pixels (Min: `320`). - **height** (Integer) - Optional - Default: `220` - The height of the chart image in pixels (Min: `220`). - **format** (String) - Optional - Default: `png` - The chart image format. Allowed values: [`png`, `jpeg`]. - **watermark** (String) - Optional - For `ULTRA` and `ENTERPRISE` plans only. Sets a custom watermark. - **watermarkSize** (Integer) - Optional - Default: `16` - The size of the watermark text. Allowed values: [`16`, `32`, `64`, `128`]. - **watermarkOpacity** (Float) - Optional - Default: `1.0` - The opacity of the watermark text (Min: `0.1`, Max: `1.0`). ### Request Example ```bash curl -G https://api.chart-img.com/v1/tradingview/mini-chart \ -H "Authorization: Bearer YOUR_API_KEY" \ -d "symbol=BINANCE:ETHUSDT" \ -d "interval=3M" \ -o chart-img.png ``` ### Response #### Success Response (200) Content-Type: `image/png`, `image/jpeg` - The response body will be the image file itself. #### Response Example (Conceptual) (The actual response is an image file, not JSON) ``` -------------------------------- ### Configure MACD Study Source: https://doc.chart-img.com/index This snippet demonstrates the configuration for the MACD (Moving Average Convergence Divergence) study. It includes general chart settings, study-specific inputs for fast length, slow length, signal length, and source, as well as overrides for the histogram and MACD/Signal lines. ```json { "height": 300, "theme": "dark", "override": { "showMainPane": false }, "studies": [ { "name": "MACD", "forceOverlay": false, "input": { "in_0": 12, "in_1": 26, "in_2": 9, "in_3": "close" }, "override": { "Histogram.visible": true, "Histogram.plottype": "columns", "Histogram.color.0": "rgb(34,171,148)", "Histogram.color.1": "rgb(172,229,220)", "Histogram.color.2": "rgb(252,203,205)", "Histogram.color.3": "rgb(255,82,82)", "MACD.visible": true, "MACD.linewidth": 1, "MACD.plottype": "line", "MACD.color": "rgb(33,150,243)", "Signal.visible": true, "Signal.linewidth": 1, "Signal.plottype": "line", "Signal.color": "rgb(255,109,0)" } } ] } ``` -------------------------------- ### GET /v3/tradingview/exchange/list Source: https://doc.chart-img.com/index Retrieves a list of available TradingView exchange IDs. This endpoint is useful for discovering which exchanges are supported by the API. ```APIDOC ## GET /v3/tradingview/exchange/list ### Description Retrieves a list of available TradingView exchange IDs. ### Method GET ### Endpoint /v3/tradingview/exchange/list ### Parameters #### Query Parameters - **key** (String) - Required - Your API access key. ### Request Header - **x-api-key** (String) - Required - authentication API access key ### Response #### Success Response (200) - **updatedAt** (DateTime (ISO8601) / null) - when the payload is last updated - **payload** (String[] / null) - list of tradingview exchange ids #### Response Example ```json { "updatedAt": "2024-07-08T00:00:00.106Z", "payload": [ "ACTIVTRADES", "ADX", "AFTERPRIME", "AMEX", "ASX", ... ] } ``` ``` -------------------------------- ### Configure Envelopes Study for Chart Image Source: https://doc.chart-img.com/index This snippet demonstrates how to configure the Envelopes study for a chart image. It includes input parameters like length, percentage values, method, and source, as well as override options for plot visibility, line width, type, and color for the average, upper, and lower bands, and plot background. ```json { "height": 300, "theme": "dark", "studies": [ { "name": "Envelopes", "input": { "in_0": 20, "in_1": 2, "in_2": 2, "in_3": "Simple", "in_4": "close" }, "override": { "Average.visible": true, "Average.linewidth": 1, "Average.plottype": "line", "Average.color": "rgb(255,109,0)", "Upper.visible": true, "Upper.linewidth": 1, "Upper.plottype": "line", "Upper.color": "rgb(33,150,243)", "Lower.visible": true, "Lower.linewidth": 1, "Lower.plottype": "line", "Lower.color": "rgb(33,150,243)", "Plots Background.visible": true, "Plots Background.color": "rgba(33,150,243,0.1)" } } ] } ``` -------------------------------- ### GET /v1/tradingview/mini-chart/storage Source: https://doc.chart-img.com/index Saves a TradingView mini chart image to public storage. The response provides a URL to the stored image. ```APIDOC ## GET /v1/tradingview/mini-chart/storage ### Description Saves a TradingView mini chart image to public storage and returns a URL to access it. This is useful for publishing charts globally. ### Method GET ### Endpoint /v1/tradingview/mini-chart/storage ### Parameters #### Query Parameters - **symbol** (String) - Optional - Default: `BINANCE:BTCUSDT` - The TradingView symbol (e.g., `BINANCE:ETHUSDT`). - **interval** (String) - Optional - Default: `1M` - The chart interval. Allowed values: [`1D`, `1M`, `3M`, `1Y`, `5Y`, `ALL`]. - **theme** (String) - Optional - Default: `dark` - The chart theme color. Allowed values: [`light`, `dark`]. - **width** (Integer) - Optional - Default: `350` - The width of the chart image in pixels (Min: `320`). - **height** (Integer) - Optional - Default: `220` - The height of the chart image in pixels (Min: `220`). - **format** (String) - Optional - Default: `png` - The chart image format. Allowed values: [`png`, `jpeg`]. - **watermark** (String) - Optional - For `ULTRA` and `ENTERPRISE` plans only. Sets a custom watermark. - **watermarkSize** (Integer) - Optional - Default: `16` - The size of the watermark text. Allowed values: [`16`, `32`, `64`, `128`]. - **watermarkOpacity** (Float) - Optional - Default: `1.0` - The opacity of the watermark text (Min: `0.1`, Max: `1.0`). *Note: The query parameters are identical to the `/v1/tradingview/mini-chart` endpoint.* ### Request Example ```bash curl -G https://api.chart-img.com/v1/tradingview/mini-chart/storage \ -H "Authorization: Bearer YOUR_API_KEY" \ -d "symbol=BINANCE:ETHUSDT" \ -d "interval=3M" \ -o chart-img.json ``` ### Response #### Success Response (200) Content-Type: `application/json` - **url** (String) - URL of the public chart image. - **size** (Integer) - Size of the image in bytes. - **cors** (String / null) - Cross-origin resource sharing allowed domains. - **etag** (String) - The ETag associated with the image upload. - **expireAt** (String / null) - The expiration date of the image. - **createdAt** (String) - The date and time when the image was first uploaded. #### Response Example ```json { "url": "https://api.chart-img.com/v1/storage/pub/72d37da3-a1d5-4023-8c18-68cc56399bde.png", "size": 15228, "cors": "*", "etag": "8e6cd2843019311950b93e7f4ee64d61", "expireAt": "2022-08-07T13:21:59.815Z", "createdAt": "2022-06-08T13:22:00.098Z" } ``` ``` -------------------------------- ### Parameter Limits Source: https://doc.chart-img.com/index Starting from API v2, the maximum number of study and drawing objects per request is dependent on your plan. ```APIDOC ## Parameter Limit Starting API v2, the maximum number of parameter objects per request for studies and drawings will depend on your plan. | Plan | Max studies[] + drawings[] | |----------|----------------------------| | BASIC | 3 | | PRO | 5 | | MEGA | 10 | | ULTRA | 25 | | ENTERPRISE | 50 | ``` -------------------------------- ### Configure Bollinger Bands %B Study Source: https://doc.chart-img.com/index This JSON configuration sets up the 'Bollinger Bands %B' indicator, allowing adjustments to its length and multiplier inputs. It also provides extensive override options for the main plot, upper/lower limits, and background coloring. ```json { "height": 300, "theme": "dark", "override": { "showMainPane": false }, "studies": [ { "name": "Bollinger Bands %B", "forceOverlay": false, "input": { "in_0": 20, "in_1": 2 }, "override": { "Plot.plottype": "line", "Plot.color": "rgb(34,171,148)", "UpperLimit.visible": true, "UpperLimit.linestyle": 2, "UpperLimit.linewidth": 1, "UpperLimit.value": 1, "UpperLimit.color": "rgb(120,123,134)", "LowerLimit.visible": true, "LowerLimit.linestyle": 2, "LowerLimit.linewidth": 1, "LowerLimit.value": 0, "LowerLimit.color": "rgb(120,123,134)", "Hlines Background.visible": true, "Hlines Background.color": "rgba(38,166,154,0.1)" } } ] } ``` -------------------------------- ### GET /v1/tradingview/advanced-chart Source: https://doc.chart-img.com/index Retrieves an advanced trading chart image based on specified parameters. Supports various symbols, intervals, studies, and styling options. ```APIDOC ## GET /v1/tradingview/advanced-chart ### Description Retrieves an advanced trading chart image based on specified parameters. Supports various symbols, intervals, studies, and styling options. ### Method GET ### Endpoint /v1/tradingview/advanced-chart ### Parameters #### Query Parameters - **symbol** (String) - Optional - `BINANCE:BTCUSDT` - Set tradingview symbol. - **height** (Integer) - Optional - `600` - Set chart image height in pixels (Min: `220`). - **studies** (String[]) - Optional - Set tradingview chart to include indicators. - **interval** (String) - Optional - `1D` - Set tradingview chart interval* [`1m`, `3m`, `5m`, `15m`, `30m`, `45m`, `1h`, `2h`, `3h`, `4h`, `1D`, `1W`, `1M`, `3M`, `6M`, `1Y`] exchange dependent. - **theme** (String) - Optional - `dark` - Set tradingview chart theme color [`light`, `dark`]. - **timezone** (String) - Optional - `Etc/UTC` - Set tradingview chart timezone. - **width** (Integer) - Optional - `800` - Set chart image width in pixels (Min: `320`). - **format** (String) - Optional - `png` - Set chart image format [`png`, `jpeg`]. - **style** (String) - Optional - `candle` - Set chart style [`bar`, `candle`, `line`, `area`, `heikinAshi`, `hollowCandle`]. - **range** (String) - Optional - Set chart interval range [`1D`, `5D`, `1M`, `3M`, `6M`, `YTD`, `1Y`, `5Y`, `ALL`] override `interavl`. - **logo** (Boolean) - Optional - `true` - Set chart symbol logo. - **watermark** (String) - Optional - Set custom watermark for `ULTRA` and `ENTERPRISE` plans. - **watermarkSize** (Integer) - Optional - `16` - Set watermark text size [`16`, `32`, `64`, `128`]. - **watermarkOpacity** (Float) - Optional - `1.0` - Set watermark text opacity (Min: `0.1`, Max: `1.0`). ### Request Example ``` https://api.chart-img.com/v1/tradingview/advanced-chart?height=500&symbol=COINBASE:BTCUSD&interval=4h&studies=CCI:20,hlc3&key=YOUR_API_KEY ``` ### Response #### Success Response (200) - **image/png** (image/png) - The generated chart image in PNG format. - **image/jpeg** (image/jpeg) - The generated chart image in JPEG format. - **application/json** (application/json) - An error message if the request fails. ``` -------------------------------- ### Date Range Drawing Source: https://doc.chart-img.com/index This endpoint allows you to draw a date range on the chart. You can specify the start and end datetimes and prices, along with various override options for appearance. ```APIDOC ## POST /websites/doc_chart-img ### Description Draws a date range on the chart with customizable appearance. ### Method POST ### Endpoint /websites/doc_chart-img ### Parameters #### Request Body - **height** (Integer) - Required - The height of the chart image. - **theme** (String) - Optional - The theme of the chart (e.g., 'dark'). - **drawings** (Array) - Required - An array of drawing objects. - **name** (String) - Required - The name of the drawing type. For this endpoint, it should be 'Date Range'. - **input** (Object) - Required - Input data for the drawing. - **startDatetime** (DateTime ISO8601) - Required - The start datetime of the range. - **startPrice** (Float) - Required - The start price of the range. - **endDatetime** (DateTime ISO8601) - Required - The end datetime of the range. - **endPrice** (Float) - Required - The end price of the range. - **override** (Object) - Optional - Override parameters for the drawing's appearance. - **fontSize** (Integer) - Optional - Font size for labels (Min: 10, Max: 250). - **lineWidth** (Integer) - Optional - Line width (Min: 1, Max: 100). - **transparency** (Integer) - Optional - Background transparency (Min: 0, Max: 100). - **fillBackground** (Boolean) - Optional - Whether to fill the background. - **fillLabelBackground** (Boolean) - Optional - Whether to fill the label background. - **extendTop** (Boolean) - Optional - Whether to extend the top line. - **extendBottom** (Boolean) - Optional - Whether to extend the bottom line. - **zOrder** (String) - Optional - The drawing's order in the z-axis ('top' or 'bottom'). ### Request Example ```json { "height": 400, "theme": "dark", "drawings": [ { "name": "Date Range", "input": { "startDatetime": "2023-01-01T00:00:00.000Z", "startPrice": 16333, "endDatetime": "2023-02-09T00:00:00.000Z", "endPrice": 18000 }, "override": { "fontSize": 16, "extendTop": true, "extendBottom": true }, "zOrder": "top" } ] } ``` ### Response #### Success Response (200) - **imageUrl** (String) - The URL of the generated chart image. #### Response Example ```json { "imageUrl": "https://example.com/charts/generated_chart.png" } ``` ``` -------------------------------- ### Configure Bollinger Bands Width Study Source: https://doc.chart-img.com/index This snippet shows how to configure the Bollinger Bands Width study. It includes input parameters for length and multiplier, and override options for plot type and color. The input parameters have defined minimum and maximum values. ```json { "height": 300, "theme": "dark", "override": { "showMainPane": false }, "studies": [ { "name": "Bollinger Bands Width", "forceOverlay": false, "input": { "in_0": 20, "in_1": 2 }, "override": { "Plot.plottype": "line", "Plot.color": "rgb(255,109,0)" } } ] } ``` -------------------------------- ### Generate TradingView Chart (curl - Windows) Source: https://doc.chart-img.com/index This snippet demonstrates how to generate a TradingView advanced chart using curl on Windows. It merges multi-line commands into a single line by removing backslashes. The command specifies the API endpoint, authorization token, symbol, height, and studies to include. ```bash curl -G https://api.chart-img.com/v1/tradingview/advanced-chart -H "Authorization: Bearer YOUR_API_KEY" -d "symbol=BINANCE:ADAUSDT" -d "height=300" -d "studies=EMA:12" -d "studies=EMA:26" -o chart-img.png ``` ```bash curl -G https://api.chart-img.com/v1/tradingview/advanced-chart -H "Authorization: Bearer YOUR_API_KEY" -d "symbol=COINBASE:BTCUSD" -d "height=500" -d "interval=4h" -d "studies=CCI:20,hlc3" -o chart-img.png ```