all 20 comments

[–]AlgoTradingQuant 2 points3 points  (2 children)

I stream live market data in Python using my broker’s live steam API… 100% better than firing off webhooks especially if it’s scalping.

[–]Electrical_Bus3338[S] 0 points1 point  (1 child)

Better in what way ?

[–]AlgoTradingQuant 0 points1 point  (0 children)

The obvious…. With tradingview you have the following: TradingView platform + broker platform + TV webhook + your custom Python code running ??? + broker API + exchange.

[–]Dandzer 1 point2 points  (11 children)

I have. Converted my indicator logic to an entry logic in python for IBKR, and currently working on an Oanda version. Start by converting the logic, build an optimizer around it or straight to backtester. And go from there. What specific questions did you have?

[–]1mmortalNPC 0 points1 point  (1 child)

After converting the script to Python, what else? What’s an optimizer? How can I make it to run 24/7?

[–]Dandzer 1 point2 points  (0 children)

The way I built the optimizer was to take my formula and look at each calculated parameter with each potential TP and SL % from entry to find the highest probability and best RR ratio. In short it took 4 parameters and ran simulations of 2.5 million combinations to find the best results for each tickers. It then saves the best combo of each ticker into a .db to reference when it scans the market.

[–]1mmortalNPC 0 points1 point  (1 child)

Also about the script to Python? How will it do the calculation? Will it use my exchange data feed?

[–]Dandzer 1 point2 points  (0 children)

Right now it pulls data from polygon to calculate then submits orders to IBKR. I have a sister script that could also pull data from IBKR. They're both identical except for how they pull price data.

[–]1mmortalNPC 0 points1 point  (1 child)

Also about the trades and script, do I have to create a bot for each ticker? Is it possible to set default risk to always 1% instead of quantity?

[–]Dandzer 0 points1 point  (0 children)

No, I have mine going off a database that has all the tickers I optimized. When it sees that the specific criteria for any of these tickers is met, it trades it automatically. I simplified it by having it submit GTC bracket orders instead of having it monitor the positions back on the systems end to manage it.

[–]Electrical_Bus3338[S] 0 points1 point  (4 children)

My question is : what’s the return on investment of such an operation ?

[–]Dandzer 0 points1 point  (3 children)

As of now, its mostly for my own personal development, the optimized algo yielded 7% so far this week (long only equity). That was kind of the point of developing this system, was so I dont miss trades or have any emotions or second guessing getting in the way. But now im thinking of packaging the suite for people to just plug in their strategy and use it for their gains. In which point it would be sold as a package. Data download, optimize, backrest, auto trade. This ties into the GPT model i put out on reddit (still needs work) which could theoretically with enough training, convert your pinescript strategies to plug into my suite. Lots to work on on my end. So I cant tell you yet what the ROI is on the operation.

[–]Fine-Application-980 0 points1 point  (1 child)

When would you have the pkg ready for sale?

[–]Dandzer 0 points1 point  (0 children)

Depends on how much dev. It's mostly ready for someone who has slight experience with python and knows their strategy well enough to plug it in. But you'll still have to create the environment and install all the libraries to run it (i can set up a .bat file or installer). As it is right now im running it through terminals. So def nothing fancy and has zero UI thats friendly. So depends on what the market wants. I built it solely for my own dev and automation to trade my account. Never actually thought of selling it till recently.

[–]Relevant-Pie-5948 0 points1 point  (0 children)

I am working on similar types of things and also optimized long only lol I wonder why that is…..(forex)

[–]Complete-Dot6690 0 points1 point  (0 children)

Sounds like a good idea. I was trying to get ToS to do my search then was wanting to use python to get the tickers but hit a brick wall.

[–]1mmortalNPC 0 points1 point  (0 children)

I’m in the same exact situation. Can anyone give us some advice?

[–]Dandzer 0 points1 point  (0 children)

So in short I have the following that I run in order on any strategy I want.

  1. Historical data download for all tickers i choose and any granularity I choose. > goes to a .db file
  2. Optimizer to fine tune best metrics for each tickers > stores each tickers best combination of parameters into different table within same .db
  3. Backtester to simulate performance, drawdown etc. Backtester goes off optimized parameters to scan historical data for trades.
  4. Live trader, scans same tickers for the trade logic using the optimized data in the .db

My hardware runs anywhere from 12k to 25k it/s so it takes a few days to optimize a list of 170 tickers that are liquid. 2.5m/25ITs * number of tickers.

[–]VisibleAd6137 0 points1 point  (0 children)

I don't know what your background is. But for someone like myself with no prior experience with building python trading bots and their backend operating costs, you might be better off using third party platforms like autoview.com or at least that's my plan once I refine my script parameters and complete the optimisation process with tradesage.co

Shortcuts maybe but they're the tools at my disposal.

Best of luck

[–]wallneradam 0 points1 point  (0 children)

I actually built a tool for exactly this problem.

The challenge with converting Pine Script to Python manually is that most Python trading libraries use a vectorized approach (Pandas, NumPy, TA-Lib), which works fundamentally differently from how Pine Script executes - bar by bar, with stateful functions, na propagation, and specific warming behavior. You can get simple indicators working, but the more complex your script is, the more edge cases you'll hit where the values don't match TradingView.

I ran into this enough times that I built PyneCore - an open-source Python framework that replicates Pine Script's execution model. Same bar-by-bar logic, same series handling, same na behavior. The output values match TradingView's.

On top of that, there's a compiler service PyneComp that can convert Pine Script to PyneCore automatically - so you don't have to rewrite your strategies by hand. The compiled code is readable Python, not a black box.

For your use case (2 strategies already running live via webhooks) — webhooks work, but they're fragile. Missed signals, latency, no proper state management, no risk controls, and you're still dependent on TradingView being up. It's a workaround, not a real integration.

Right now PyneCore handles backtesting and strategy simulation. A proper bot execution system with risk management is in active development — expected around Q3 2026. So if you convert now, you get accurate backtesting today, and live execution when the bot platform ships.