Hey everyone, I’m working on a trading project and I’m stuck. I’ve got a NodeJS backend and a ReactJS frontend, but I’m trying to figure out how to use PineScript for some of my trading logic.
I’ve tested some indicator code in the TradingView Pine Editor and it works fine there. But now I’m scratching my head on how to use this PineScript stuff on the server-side of my project.
My main goal is to automate trading based on certain indicator values, like RSI ranges. Has anyone done something similar? How did you get PineScript to play nice with a NodeJS backend?
Any tips or examples would be super helpful. Thanks in advance!
I’ve tackled a similar challenge in my own trading project. While PineScript is designed for TradingView, it’s not directly compatible with NodeJS. Instead, I’d recommend translating your PineScript logic into JavaScript.
For indicator calculations like RSI, you can use libraries such as technicalindicators or ta-lib. These provide Node-friendly implementations of common trading indicators.
To automate trading, you’ll need to set up a data feed for real-time market data, then run your indicator calculations on this data in your Node backend. You can use WebSockets to push updates to your React frontend.
For order execution, you’ll need to integrate with a broker’s API. Many brokers offer Node.js SDKs or RESTful APIs for this purpose.
It’s a complex setup, but once you’ve got it running, it’s quite powerful for automated trading strategies.
hey, that sounds like an interesting project! have you considered using a library like technicalindicators for your trading logic instead of pinescript? it might work better with nodejs. what kind of indicators are you trying to implement? i’m curious about how you’re handling real-time data too. do you have any specific questions about setting up the backend or frontend?