ScriptingAlerts

📢 Alert Function – Lipi Script (GoCharting)

GoCharting has introduced the alert() function in Lipi Script, allowing users to generate real-time alerts directly from their custom indicators. This makes it easier to act on critical trading conditions without manually watching the charts.


🚀 What is the alert() Function?

The alert() function enables users to trigger an alert from within a Lipi Script when a specific condition is met — such as RSI crossing a level, price breaking a resistance zone, or any custom logic.

This is especially useful for algorithmic and discretionary traders who want to be notified instantly when their conditions are fulfilled.


✍️ Basic Usage Example

Here’s an example where we create an alert when RSI crosses above 70:

indicator("RSI Alert", overlay=false)
 
rsi = talib.rsi(close, 14)
 
if talib.crossover(rsi, 70) {
    alert("RSI crossed above 70!")
}

📌 How to Use Alerts in GoCharting

🖊️ Write Your Script

  • Open the Lipi Script editor and define your conditions using the alert() function.
  • Save and add the script to your chart.

🧭 Open the Alert Widget

  • On the GoCharting platform, open the Alert Widget from the right panel or right click on the chart and click on alert.

⚙️ Set Up the Alert

  • Choose your script from the list of available indicators.
  • Select the alert message (defined in your script).
  • Configure notification preferences (sound, popup, webhook, etc.).
  • Set it live.

🚨 Receive Alerts Instantly

  • Whenever your script’s condition is met, the alert will trigger automatically.

grid

✅ Key Notes

  • alert() runs every bar and triggers when the condition inside it is met.
  • You can use multiple alert() calls for different scenarios within one script.
  • Works with real-time data for immediate notifications.
  • Supports both overlay and non-overlay indicators.

🔔 Use Case Ideas

  • RSI or MACD crossovers
  • Price breaking support/resistance
  • Custom strategy confirmation signals
  • Candle pattern detection

📢 Using alertcondition in GoCharting

GoCharting allows users to create custom alerts using Lipi Script by leveraging the alertcondition function. This function defines logical conditions under which alerts can be triggered and is tightly integrated with the platform’s alert widget.


🧩 Step 1: Define the Indicator

You must first define your condition and wrap it with the alertcondition() function inside a script.

indicator("Volume > 10 Alert", overlay=false)
 
// Condition
volAbove10 = volume > 10
 
// Plotting for visual reference
plot(volume, title="Volume", color=color.blue, style=plotStyle.bar)
 
// Alert condition
alertcondition(volAbove10, title="Volume Greater Than 10", message="Volume has crossed above 10")

🧪 Step 2: Add the Indicator to the Chart

Click on the Script tab.

Create and Save your script.

Click Apply to load it on the chart.

⏰ Step 3: Create an Alert

On the GoCharting platform, open the Alert Widget from the right panel or right click on the chart and click on alert.

In the Condition dropdown, select your custom indicator (e.g., Volume > 10 Alert).

In Alert Condition, choose the condition you defined in alertcondition() (e.g., Volume Greater Than 10).

The message field will automatically pull from the message string defined inside alertcondition.

Click Create Alert.

grid

📝 Key Notes The title in alertcondition() becomes the condition name shown in the alert widget.

The message is used as the default text in the alert popup/notification.

Alerts only work when the indicator is applied to the chart.

🧠 Why Use alertcondition()? While alert() is used for inline alerting during script execution, alertcondition() is required to integrate your condition with the GoCharting UI, allowing users to configure alerts visually without modifying the script.