Kindly help a new user

I’m getting a code error and I have no coding knowledge so I rely on Chatgpt but still not help. The code error is:
same. status]
Playing macro chatgpt Tradingview alerts json online editor
[error]
Line 1: Unclosed ‘while_v2’ (at command #5)

The actual code is:
{
“Name”: “TradingView Alerts Fixed”,
“CreationDate”: “2025-07-21”,
“Commands”: [
{
“Command”: “open”,
“Target”: “https://www.tradingview.com/watchlist/”,
“Value”: “”,
“Description”: “Open watchlist”
},
{
“Command”: “waitForElementPresent”,
“Target”: “css=div.tv-screener-table__symbol”,
“Value”: “30000”,
“Description”: “Wait for tickers to load”
},
{
“Command”: “storeElementCount”,
“Target”: “css=div.tv-screener-table__symbol”,
“Value”: “totalTickers”,
“Description”: “Count tickers”
},
{
“Command”: “store”,
“Target”: “1”,
“Value”: “index”,
“Description”: “Start index at 1”
},
{
“Command”: “while_v2”,
“Target”: “${index} <= ${totalTickers}”,
“Value”: “”,
“Description”: “Loop through tickers”
},
{
“Command”: “echo”,
“Target”: “Processing ticker #${index}”,
“Value”: “”,
“Description”: “”
},
{
“Command”: “click”,
“Target”: “xpath=(//div[contains(@class,‘tv-screener-table__symbol’)])[${index}]”,
“Value”: “”,
“Description”: “Click ticker”
},
{
“Command”: “waitForElementPresent”,
“Target”: “css=button[data-name=‘create-alert-button’]”,
“Value”: “15000”,
“Description”: “Wait for alert button”
},
{
“Command”: “pause”,
“Target”: “2000”,
“Value”: “”,
“Description”: “Pause for safety”
},
{
“Command”: “click”,
“Target”: “css=button[data-name=‘create-alert-button’]”,
“Value”: “”,
“Description”: “Open alert dialog”
},
{
“Command”: “waitForElementPresent”,
“Target”: “xpath=//form[contains(@class, ‘alert-dialog’)]”,
“Value”: “10000”,
“Description”: “Wait for alert dialog”
},
{
“Command”: “click”,
“Target”: “xpath=(//span[contains(text(),‘Condition’)]/following::button)[1]”,
“Value”: “”,
“Description”: “Pick condition (EMA)”
},
{
“Command”: “click”,
“Target”: “xpath=//span[contains(text(),‘Notifications’)]”,
“Value”: “”,
“Description”: “Notifications tab”
},
{
“Command”: “click”,
“Target”: “xpath=//button[contains(@class,‘tv-button’) and .//span[text()=‘Create’]]”,
“Value”: “”,
“Description”: “Create alert”
},
{
“Command”: “pause”,
“Target”: “1000”,
“Value”: “”,
“Description”: “Small wait”
},
{
“Command”: “click”,
“Target”: “css=button[data-name=‘create-alert-button’]”,
“Value”: “”,
“Description”: “Open second alert”
},
{
“Command”: “waitForElementPresent”,
“Target”: “xpath=//form[contains(@class, ‘alert-dialog’)]”,
“Value”: “10000”,
“Description”: “Wait for 2nd dialog”
},
{
“Command”: “click”,
“Target”: “xpath=(//span[contains(text(),‘Condition’)]/following::button)[1]”,
“Value”: “”,
“Description”: “Pick condition (RMAC)”
},
{
“Command”: “click”,
“Target”: “xpath=//button[contains(@class,‘tv-button’) and .//span[text()=‘Create’]]”,
“Value”: “”,
“Description”: “Create 2nd alert”
},
{
“Command”: “goBack”,
“Target”: “”,
“Value”: “”,
“Description”: “Back to list”
},
{
“Command”: “waitForElementPresent”,
“Target”: “css=div.tv-screener-table__symbol”,
“Value”: “15000”,
“Description”: “Wait for reload”
},
{
“Command”: “storeEval”,
“Target”: “${index} + 1”,
“Value”: “index”,
“Description”: “Increment index”
},
{
“Command”: “endWhile_v2”,
“Target”: “”,
“Value”: “”,
“Description”: “End loop”
},
{
“Command”: “echo”,
“Target”: “:white_check_mark: Done creating alerts for ${totalTickers} tickers.”,
“Value”: “”,
“Description”: “”
}
]
}

“Command”: “while”

“Command”: “end”

cannot troubleshoot without access to webpage

1 Like