Closed ajayX1 closed 1 year ago
Hi @ajayX1 - could you please attach the CSV files (candle, ema, macd and volume) and I will add an example...
Here is the sample file. I have added more columns than earlier. datetime,open,high,low,close,volume,rvgi1,rvgi2,StochRSI1,StochRSI2,rsi1,rsi2,rsi_ema200,ema20,ema50,ema200,macd_fast,macd_slow,macd_hist datetime,open,high,low,close pane 0, volume mane 0 rvgi1,rvgi2 pane 1 StochRSI1,StochRSI2 pane 2 rsi1,rsi2,rsi_ema200 pane 3 ,macd_fast,macd_slow,macd_hist pane 4 ema20,ema50,ema200 pane0 sample.csv
Done - have a look on example 'Multipane Chart (intraday) from CSV' MultiPaneChartsFromCSV.py Let me know...
And BTW, have a look on dataSamples.py so you have a reference how the JSON fields are required
(that is what the .to_)son
on pandas df does - I rename the fields accordingly to the requirements)
Very Nice Thanks a lot. By now I was managing by executing a react App to plot chart using native lightweightchart.js That needed two webpage to open. Now I can plot chart on same page.
Is it possible to show chart size 1100. If I make chart wider the price scale hide behind some thing. price scale with "₹" and tags. Histogram is also only green. Below is code how I add "₹" in my reactjs lightweight chart:
const MainChartSeries = chart.addCandlestickSeries({ //--------------------Main Chart upColor: '#26A69A', downColor: '#EF5350', borderVisible: false, // title: 'CandleStick OHLC', data: props.candlestickData, priceFormat: { type: "custom", formatter: (price) => "₹" + Number(price).toFixed(2), }, pane: 0 });
Below how I added color Red and Green in my reactjs chart in volume histogram: ` //----------------- Volume Histogram {{{FOR NOW NOT PLOTTING}}} const volumeSeries = chart.addHistogramSeries({ //--------------------Volume Chart color: ({ up, down }) => up === undefined || up ? 'rgba(0, 150, 136, 0.5)' : 'rgba(255, 82, 82, 0.5)', priceFormat: { type: 'volume', }, priceScaleId: '', scaleMargins: { top: 0.6, bottom: 0.1, }, pane: 1,
});
volumeSeries.setData(props.histogramData.map((v, index) => { //--------------------Volume Chart Data
const candle = props.candlestickData[index];
const color = candle && candle.close > candle.open ? 'rgba(0, 150, 136, 0.5)' : 'rgba(255, 82, 82, 0.5)';
return {
...v,
color,
};
}));`
Hi @ajayX1 - great that you can sod what you want Chart size I guess you can set upCSS on the iframe/div container, and for color - I guess you could disable the:
(or any other related)
Closing this ticket, as this is now out-of-scope for this plugin - all the best
Joe Rosa
I am not a coder so please. I am trying to learn and make a analysis chart myself. I have prepared below code to plot candles with overlay ema20 and volume and macd as sub plot. candles plot but volume and MACD chart is blank. Ema also not plot. can you please suggest me the reason and solution:
selected_stock-5minute-candle.csv datetime,open,high,low,close 0,2023-05-02 09:00:00,1022.2,1022.2,1022.2,1022.2 1,2023-05-02 09:05:00,1022.2,1022.2,1020.4,1020.4 2,2023-05-02 09:15:00,1022.05,1032.15,1021.6,1031.35
selected_stock-5minute-ema.csv datetime,ema20 2023-05-02 09:00:00, 2023-05-02 09:05:00, 2023-05-02 09:15:00,
selected_stock-5minute-macd.csv datetime,macd_fast,macd_slow,macd_hist 2023-05-02 09:00:00,,, 2023-05-02 09:05:00,,, 2023-05-02 09:15:00,,, 2023-05-02 09:20:00,,, 2023-05-02 09:25:00,,, 2023-05-02 11:45:00,,, . . . 2023-05-02 11:50:00,5.165247857378063,8.073360673526318,-2.9081128161482557 2023-05-02 11:55:00,4.751474533183455,7.4089834454577455,-2.6575089122742908 2023-05-02 12:00:00,4.309327632083068,6.78905228278281,-2.479724650699742 2023-05-02 12:05:00,3.981613363333963,6.227564498893041,-2.2459511355590775
selected_stock-5minute-volume.csv datetime,volume 0,2023-05-02 09:00:00,4937 1,2023-05-02 09:05:00,2212 2,2023-05-02 09:15:00,210658
def plot_candlestick_chart(selected_stock-5minute-volume, selected_stock-5minute-candle, selected_stock-5minute-ema, selected_stock-5minute-macd, selected_stock, interval):
Read data from CSV file