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:
Script de código abierto
Fiel al espíritu de TradingView, el creador de este script lo ha convertido en código abierto, para que los traders puedan revisar y verificar su funcionalidad. ¡Enhorabuena al autor! Aunque puede utilizarlo de forma gratuita, recuerde que cualquier republicación del código está sujeta a nuestras Normas internas.
Exención de responsabilidad
La información y las publicaciones no constituyen, ni deben considerarse como, asesoramiento o recomendaciones financieras, de inversión, de trading u otro tipo, proporcionadas o respaldadas por TradingView. Obtenga más información en Condiciones de uso.
Script de código abierto
Fiel al espíritu de TradingView, el creador de este script lo ha convertido en código abierto, para que los traders puedan revisar y verificar su funcionalidad. ¡Enhorabuena al autor! Aunque puede utilizarlo de forma gratuita, recuerde que cualquier republicación del código está sujeta a nuestras Normas internas.
Exención de responsabilidad
La información y las publicaciones no constituyen, ni deben considerarse como, asesoramiento o recomendaciones financieras, de inversión, de trading u otro tipo, proporcionadas o respaldadas por TradingView. Obtenga más información en Condiciones de uso.