When you script an alert in Pinescript (Tradingview) you can have it point outward toward a webhook address, or you can send it to an email address. I don't think the potential of email alerts has been explored enough. So i've recently began to experiment with it. The potential to handle incoming email is fully exploited with Microsoft Outlook (so this is for 365 subscribers). But Tradingview won't send alerts to an Outlook address. So instead you just send the alert to your regular Gmail address and use a filter in Gmail to forward specific incoming to any other address you want. I haven't done any tests yet on the latency this might add, compared to a webhook...but the forwarding process generally gets done within 15 seconds with everything, including my laptop, going through my phone as a hotspot. So this might be too slow for some kind of high frequency trading, but plenty for others. Faster connections might work better. Once into Outlook, then VBA script can take over the monitor of incoming, the reading, and the execution of any other applications needed to execute trades. One way to execute trades is to have VBA Outlook start communicating with Excel. Through Excel you can communicate with your broker if they offer an API. Another way to execute trades is to open a third party app like AutoIt, which will take any kind of parameter as input (while the app is being called). The interesting thing about calling an app like this is you can now place trades through the manipulation of a GUI, in the case you don't have any API to work through. This method is especially needed for example, for US customers of funded accounts like The5ers who recently had to restrict it's US customers from using MT5, and moved them over to a web based app which does not offer any kind of API access. Therefor there are not even any webhook services that could help automate anything. Through something like AutoIt, you can exploit send-keys (such as TAB navigation) as well as mouse-clicks to any coordinates on your screen. There isn't a single GUI that you could not throughput pretty much any kind of trade that they offered. It gets tricky when you can't interrogate the GUI for any information about price, or open positions, or pending positions, or whether the trade you wished to open was actually opened. Still, you could get something going if you can closely match the price data source for the GUI with the many sources available on Tradingview. Recently i asked The5ers for info about the data sources for the symbols that they offer. Found out it is either Oanda or FXCM. Working with a GUI could also help if you want to trade through Tradingview itself. You see, just because they have connections between their platform and many brokers, it doesn't mean it is automated. A "Strategy" won't communicate. It all still manual trading. So too with "Paper Trading" through Tradingview.
This seems extremely complicated to execute an automated trading system. Have you tried any of the trading platforms optimized for automated trading? - TradeStation, NinjaTrader, MetaTrader 4, or MetaTrader 5 You can download this software on our servers and it will run 24/7. The software will execute the trades for you with the click of a button.
I feel the email method of sending alerts out of Tradingview is as simple, but probably simpler, than the webhooks method. So if webhooks is superior, in any way, than say, working directly within TradeStation, Ninja, or MetaTrader (in their own languages), then the same would go for email alerts. I've looked closely at MetaTrader, and did begin going down that path, but stopped, once it dawned on me the potential of PineScript as it is closely tied with what i would say is the webs leading charting service, Tradingview. It turns out that with a special listening robot (EA) installed in MetaTrader, you can communicate with Pinescript alerts, and execute trades to any broker that allows use of MetaTrader. It this doesn't add much latency, then you can just work with one language, Pinescript, for all those brokers. But with the SEC clampdown on MetaTrader, disallowing it's use with a plethora of offshore brokers, the number of markets you can reach with MetaTrader has been severely curtailed recently, and wasn't universal to begin with. Most crypto exchanges, for example, do not work with MetaTrader, simply offering an API instead. There are, however, third party softwares that will integrate MetaTrader with crypto exchanges...but not all. I have worked with TradeStation's EasyLanguage going all the way back to 2008 or so, having written my own robot based on info existing right here on EliteTrader. That was a positive experience. Ok, so with EasyLanguage you can work with any market that Tradestation offers, which is now significantly more than it did in 2008. Which is fine if the only markets you want to, or need to work with are offered by Tradestation. But i am gravitating toward universality, reaching every market, every broker, with one language, and one charting display. I realized you can do that with Pinescript. Take Tradestation for example. It is now connected with Tradingview such that you can trade manually through the TradingView platform. No doubt, all of TradeStations markets/symbols can be displayed through TradingView charts , as are all symbols offered by every broker that is connected with TradingView. It they can be displayed, then you can run Pinescript on them. The problem, in this case, is it's manual, meaning, you can write a "strategy", but there is still no way to automate the strategy with TradeStation (and every other broker connected to TradingView). But if there was a way to automate this, then you could emphasize work with just the one language, Pinescript, instead of two languages. Again, latency might be an issue, in which case sure, translate your Pinescript to Easylanguage. I checked to see what kind of API Tradingview was offering to the public, but do not find anything. So, for now, it appears that if you want to automate through Tradingview, it has to be done through the GUI, which is best handled by something like AutoIt. The good news is that once that is handled, then you can handle any broker, or exchange (ie. Binance) that is connected with Tradingview. The work is setting up AutoIt to handle whatever GUI is out there. Or setting up Excel (or other app) to work directly with whatever APIs are out there on offer. Attached find debugged test code that handles incoming email to Outlook Classic. OutlookSession is code that lives in "ThisOutlookSession" within Outlook. Also find code, OutlookToExcel, that lives in a regular VBA module, still within Outlook. This code demonstrates how to manipulate Excel from within Outlook, feeding Excel with info/instructions gleaned from reading specific incoming emails.
P.S. - The code in the attachments above works like this: OutlookSession triggers on startup of Outlook Classic and lives, listening to all email coming in. For each email incoming, it reads both subject line and body looking for keywords. If it finds the keywords, it will grab the attachment of the email, which will be an Excel file, and save it to disk. Then it calls on an executive routine, in OutlookToExcel, to open that Excel file on disk, copy a section, open another Excel file, and paste the copied section into the other Excel file. This scenario assumes you have trading instructions on your own disk, in your own Excel file, which can be distributed to any number of recipients, who, if they have this code in Outlook Classic, expecting email from you, can trigger orders to be sent through their own Excel app. An alert from Tradingview won't contain any Excel files as attachments but the principle is the same. The body of the email can be sent as a parameter when opening an AutoIt app (if working with a GUI). Or, after opening an Excel file, the body can be included as an argument (as a string, for example, as JSON) in an executive macro. Excel is able to work with any REST API available. Or, work with any language in Visual Studio to develop an executable that will take the body as a parameter and work with a REST API. The advantage of that is there is a ton of good reusable code available that will help you work with just about any REST API via any language available in Visual Studio public archives.
Why not just trade directly? TradingView offers integrations with brokers, so wouldn't it be simpler to use those instead of going through the whole email auto-pain-my-ass forwarding and automation process?
Those integrations only go so far as manual trading. There is a still no direct communication between a 'strategy" and those integrations. It's not automated as of this writing. So what does a strategy do that an "indicator" doesn't? A strategy offers more statistics (charted stats too) if/when you run it through the strategy tester. But you can also get an indicator to offer statistics, and also have an indicator send out alerts to webhooks or to email. But neither a strategy nor an indicator will invoke, directly, any buy or sell on/with any of the integrated brokers. Nor does Tradingview offer an API open to the public that will effect a buy or sell. So GUI is the only interface left, hence email to something like AutoIt. This makes Tradingview's intermittent trading contests interesting as all contestants are presumably trading manually.
Thanks for the development tip. In other developments I noticed that Outlook Classic will handle your GMail account so there might not be a need to forward to an Outlook address. Haven't tested this though.
That's interesting. Do you happen to know why they haven't made direct integration possible for automated trading through scripts? It seems a bit odd to offer integration for manual trading but not for scripts like Pine Script.
I tried to find out but that trail petered out. Pines Script has been developing, getting incrementally better and better. Maybe they are just not there yet and need to prioritize.