Setup

1. Basics

What is NinjaConnects?
NinjaConnects enables you to connect algo/automated strategies from TradingView to NinjaTrader 8. This bridge allows you to submit trades originated from TradingView with JSON triggers to any account in NinjaTrader 8. For further details visit https://NinjaConnects.com/

TradingView can send webhook triggers from strategies to a URL only.
Example of a URL is: https://jimrides.com.
You can obtain a domain at https://CloudFlare.com, as at this point we have tested NinjaConnects with the tunnels offered by CloudFlare. For a domain registered at CloudFlare, there is no additional costs to use a tunnel. You do not require a web site or a server.

Assuming you have this domain : https://jimrides.com
You need a tunnel from this domain name [URL] to your computer so that TradingView[TV] can communicate with NinjaConnects and in turn to the NinjaTrader 8 [NT8] on your computer.

Your Connect string in this case will look like:

https://NinjaConnects.jimrides:35426/FcWebHook/

Let us first complete the setup on the TradingView then we will setup a Tunnel to go with it on the CloudFlare with a domain name of your own to your own computer. After that we will setup a tunnel using NGROK.

Please note that you would need to setup only one computer to receive signals or Webhook triggers from Tradingview. We are exposing only one computer over the internet. Any other computer on your LAN or WAN, which will be used for trading hub needs not to have these tunnels. For setting up additional computers with NinjaConnects please visit:

https://support.ninjaconnects.com/lanwansetup

2. TradingView Setup

You will define this connection in the TradingView.

On your TradingView click on the Strategy you want to automate. Locate and click 3 dots, as shown below where you see “More”.

TradingView Strategy Menu

On the pop up Window, select:
Add Alert on the name of the strategy you are using, in this case “AlgoPro V1.4”.

Add Alert

THis will open a new PopUp Window. Select the strategy you want to use. In this case I chose AlgoPro 1.4 Bot. All triggers from this strategy will be sent to the URL, we are going to create at CloudFlare.

Strategy Selection

On the Message Tab, set
Alert Name : NinjaConnects
Message: {{strategy.order.alert_message}}

Message Tab

On the Notification Tab set the following URL but change the JimRides.com with your domain name. It is used as an example here. You must use NinjaConnects and /FcWebHook/ exactly as shown below, for the reason that NinjaConnects ignores any triggers received by it which do not include these two keywords.

In the TradingView Set Webhook URL as following: https://NinjaConnects.JimRides.com/FcWebHook/

Webhook URL

Setting Up Trigger Commands

Here is how you set up triggers or commands for actions defined by your strategy. A strategy may offer more or less commands. NinjaConnects receives and executes the following actions:

  • Enter_long: Open Long Command
  • EnterShort: Open Short Command
  • LTP1..LTP4: Long Take Profit 1 through 4
  • STP1..STP4: Short Take Profit
  • LSL: Long Stop Loss
  • SSL: Short stop loss.

Click on the Strategy you intend to use and click on the Gearrr icon as shown under Settings below.

Strategy Settings

This will open the dialog box for “Trade Automation Commands”
Enter the following JSON command for each of the boxes below.

Make sure that you define a unique secret here in TradingView. You will need to define this exact same secret in NinjaConnects

Open Long Command Use : Action : enter_long

{ "SourceSecret": "OurSecret#", "TargetSecret": "TargetSecret#", "max_lag": "30", "timestamp": "{{timenow}}", "trigger_price": "{{close}}", "tv_exchange": "{{exchange}}", "tv_instrument": "{{ticker}}", "quantity": "{{strategy.order.contracts}}", "order_id": "{{strategy.order.id}}_{{timenow}}", "action": "enter_long" }

Open Short Command use : Action : enter_short

{ "SourceSecret": "OurSecret#", "TargetSecret": "TargetSecret#", "max_lag": "30", "timestamp": "{{timenow}}", "trigger_price": "{{close}}", "tv_exchange": "{{exchange}}", "tv_instrument": "{{ticker}}", "quantity": "{{strategy.order.contracts}}", "order_id": "{{strategy.order.id}}_{{timenow}}", "action": "enter_short" }

Long Take Profit 1 : Action: LTP1

{ "SourceSecret": "OurSecret#", "TargetSecret": "TargetSecret#", "max_lag": "30", "timestamp": "{{timenow}}", "trigger_price": "{{close}}", "tv_exchange": "{{exchange}}", "tv_instrument": "{{ticker}}", "quantity": "{{strategy.order.contracts}}", "order_id": "{{strategy.order.id}}_{{timenow}}", "action": "LTP1" }

Long Take Profit 2 : Action: LTP2

{ "SourceSecret": "OurSecret#", "TargetSecret": "TargetSecret#", "max_lag": "30", "timestamp": "{{timenow}}", "trigger_price": "{{close}}", "tv_exchange": "{{exchange}}", "tv_instrument": "{{ticker}}", "quantity": "{{strategy.order.contracts}}", "order_id": "{{strategy.order.id}}_{{timenow}}", "action": "LTP2" }

Long Take Profit 3 : Action: LTP3

{ "SourceSecret": "OurSecret#", "TargetSecret": "TargetSecret#", "max_lag": "30", "timestamp": "{{timenow}}", "trigger_price": "{{close}}", "tv_exchange": "{{exchange}}", "tv_instrument": "{{ticker}}", "quantity": "{{strategy.order.contracts}}", "order_id": "{{strategy.order.id}}_{{timenow}}", "action": "LTP3" }

Long Take Profit 4 : Action: LTP4

{ "SourceSecret": "OurSecret#", "TargetSecret": "TargetSecret#", "max_lag": "30", "timestamp": "{{timenow}}", "trigger_price": "{{close}}", "tv_exchange": "{{exchange}}", "tv_instrument": "{{ticker}}", "quantity": "{{strategy.order.contracts}}", "order_id": "{{strategy.order.id}}_{{timenow}}", "action": "LTP4" }

Short Take Profit 1 : Action: STP1

{ "SourceSecret": "OurSecret#", "TargetSecret": "TargetSecret#", "max_lag": "30", "timestamp": "{{timenow}}", "trigger_price": "{{close}}", "tv_exchange": "{{exchange}}", "tv_instrument": "{{ticker}}", "quantity": "{{strategy.order.contracts}}", "order_id": "{{strategy.order.id}}_{{timenow}}", "action": "STP1" }

Short Take Profit 2 : Action: STP2

{ "SourceSecret": "OurSecret#", "TargetSecret": "TargetSecret#", "max_lag": "30", "timestamp": "{{timenow}}", "trigger_price": "{{close}}", "tv_exchange": "{{exchange}}", "tv_instrument": "{{ticker}}", "quantity": "{{strategy.order.contracts}}", "order_id": "{{strategy.order.id}}_{{timenow}}", "action": "STP2" }

Short Take Profit 3 : Action: STP3

{ "SourceSecret": "OurSecret#", "TargetSecret": "TargetSecret#", "max_lag": "30", "timestamp": "{{timenow}}", "trigger_price": "{{close}}", "tv_exchange": "{{exchange}}", "tv_instrument": "{{ticker}}", "quantity": "{{strategy.order.contracts}}", "order_id": "{{strategy.order.id}}_{{timenow}}", "action": "STP3" }

Short Take Profit 4 : Action: STP4

{ "SourceSecret": "OurSecret#", "TargetSecret": "TargetSecret#", "max_lag": "30", "timestamp": "{{timenow}}", "trigger_price": "{{close}}", "tv_exchange": "{{exchange}}", "tv_instrument": "{{ticker}}", "quantity": "{{strategy.order.contracts}}", "order_id": "{{strategy.order.id}}_{{timenow}}", "action": "STP4" }

Stop Loss Long : Action: LSL

{ "SourceSecret": "OurSecret#", "TargetSecret": "TargetSecret#", "max_lag": "30", "timestamp": "{{timenow}}", "trigger_price": "{{close}}", "tv_exchange": "{{exchange}}", "tv_instrument": "{{ticker}}", "quantity": "{{strategy.order.contracts}}", "order_id": "{{strategy.order.id}}_{{timenow}}", "action": "LSL" }

Stop loss Short : Action: SSL

{ "SourceSecret": "OurSecret#", "TargetSecret": "TargetSecret#", "max_lag": "30", "timestamp": "{{timenow}}", "trigger_price": "{{close}}", "tv_exchange": "{{exchange}}", "tv_instrument": "{{ticker}}", "quantity": "{{strategy.order.contracts}}", "order_id": "{{strategy.order.id}}_{{timenow}}", "action": "SSL" }
Automation Commands

Define the Secret on the NinjaConnects. Receive secret must match the one on the Trading View.

Secret Config

On TradingView, click on the clock sign on the top right, to reveal the Triggers/WebHooks Panel. On the Log tab, you can view the log of the Webhooks sent out and can reconfigure any alerts on the Alerts tab.

Alerts Log

This completes the setup on the TradingView.

3. How to setup NGROK Tunnel from internet to your computer

For Step-by-Step Setup:

Sign Up & Download:

  • Go to ngrok.com and sign up for a free account.
Ngrok Signup
  • Choose Skip for Now:
Skip
Skip Step
  • Log in to your dashboard and download the ngrok client for Windows. It will prompt you if you are using NGROK for Development or Production: Choose Production
Download Ngrok
  • Extract the downloaded ZIP file to a folder, for example, C:\ngrok.
  • Copy and run the command shown below from th the web page.
Run Command

Add to PATH (Optional but Recommended):

  • Copy the path to the folder where you extracted ngrok.exe (e.g., C:\ngrok).
  • Search for "Environment Variables" in Windows, select "Edit the system environment variables," click "Environment Variables," and then edit the Path variable.
  • Add a new entry with the path you copied.

Connect Your Account:

  • Open Command Prompt (CMD) or PowerShell.

deploy your app online

  • Run the following in the command line.
  • ngrok http 35426

Use the following connect string in the TradingView

https://muoi-salamandrine-mullishly.ngrok-free.dev/FcWebHook/

Instead of using the connect string as JimRids.com

Connect String

Open PerShell as administrator and execute the following commands

Run PowerShell as Administrator and run the following command, change JimRides.com with your domain name as shown above to let windows know to pass the traffic from the tunnel to NinjaTrader and let NinjaCoNNects to use this port 35426

netsh http add urlacl url=http://+:35426/FcWebHook/ user=EVERYONE listen=yes delegate=yes

Replace Jimrids.com with your Domain. Issue the following command on Windows Power Shell as test orders.

Invoke-RestMethod -Uri "https://NinjaConnects.JimRides.com/FcWebHook/" -Method Post -Body ' { "secret": "TheSecret#", "max_lag": "30", "timestamp": "2026-01-08T13:20:00Z", "trigger_price": "25797.00", "tv_exchange": "CME_MINI", "tv_instrument": "NQH2026", "quantity": "1", "order_id": "Long_2026-01-08T13:20:00Z", "action": "enter_long" }' Invoke-RestMethod -Uri "https://NinjaConnects.JimRides.com/FcWebHook/" -Method Post -Body ' { "secret": "TheSecret#", "max_lag": "30", "timestamp": "2026-01-08T13:20:00Z", "trigger_price": "25797.00", "tv_exchange": "CME_MINI", "tv_instrument": "NQH2026", "quantity": "1", "order_id": "Long_2026-01-08T13:20:00Z", "action": "lsl" }' Invoke-RestMethod -Uri "https://NinjaConnects.JimRides.com/FcWebHook/" -Method Post -Body ' { "secret": "TheSecret#", "max_lag": "30", "timestamp": "2026-01-08T13:20:00Z", "trigger_price": "25797.00", "tv_exchange": "CME_MINI", "tv_instrument": "NQH2026", "quantity": "1", "order_id": "Long_2026-01-08T13:20:00Z", "action": "enter_short" }' Invoke-RestMethod -Uri "https://NinjaConnects.JimRides.com/FcWebHook/" -Method Post -Body ' { "secret": "TheSecret#", "max_lag": "30", "timestamp": "2026-01-08T13:20:00Z", "trigger_price": "25797.00", "tv_exchange": "CME_MINI", "tv_instrument": "NQH2026", "quantity": "1", "order_id": "Long_2026-01-08T13:20:00Z", "action": "ssl" }'

You should see orders getting executed.

This completes NGROK tunnel setup. Enjoy!

4. Setup A tunnel on CloudFlare

Now TradingView will send Webhook Triggers commands to your the following URL:
https://NinjaConnects.JimRides.com/FcWebHook/

To receive these WebHook Trigers, we will setup a Tunnel from this domain name to the computer, which is running NinjaTrader with the NinjaConnects.
For a CloudFlare Document about how to create a Tunnel, Please visit:
https://developers.cloudflare.com/cloudflare-one/setup/

Cloudflare Signup
Zero Trust

On CLoudFlare One ; on Overview Screen; Select a Team name of your choice and Choose Zero Trus tFree account:


Go to Zero Trust : https://one.dash.cloudflare.com/

  • On the onboarding screen of ZeroTrust, choose a team name. The team name is a unique, internal identifier for your Zero Trust organization. Users will enter this team name when they enroll their device manually, and it will be the subdomain for your App Launcher (as relevant). Your business name is the typical entry.
    You can find your team name in Cloudflare One ↗ by going to Settings.
Team Name
  • Complete your onboarding by selecting a subscription plan and entering your payment details. If you chose the Zero Trust Free plan, this step is still needed but you will not be charged.

Create a Cloudflare Tunnel

Visit : https://developers.cloudflare.com/learning-paths/clientless-access/connect-private-applications/create-tunnel/

To enable clientless access to your applications, you will need to create a Cloudflare Tunnel that publishes applications to a domain on Cloudflare. A published application creates a public DNS record that routes traffic to a specific address, protocol, and port associated with a private application. For example, you can define a public hostname (mywebapp.example.com) to provide access to a web server running on https://localhost:8080. When a user goes to mywebapp.example.com in their browser, their request will first route to a Cloudflare data center where it is inspected against your configured security policies. Cloudflare will then forward validated requests down your tunnel to the web server.

Tunnel Concept

5. Create a tunnel

To create a Cloudflare Tunnel:

  • Log in to Cloudflare One ↗ and go to Networks > Connectors > Cloudflare Tunnels.
  • Select Create a tunnel.
Create Tunnel
  • Choose Cloudflared for the connector type and select Next.
  • Enter a name for your tunnel. We suggest choosing a name that reflects the type of resources you want to connect through this tunnel (for example, enterprise-VPC-01).
Name Tunnel
Save Tunnel
  • Select Save tunnel.
  • Next, you will need to install cloudflared and run it. To do so, check that the environment under Choose an environment reflects the operating system on your machine, then copy the command in the box below and paste it into a terminal window. Run the command.
Install Cloudflared

To Download CloudFlared Connector visit: https://github.com/cloudflare/cloudflared/releases/latest/download/cloudflared-windows-amd64.msi

  • Once the command has finished running, your connector will appear in Cloudflare One.
  • Run the Command Prompt as Administrator.
Command Prompt

9. Follow these steps.

Run Command

5. Once the command has finished running, your connector will appear in Cloudflare One.

Connector Connected

Your tunnel will be visible under Connectors

Tunnel Visible

6. Click On Connectors under Network

Connectors Menu

Click on NinjaConnects to open Edit Panel on to the right and Click Edit

Edit Tunnel

Click on Published Application Route and add A Published Application Route

Public Hostname
Add Route
  • Enter a subdomain and select a Domain from the drop-down menu. Specify NinjaConnects subdomain and leave path information blank

Enter information as shown below Change domain to your domain
For local service Type : HTTP
URL: localhost:35426 [This is NinjaConnects detail at your local host.

Localhost Config

Run PowerShell as Administrator and run the following command, change JimRides.com with your domain name as shown above to let windows know to pass the traffic from the tunnel to NinjaTrader and let NinjaCoNNects to use this port 35426

netsh http add urlacl url=http://+:35426/FcWebHook/ user=EVERYONE listen=yes delegate=yes

Replace Jimrids.com with your Domain. Issue the following command on Windows Power Shell as test orders.

Invoke-RestMethod -Uri "https://NinjaConnects.JimRides.com/FcWebHook/" -Method Post -Body ' { "secret": "TheSecret#", "max_lag": "30", "timestamp": "2026-01-08T13:20:00Z", "trigger_price": "25797.00", "tv_exchange": "CME_MINI", "tv_instrument": "NQH2026", "quantity": "1", "order_id": "Long_2026-01-08T13:20:00Z", "action": "enter_long" }' Invoke-RestMethod -Uri "https://NinjaConnects.JimRides.com/FcWebHook/" -Method Post -Body ' { "secret": "TheSecret#", "max_lag": "30", "timestamp": "2026-01-08T13:20:00Z", "trigger_price": "25797.00", "tv_exchange": "CME_MINI", "tv_instrument": "NQH2026", "quantity": "1", "order_id": "Long_2026-01-08T13:20:00Z", "action": "lsl" }' Invoke-RestMethod -Uri "https://NinjaConnects.JimRides.com/FcWebHook/" -Method Post -Body ' { "secret": "TheSecret#", "max_lag": "30", "timestamp": "2026-01-08T13:20:00Z", "trigger_price": "25797.00", "tv_exchange": "CME_MINI", "tv_instrument": "NQH2026", "quantity": "1", "order_id": "Long_2026-01-08T13:20:00Z", "action": "enter_short" }' Invoke-RestMethod -Uri "https://NinjaConnects.JimRides.com/FcWebHook/" -Method Post -Body ' { "secret": "TheSecret#", "max_lag": "30", "timestamp": "2026-01-08T13:20:00Z", "trigger_price": "25797.00", "tv_exchange": "CME_MINI", "tv_instrument": "NQH2026", "quantity": "1", "order_id": "Long_2026-01-08T13:20:00Z", "action": "ssl" }'

This completes TradingView to NinjaConnects/NinjaTrader setup. Enjoy!