No-Code Alert
If you do not have access to the script’s code, you might still be able to automate the strategy or indicator if it passes either of the 2 feasibility tests.
Let’s check if the script-owner added the alert codes by doing the Feasibility Test.
1. Feasibility Test
Let’s try to determine whether the script can be automated — without access to the code.
1.1 alert()
Ensure you have attached the With the script attach to your chart, on the top left corner hover on it and click “Settings”.
You will see a pop-up.
Select “Inputs”.
1.2 alertcondition()
With the script applied to the chart, create an alert (Alt+A on Windows or Option+A on Mac), under “Condition” select the script.
If you have options above “Crossing” such as “Going Long” and “Going Short”, you might be able to implement the script.
If you see no entry above “crossing” such as the screenshot below, the script fails the Feasibility Test 2.
1.3 Strategy
With the script applied to the chart, create an alert (Alt+A on Windows or Option+A).
Select the Strategy you’re looking to implement under “Condition”, and select “Order fills only”.
If you are able to select “Order fills only”, you should be able to automate the strategy by tweaking the Message.
You may start with something basic:
LicenseID,buy,{{ticker}},risk=1
LicenseID,buy,{{ticker}},risk=1,sl=10,tp=20
If your script is a strategy, you may opt for something more dynamic:
LicenseID,{{strategy.order.action}},{{ticker}},risk={{strategy.order.contracts}}
{{ticker}}
→ returns the ticker of the symbol used in alert (EURUSd, BTCUSD, etc.){{strategy.position_size}}
→ returns the size of the current position.{{strategy.order.action}}
→ returns the string “buy” or “sell” for the executed order.{{strategy.order.contracts}}
→ returns the number of contracts of the executed order.{{strategy.market_position_size}}
→ returns the size of the current position as an absolute value, i.e. a non-negative number.
2. Implementation
2.1 alert()
If you see a License ID input in the script’s settings, you should be able to automate the script easily.
2.1.1 Update Inputs
To implement the script, simply tweak the inputs available such as the License ID, Stop Loss and Risk. The script-owner might have a different set of input options — perhaps with traildist or the spread filter.
Select “Ok” once you have completed your edit.
2.1.2 Create Alerts
Go to the symbol and timeframe you’d like to implement the script for and create an alert.
Select the appropriate script under Condition, and input the following Webhook URL:
https://webhook.pineconnector.com
In this example, we are implementing the script on US100 — evident from the “Create Alert on US100” at the top.
Once you have created your alert, you will be able to see the ticker and timeframe the alert is running on.
In this example, the alert is running based on prices on US100 on the 1 second chart.
The fired alert can be seen in the Alerts log, taking on the inputs you have indicated such as the License ID and post-symbol identifier.
You may repeat the implementation if you’d like to trade more symbols and timeframes.
2.2 alertcondition()
The script-owner might have used alertcondtion() to create the alert function.
2.2.1 Create Alerts
For this scenario, select the script under “Condition” and the appropriate selection such as “Going Long”.
Under Options, we recommend you select “Once Per Bar Close” to reduce repainting issues.
LicenseID,{{strategy.order.action}},{{ticker}},risk=1
Putting the alert setup panel together, we have something like this:
Once an alert fires, you may pause the active alert.
If you see {{strategy.order.action}} printed, the script is an indicator.
If you see actual order action such as “buy” or “sell” printed, the script is a strategy.
2.2.2. Configure Alert Message
You may start with something basic:
LicenseID,buy,{{ticker}},risk=1
LicenseID,buy,{{ticker}},risk=1,sl=10,tp=20
If your script is a strategy, you may opt for something more dynamic:
LicenseID,{{strategy.order.action}},{{ticker}},risk={{strategy.order.contracts}}
{{ticker}}
→ returns the ticker of the symbol used in alert (EURUSd, BTCUSD, etc.){{strategy.position_size}}
→ returns the size of the current position.{{strategy.order.action}}
→ returns the string “buy” or “sell” for the executed order.{{strategy.order.contracts}}
→ returns the number of contracts of the executed order.{{strategy.market_position_size}}
→ returns the size of the current position as an absolute value, i.e. a non-negative number.
You may repeat the implementation if you’d like to trade more symbols and timeframes.