Simple Strategy
A TradingView example strategy for firing many alerts to test how automated trading works on TradersPost.
Last updated
A TradingView example strategy for firing many alerts to test how automated trading works on TradersPost.
Last updated
To showcase how to send JSON messages for a strategy from TradingView, we have created this simple strategy that takes very frequent trades and can be tested on the 1 minute chart. It can also be tested on long only, short only, or both directions. Head to this TradingView chart to see the strategy. You can also create an alert from this chart and send the messages to your own webhook URL.
Steps to use it:
Create a strategy on your TradersPost account using the stocks asset class, if you plan to test stocks. Strategies are based on an asset class, so you'll need to make this choice first.
Then subscribe a paper broker to that strategy using a strategy subscription.
There will be default settings when you create the subscription. The settings you'll want to change are:
Auto Submit: On
Sides: Both (Bullish & Bearish)
Entry order type: Market
Exit order type: Market
When the subscription is successfully created, copy the Webhook URL.
Create a new alert on TradingView from the Simple Strategy Chart we provided.
Under condition, choose the Simple Strategy (Both)
It will say Both if the strategy settings are allowing long and short.
The Message will say {{strategy.order.alert_message}}
. Leave this alone the messages will be coming from your strategy settings and this placeholder is used to tell the strategy it should use the internal messages.
Click the Notifications tab and check the box for Webhook URL. Paste in the webhook URL you copied.
Hit Create.
You should now have trades coming in every minute to go long or short or exit those positions. Under your subscriptions tab, you can click the Trades button next to your strategy to see the list of trades that are coming in. You can also review the Webhooks log to see the messages we parsed as they came in.
Links:
Add this Simple Strategy example to your TradingView favorites.
You can find the source code for this simple strategy here.