1. Flux Charts
  2. SFX Automation

SFX Automation: Automating Trading Strategy

SFX Automation: Automating trading strategy

The SFX Automation allows users to create, backtest, and automate strategies using features from the SFX Algo toolkit. This article teaches step-by-step how to automate a trading strategy built with the SFX Algo using the SFX Automation tool.

Platform For Strategy Automation

After you've built and backtested a strategy on TradingView, you can use webhooks to automate the strategy on your preferred brokerage. TradingView does not allow users to automate strategies directly through the platform. Thus, you must use a 3rd party website to connect with a brokerage and automate your custom strategy. In this article, we will be using TradersPost. However, you can also use other platforms and follow similar steps to automate your strategy.

Below are platforms that provide services to automate your custom SFX Automation strategy:

Step 1) Connect a Brokerage

Once you've chosen a platform, connect the brokerage account you use for trading. To connect a brokerage on TradersPost, click the "Brokers" tab on your user dashboard and then select a brokerage to connect to.

Selecting a brokerage with TradersPost for SFX Automation

Step 2) Create a Strategy

Strategy Step One

Go to the "Strategies" section on the TradersPost user dashboard and click "+ New Strategy".

Creating a strategy with TradersPost for SFX Automation

Strategy Step Two

Create a strategy by inputting a name, creating a description, choosing an asset class, and allowing any ticker.

You can choose from the following asset classes:

  • Stocks

  • Options

  • Futures

  • Crypto

After you've filled out all the necessary details for your strategy, click "Save".

Creating a strategy on TradersPost for SFX Automation

Step 3) Create a Subscription

Once you've created a strategy, you must create a subscription.

Subscription Step One

Go to the "Subscriptions" section on the TradersPost user dashboard and click "+ New Subscription".

Create subscription on TradersPost for SFX Automation

Subscription Step Two

After creating a new subscription, select the strategy you've created from Step 2, then select the brokerage you connected in Step 1, and click "Create".

Create subscription on TradersPost for SFX Automation
Create subscription on TradersPost for SFX Automation
Create subscription on TradersPost for SFX Automation

Subscription Step Three

Configure the subscription details with the following:

  • Enter a name for your subscription

  • Enable "Auto Submit". This will allow your broker to automatically execute your orders from your strategy. If this is disabled, you will need to manually approve or reject each order.

  • Change the "Sides" setting to "Both (Bullish & Bearish)"

  • Enable "Allow any ticker"

Afterward, click "Save" and "Enable". No additional adjustments are needed within the subscription settings. Your strategy— including position sizing, entries, and exits—is fully managed within the strategy you've built on TradingView using the SFXAutomation.

Create subscription on TradersPost for SFX Automation

Step 4) Setup Webhook

After you've created a subscription on TradersPost, you must set up your webhook.

Webhook Step One

Go to the "Webhooks" section on the TradersPost user dashboard, click the 3 dots next to the webhook with your strategy name, and click view.

Setting up webhook on TradersPost for SFX Automation

Webhook Step Two

Click "Webhook" in the top right and then click "Copy". This will copy your webhook URL.

PLEASE NOTE: For security reasons, DO NOT share your webhook URL with anyone. Your webhook URL is a private key that allows automated trading executions. Sharing it can lead to unauthorized access, potentially compromising your trading account and funds.

Copying webhook URL from TradersPost for SFX Automation

Step 5) TradingView Setup

TradingView Step One

Go to TradingView and create an alert on the ticker you want to automate trades using your custom strategy from the SFX Automation tool.

Create an alert on TradingView for webhook for SFX Automation

TradingView Step Two

Set up the alert with the following criteria:

  • Condition: Flux Charts - SFX Automation

  • Expiration: Choose when you would like this alert to expire. Your strategy will stop being automated once the alert expires.

  • Alert Name: This is optional to fill, but it makes it easier to keep track of your alerts/strategies if you create several.

  • Message: You must input the JSON code snippet from below (Copy & Paste). Otherwise, the strategy automation will not work through TradersPost.

{
    "ticker": "{{ticker}}",
    "action": "{{strategy.order.action}}",
    "sentiment": "{{strategy.market_position}}",
    "quantity": "{{strategy.order.contracts}}",
    "price": "{{close}}",
    "time": "{{timenow}}"
}

PLEASE NOTE: If you're using another platform to automate trades instead of TradersPost this message may differ!

Create TradingView alert for SFX Automation

TradingView Step Three

Go to the "Notifications" tab within your alert and enable the "Webhook URL". Paste your webhook URL from Step 4 here and then click "Create"

Please Note: You need to have 2FA enabled on your TradingView account to use webhooks.

Creating webhook URL alert for SFX Automation

After clicking create, your strategy will be automated through the brokerage you connected from the earlier steps.