Alert Function question
Posted: Fri Jul 14, 2023 12:07 pm
Hi
I want to create an automated script, that will not use predefined tp and sl, but will use limit and stop prices
The code is as follows
if shortCondition:
alert_string = 'ENTERING SHORT'
alert(alert_string, alert.freq_once_per_bar_close)
strategy.entry("Sell", strategy.short)
strategy.exit("Take Profit", "Sell", limit=close - (high - low) * takeProfitMultiplier)
strategy.exit("Stop Loss", "Sell", stop=close + (high - low) * stopLossMultiplier)
When i test the strategy on tradingview, it does not show the alert_string on the chart.
Am i doing sth wrong? Does the alert_string necessarily have to include tp and sl values? Is it also necessary for them to be included if i want to connect my strategy with metatrader 5?
Hope that it is clear, ann that someone can help
tnx
I want to create an automated script, that will not use predefined tp and sl, but will use limit and stop prices
The code is as follows
if shortCondition:
alert_string = 'ENTERING SHORT'
alert(alert_string, alert.freq_once_per_bar_close)
strategy.entry("Sell", strategy.short)
strategy.exit("Take Profit", "Sell", limit=close - (high - low) * takeProfitMultiplier)
strategy.exit("Stop Loss", "Sell", stop=close + (high - low) * stopLossMultiplier)
When i test the strategy on tradingview, it does not show the alert_string on the chart.
Am i doing sth wrong? Does the alert_string necessarily have to include tp and sl values? Is it also necessary for them to be included if i want to connect my strategy with metatrader 5?
Hope that it is clear, ann that someone can help
tnx