OPEN-SOURCE SCRIPT
Mentor Q Locked Levels Engine 4h

You are an expert data parsing assistant. I am going to provide you with an XML file containing financial market levels. Your task is to extract specific attributes and convert them into a raw text format compatible with my custom TradingView Pine Script indicator.
Strictly adhere to the following formatting guidelines for each valid level found:
1. Every line must follow this exact syntax:
Level=VALUE; Name="LABEL (TICKER)"; Color=HEX_OR_FALLBACK; Style=STYLE_TYPE; LineWidth=2
2. Formatting Rules:
- 'Level': Extract the exact price or numerical value.
- 'Name': Combine the level's description/name with its asset symbol inside parentheses—e.g., Name="1D Max (QQQ)". It must be enclosed in double quotes.
- 'Color': Map the color to hex format (e.g., #FE0000 for Red, #FF9800 for Orange, #4CAF50 for Green, #2962FF for Blue, #20BDBD for Teal). If the XML color is missing or unclear, assign a fallback based on the level name.
- 'Style': Must be exactly "Solid", "Dashed", or "Dotted".
- 'LineWidth': Keep it consistently at 2.
3. Output Constraints:
- Do NOT include any markdown headers, conversational text, introduction, or explanations.
- Do NOT group them by headers like "=== QQQ ===". Just output the raw lines directly.
- Output ONLY the clean, copy-and-paste ready text rows.
Here is the XML data to process:
Strictly adhere to the following formatting guidelines for each valid level found:
1. Every line must follow this exact syntax:
Level=VALUE; Name="LABEL (TICKER)"; Color=HEX_OR_FALLBACK; Style=STYLE_TYPE; LineWidth=2
2. Formatting Rules:
- 'Level': Extract the exact price or numerical value.
- 'Name': Combine the level's description/name with its asset symbol inside parentheses—e.g., Name="1D Max (QQQ)". It must be enclosed in double quotes.
- 'Color': Map the color to hex format (e.g., #FE0000 for Red, #FF9800 for Orange, #4CAF50 for Green, #2962FF for Blue, #20BDBD for Teal). If the XML color is missing or unclear, assign a fallback based on the level name.
- 'Style': Must be exactly "Solid", "Dashed", or "Dotted".
- 'LineWidth': Keep it consistently at 2.
3. Output Constraints:
- Do NOT include any markdown headers, conversational text, introduction, or explanations.
- Do NOT group them by headers like "=== QQQ ===". Just output the raw lines directly.
- Output ONLY the clean, copy-and-paste ready text rows.
Here is the XML data to process:
Skrypt open-source
W zgodzie z duchem TradingView twórca tego skryptu udostępnił go jako open-source, aby użytkownicy mogli przejrzeć i zweryfikować jego działanie. Ukłony dla autora. Korzystanie jest bezpłatne, jednak ponowna publikacja kodu podlega naszym Zasadom serwisu.
Wyłączenie odpowiedzialności
Informacje i publikacje nie stanowią i nie powinny być traktowane jako porady finansowe, inwestycyjne, tradingowe ani jakiekolwiek inne rekomendacje dostarczane lub zatwierdzone przez TradingView. Więcej informacji znajduje się w Warunkach użytkowania.
Skrypt open-source
W zgodzie z duchem TradingView twórca tego skryptu udostępnił go jako open-source, aby użytkownicy mogli przejrzeć i zweryfikować jego działanie. Ukłony dla autora. Korzystanie jest bezpłatne, jednak ponowna publikacja kodu podlega naszym Zasadom serwisu.
Wyłączenie odpowiedzialności
Informacje i publikacje nie stanowią i nie powinny być traktowane jako porady finansowe, inwestycyjne, tradingowe ani jakiekolwiek inne rekomendacje dostarczane lub zatwierdzone przez TradingView. Więcej informacji znajduje się w Warunkach użytkowania.