Is it possible to separately add alert code to any indicator? Does it work?

3 Views
Marta Greene
Answered 10 months ago
<p id="isPasted">I think this is what your looking for, remember following an indicator blindly probably wont work look for other factors in your trades.</p><p><br></p><p>indicator(title='Heiken Ashi Pivot Blue Candle over Regular Candles', overlay=true)</p><p>ha_handle = ticker.heikinashi(syminfo.tickerid)</p><p>ha_open = request.security(ha_handle, timeframe.period, open)</p><p>ha_close = request.security(ha_handle, timeframe.period, close)</p><p>o = request.security(syminfo.tickerid, timeframe.period, open)</p><p>c = request.security(syminfo.tickerid, timeframe.period, close)</p><p>col_blue = #32a7ff</p><p>col_green = #669b66</p><p>col_black = #550000</p><p>col_red = #e54444</p><p>ha1 = ha_close &gt; ha_open ? col_blue : col_black</p><p>ha2 = ha_close[1] &gt; ha_open[1] ? col_blue : col_black</p><p>ha3 = ha1 == ha2 ? color.white : ha1</p><p>ha11 = ha_close &gt; ha_open ? …</p>
2 Views
Tosun Ozbilen Former Paving & Surfacing Operator at Oklahoma Tire & Supply Company
Answered 1 week, 2 days ago
<p id="isPasted">Yes, you can absolutely add alert code to almost any indicator, though the process depends on whether the indicator is "open source" (you can see the code) or "closed source" (you only see the plot).</p><p><strong>1. For Open Source Indicators (Pine Script/MQL4)</strong></p><p>If you have access to the source code, you can manually insert an alert trigger.</p><ul><li>TradingView (Pine Script): You use the alertcondition() or alert() functions. You define a logical "true/false" statement (e.g., Crosses Above) and the script triggers a notification whenever that condition is met.</li><li>MetaTrader (MQL4/MQL5): You insert an Alert() or SendNotification() function inside the code’s "OnCalculate" …</li></ul>