{"id":1135,"date":"2025-05-30T08:59:48","date_gmt":"2025-05-30T08:59:48","guid":{"rendered":"https:\/\/oneroyal.academy\/?page_id=1135"},"modified":"2025-12-15T13:43:30","modified_gmt":"2025-12-15T13:43:30","slug":"profit-calculator","status":"publish","type":"page","link":"https:\/\/www.oneroyal.academy\/pt\/calculators\/profit-calculator\/","title":{"rendered":"Calculadora de lucro"},"content":{"rendered":"\t\t<div data-elementor-type=\"wp-page\" data-elementor-id=\"1135\" class=\"elementor elementor-1135\" data-elementor-post-type=\"page\">\n\t\t\t\t<div class=\"elementor-element elementor-element-c492752 e-con-full hero-section-wrapper e-flex e-con e-parent\" data-id=\"c492752\" data-element_type=\"container\" data-e-type=\"container\">\n\t\t\t\t<div class=\"elementor-element elementor-element-ddbe264 elementor-widget elementor-widget-template\" data-id=\"ddbe264\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"template.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t<div class=\"elementor-template\">\n\t\t\t\t\t<div data-elementor-type=\"section\" data-elementor-id=\"75\" class=\"elementor elementor-75\" data-elementor-post-type=\"elementor_library\">\n\t\t\t<div class=\"elementor-element elementor-element-7ab5fd80 hero-section e-flex e-con-boxed e-con e-parent\" data-id=\"7ab5fd80\" data-element_type=\"container\" data-e-type=\"container\">\n\t\t\t\t\t<div class=\"e-con-inner\">\n\t\t<div class=\"elementor-element elementor-element-515a88e e-con-full left e-flex e-con e-child\" data-id=\"515a88e\" data-element_type=\"container\" data-e-type=\"container\">\n\t\t\t\t<div class=\"elementor-element elementor-element-1e73acea hero-heading elementor-widget elementor-widget-heading\" data-id=\"1e73acea\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"heading.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t<h1 class=\"elementor-heading-title elementor-size-default\">OneRoyal\u2019s Forex Profit Calculator<\/h1>\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-f81ef53 hero-description elementor-widget elementor-widget-heading\" data-id=\"f81ef53\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"heading.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t<p class=\"elementor-heading-title elementor-size-default\">Are you feeling overwhelmed with profit and loss calculation in forex trading? This easy-to-use profit calculator gives you instant results.\r\nEstimate your forex trading profits with our profit calculator. Assess your trading outcomes based on position size and how long you held it.<\/p>\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t<div class=\"elementor-element elementor-element-f2b1eac e-con-full ctas e-flex e-con e-child\" data-id=\"f2b1eac\" data-element_type=\"container\" data-e-type=\"container\">\n\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t<div class=\"elementor-element elementor-element-591de12a e-con-full right e-flex e-con e-child\" data-id=\"591de12a\" data-element_type=\"container\" data-e-type=\"container\" data-settings=\"{&quot;background_background&quot;:&quot;classic&quot;}\">\n\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t<div class=\"elementor-element elementor-element-b40ba8e e-flex e-con-boxed e-con e-parent\" data-id=\"b40ba8e\" data-element_type=\"container\" data-e-type=\"container\">\n\t\t\t\t\t<div class=\"e-con-inner\">\n\t\t\t\t<div class=\"elementor-element elementor-element-61d5335 calculators-title elementor-widget elementor-widget-heading\" data-id=\"61d5335\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"heading.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t<h2 class=\"elementor-heading-title elementor-size-default\">Profit Calculator<\/h2>\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-26bd0be calculators-subtitle elementor-widget elementor-widget-heading\" data-id=\"26bd0be\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"heading.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t<p class=\"elementor-heading-title elementor-size-default\">Calculate the profit you made from each trade<\/p>\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-7f75f07 elementor-widget elementor-widget-html\" data-id=\"7f75f07\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"html.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t<body>\n    <div class=\"profit-calculator\">\n        <div class=\"calc-row\">\n            <div class=\"calc-field\">\n                <label>Account Currency<\/label>\n                <select id=\"accountCurrency\">\n                    <option value=\"USD\">USD<\/option>\n                    <option value=\"EUR\" selected>EUR<\/option>\n                    <option value=\"AUD\">AUD<\/option>\n                    <option value=\"CAD\">CAD<\/option>\n                    <option value=\"GBP\">GBP<\/option>\n                    <option value=\"SGD\">SGD<\/option>\n                    <option value=\"NZD\">NZD<\/option>\n                    <option value=\"JPY\">JPY<\/option>\n                    <option value=\"HKD\">HKD<\/option>\n                    <option value=\"CHF\">CHF<\/option>\n                <\/select>\n            <\/div>\n            <div class=\"calc-field\">\n                <label>Currency Pair<\/label>\n                <select id=\"currencyPair\">\n                    <option value=\"AUDCAD\">AUD\/CAD<\/option>\n                    <option value=\"AUDCHF\">AUD\/CHF<\/option>\n                    <option value=\"AUDJPY\">AUD\/JPY<\/option>\n                    <option value=\"AUDNZD\">AUD\/NZD<\/option>\n                    <option value=\"AUDSGD\">AUD\/SGD<\/option>\n                    <option value=\"AUDUSD\">AUD\/USD<\/option>\n                    <option value=\"CADCHF\">CAD\/CHF<\/option>\n                    <option value=\"CADJPY\">CAD\/JPY<\/option>\n                    <option value=\"CHFJPY\">CHF\/JPY<\/option>\n                    <option value=\"CHFSGD\">CHF\/SGD<\/option>\n                    <option value=\"EURAUD\">EUR\/AUD<\/option>\n                    <option value=\"EURCAD\">EUR\/CAD<\/option>\n                    <option value=\"EURCHF\">EUR\/CHF<\/option>\n                    <option value=\"EURDKK\">EUR\/DKK<\/option>\n                    <option value=\"EURGBP\">EUR\/GBP<\/option>\n                    <option value=\"EURHKD\">EUR\/HKD<\/option>\n                    <option value=\"EURJPY\">EUR\/JPY<\/option>\n                    <option value=\"EURNOK\">EUR\/NOK<\/option>\n                    <option value=\"EURNZD\">EUR\/NZD<\/option>\n                    <option value=\"EURPLN\">EUR\/PLN<\/option>\n                    <option value=\"EURSEK\">EUR\/SEK<\/option>\n                    <option value=\"EURSGD\">EUR\/SGD<\/option>\n                    <option value=\"EURTRY\">EUR\/TRY<\/option>\n                    <option value=\"EURUSD\">EUR\/USD<\/option>\n                    <option value=\"EURZAR\">EUR\/ZAR<\/option>\n                    <option value=\"GBPAUD\">GBP\/AUD<\/option>\n                    <option value=\"GBPCAD\">GBP\/CAD<\/option>\n                    <option value=\"GBPCHF\">GBP\/CHF<\/option>\n                    <option value=\"GBPDKK\">GBP\/DKK<\/option>\n                    <option value=\"GBPJPY\">GBP\/JPY<\/option>\n                    <option value=\"GBPNOK\">GBP\/NOK<\/option>\n                    <option value=\"GBPNZD\">GBP\/NZD<\/option>\n                    <option value=\"GBPSEK\">GBP\/SEK<\/option>\n                    <option value=\"GBPSGD\">GBP\/SGD<\/option>\n                    <option value=\"GBPUSD\" selected>GBP\/USD<\/option>\n                    <option value=\"NOKJPY\">NOK\/JPY<\/option>\n                    <option value=\"NOKSEK\">NOK\/SEK<\/option>\n                    <option value=\"NZDCAD\">NZD\/CAD<\/option>\n                    <option value=\"NZDCHF\">NZD\/CHF<\/option>\n                    <option value=\"NZDJPY\">NZD\/JPY<\/option>\n                    <option value=\"NZDUSD\">NZD\/USD<\/option>\n                    <option value=\"SEKJPY\">SEK\/JPY<\/option>\n                    <option value=\"SGDJPY\">SGD\/JPY<\/option>\n                    <option value=\"USDCAD\">USD\/CAD<\/option>\n                    <option value=\"USDCHF\">USD\/CHF<\/option>\n                    <option value=\"USDCNH\">USD\/CNH<\/option>\n                    <option value=\"USDCZK\">USD\/CZK<\/option>\n                    <option value=\"USDDKK\">USD\/DKK<\/option>\n                    <option value=\"USDHKD\">USD\/HKD<\/option>\n                    <option value=\"USDHUF\">USD\/HUF<\/option>\n                    <option value=\"USDJPY\">USD\/JPY<\/option>\n                    <option value=\"USDMXN\">USD\/MXN<\/option>\n                    <option value=\"USDNOK\">USD\/NOK<\/option>\n                    <option value=\"USDPLN\">USD\/PLN<\/option>\n                    <option value=\"USDSEK\">USD\/SEK<\/option>\n                    <option value=\"USDSGD\">USD\/SGD<\/option>\n                    <option value=\"USDTHB\">USD\/THB<\/option>\n                    <option value=\"USDTRY\">USD\/TRY<\/option>\n                    <option value=\"USDZAR\">USD\/ZAR<\/option>\n                <\/select>\n            <\/div>\n            <div class=\"calc-field\">\n                <label>Position Size<\/label>\n                <input type=\"number\" id=\"positionSize\" value=\"10000\" min=\"0\" step=\"0.01\">\n            <\/div>\n        <\/div>\n        \n        <div class=\"trade-direction\">\n            <label>Trade Side<\/label>\n            <div class=\"calc-row radio-row\">\n                <div class=\"calc-field radio\">\n                    <input type=\"radio\" name=\"tradeSide\" id=\"buy\" value=\"0\" checked>\n                    <label for=\"buy\">Buy\/Long<\/label>\n                <\/div>\n                <div class=\"calc-field radio\">\n                    <input type=\"radio\" name=\"tradeSide\" id=\"sell\" value=\"1\">\n                    <label for=\"sell\">Sell\/Long<\/label>\n                <\/div>\n            <\/div>\n        <\/div>\n        \n        <div class=\"calc-row\">\n            <div class=\"calc-field\">\n                <label>Opening Price<\/label>\n                <input type=\"number\" id=\"openingPrice\" value=\"1.15823\" step=\"0.00001\">\n            <\/div>\n            <div class=\"calc-field\">\n                <label>Closing Price<\/label>\n                <input type=\"number\" id=\"closingPrice\" value=\"1.16007\" step=\"0.00001\">\n            <\/div>\n            <div class=\"calc-field\">\n                <label>Days<\/label>\n                <input type=\"number\" id=\"days\" value=\"0\" min=\"0\" step=\"1\">\n            <\/div>\n        <\/div>\n        \n        <div class=\"calc-row\">\n            <div class=\"calc-field\">\n                <label>Swap Long<\/label>\n                <input type=\"number\" id=\"swapLong\" value=\"0.00\" readonly step=\"0.01\">\n            <\/div>\n            <div class=\"calc-field\">\n                <label>Swap Short<\/label>\n                <input type=\"number\" id=\"swapShort\" value=\"0.00\" readonly step=\"0.01\">\n            <\/div>\n        <\/div>\n        <div class=\"calc-field result\">\n            <div class=\"result-box\">\n                <div class=\"result-label\">Total Profit\/Loss<\/div>\n                <div class=\"result-value\" id=\"result\">0.00<\/div>\n            <\/div>\n        <\/div>\n        <div class=\"error-message\" id=\"errorMessage\"><\/div>\n    <\/div>\n\n    <script>\n        \/\/ Currency pair configurations\n        const CURRENCY_PAIRS = [\n            { n: \"AUDCAD\", d: 5, p: 0.0001 },\n            { n: \"AUDCHF\", d: 5, p: 0.0001 },\n            { n: \"AUDJPY\", d: 3, p: 0.01 },\n            { n: \"AUDNZD\", d: 5, p: 0.0001 },\n            { n: \"AUDSGD\", d: 5, p: 0.0001 },\n            { n: \"AUDUSD\", d: 5, p: 0.0001 },\n            { n: \"CADCHF\", d: 5, p: 0.0001 },\n            { n: \"CADJPY\", d: 3, p: 0.01 },\n            { n: \"CHFJPY\", d: 3, p: 0.01 },\n            { n: \"CHFSGD\", d: 5, p: 0.0001 },\n            { n: \"EURAUD\", d: 5, p: 0.0001 },\n            { n: \"EURCAD\", d: 5, p: 0.0001 },\n            { n: \"EURCHF\", d: 5, p: 0.0001 },\n            { n: \"EURDKK\", d: 5, p: 0.0001 },\n            { n: \"EURGBP\", d: 5, p: 0.0001 },\n            { n: \"EURHKD\", d: 5, p: 0.0001 },\n            { n: \"EURJPY\", d: 3, p: 0.01 },\n            { n: \"EURNOK\", d: 5, p: 0.0001 },\n            { n: \"EURNZD\", d: 5, p: 0.0001 },\n            { n: \"EURPLN\", d: 5, p: 0.0001 },\n            { n: \"EURSEK\", d: 5, p: 0.0001 },\n            { n: \"EURSGD\", d: 5, p: 0.0001 },\n            { n: \"EURTRY\", d: 5, p: 0.0001 },\n            { n: \"EURUSD\", d: 5, p: 0.0001 },\n            { n: \"EURZAR\", d: 5, p: 0.0001 },\n            { n: \"GBPAUD\", d: 5, p: 0.0001 },\n            { n: \"GBPCAD\", d: 5, p: 0.0001 },\n            { n: \"GBPCHF\", d: 5, p: 0.0001 },\n            { n: \"GBPDKK\", d: 5, p: 0.0001 },\n            { n: \"GBPJPY\", d: 3, p: 0.01 },\n            { n: \"GBPNOK\", d: 5, p: 0.0001 },\n            { n: \"GBPNZD\", d: 5, p: 0.0001 },\n            { n: \"GBPSEK\", d: 5, p: 0.0001 },\n            { n: \"GBPSGD\", d: 5, p: 0.0001 },\n            { n: \"GBPUSD\", d: 5, p: 0.0001 },\n            { n: \"NOKJPY\", d: 3, p: 0.01 },\n            { n: \"NOKSEK\", d: 5, p: 0.0001 },\n            { n: \"NZDCAD\", d: 5, p: 0.0001 },\n            { n: \"NZDCHF\", d: 5, p: 0.0001 },\n            { n: \"NZDJPY\", d: 3, p: 0.01 },\n            { n: \"NZDUSD\", d: 5, p: 0.0001 },\n            { n: \"SEKJPY\", d: 3, p: 0.01 },\n            { n: \"SGDJPY\", d: 3, p: 0.01 },\n            { n: \"USDCAD\", d: 5, p: 0.0001 },\n            { n: \"USDCHF\", d: 5, p: 0.0001 },\n            { n: \"USDCNH\", d: 5, p: 0.0001 },\n            { n: \"USDCZK\", d: 4, p: 0.001 },\n            { n: \"USDDKK\", d: 5, p: 0.0001 },\n            { n: \"USDHKD\", d: 5, p: 0.0001 },\n            { n: \"USDHUF\", d: 3, p: 0.01 },\n            { n: \"USDJPY\", d: 3, p: 0.01 },\n            { n: \"USDMXN\", d: 5, p: 0.0001 },\n            { n: \"USDNOK\", d: 5, p: 0.0001 },\n            { n: \"USDPLN\", d: 5, p: 0.0001 },\n            { n: \"USDSEK\", d: 5, p: 0.0001 },\n            { n: \"USDSGD\", d: 5, p: 0.0001 },\n            { n: \"USDTHB\", d: 5, p: 0.0001 },\n            { n: \"USDTRY\", d: 5, p: 0.0001 },\n            { n: \"USDZAR\", d: 5, p: 0.0001 }\n        ];\n\n        \/\/ API Configuration\n        const API_ENDPOINT = 'https:\/\/api.OneRoyal.io';\n\n        let profitData = null;\n        let isLoading = false;\n\n        const accountSelect = document.getElementById('accountCurrency');\n        const pairSelect = document.getElementById('currencyPair');\n        const sizeInput = document.getElementById('positionSize');\n        const sideRadios = document.querySelectorAll('input[name=\"tradeSide\"]');\n        const openInput = document.getElementById('openingPrice');\n        const closeInput = document.getElementById('closingPrice');\n        const daysInput = document.getElementById('days');\n        const longInput = document.getElementById('swapLong');\n        const shortInput = document.getElementById('swapShort');\n        const resultDiv = document.getElementById('result');\n        const errorMessage = document.getElementById('errorMessage');\n        const container = document.querySelector('.profit-calculator');\n\n        function parseSwapsData(swapsData) {\n            let arr = swapsData;\n            let obj = {};\n            if (arr && arr.length) {\n                for (let i = 0, len = arr.length, s, n, l, r; i < len; i++) {\n                    s = arr[i];\n                    n = s['Symbol'];\n                    l = s['SwapLong'];\n                    r = s['SwapShort'];\n                    if (obj[n] == null) {\n                        obj[n] = {\n                            long: parseFloat(l),\n                            short: parseFloat(r)\n                        };\n                    }\n                }\n            }\n            return obj;\n        }\n\n        function showError(message) {\n            errorMessage.textContent = message;\n            errorMessage.style.display = 'block';\n            setTimeout(() => {\n                errorMessage.style.display = 'none';\n            }, 5000);\n        }\n\n        function hideError() {\n            errorMessage.style.display = 'none';\n        }\n\n        function setLoading(loading) {\n            isLoading = loading;\n            if (loading) {\n                container.classList.add('loading');\n                resultDiv.textContent = 'Loading...';\n            } else {\n                container.classList.remove('loading');\n            }\n        }\n\n        async function fetchData(url) {\n            try {\n                const response = await fetch(url);\n                if (!response.ok) {\n                    throw new Error(`HTTP error! status: ${response.status}`);\n                }\n                const data = await response.json();\n                return data;\n            } catch (error) {\n                console.error('Error fetching data:', error);\n                throw error;\n            }\n        }\n\n        async function getProfitData() {\n            if (isLoading) return;\n            \n            setLoading(true);\n            hideError();\n            \n            try {\n                const url = `${API_ENDPOINT}\/api\/calculator\/profit?account=${accountSelect.value}&pair=${pairSelect.value}&volume=${sizeInput.value}`;\n                const res = await fetchData(url);\n                \n                if (!res?.result) {\n                    throw new Error('Invalid response from server');\n                }\n                \n                profitData = res.result;\n                updateProfit();\n            } catch (error) {\n                showError('Failed to fetch profit data. Using demo data.');\n                updateProfitDemo();\n            } finally {\n                setLoading(false);\n            }\n        }\n\n        function updateProfit() {\n            if (!profitData) return getProfitData();\n            \n            let swaps = {};\n            const pair = pairSelect.value;\n            \n            if (profitData[3] && profitData[3].swaps) {\n                swaps = parseSwapsData(profitData[3].swaps);\n            } else {\n                swaps[pair] = {\n                    long: 0,\n                    short: 0\n                };\n            }\n            \n            const account = accountSelect.value;\n            const size = parseFloat(sizeInput.value) || 0;\n            const side = document.querySelector('input[name=\"tradeSide\"]:checked').value;\n            const open = parseFloat(openInput.value) || 0;\n            const close = parseFloat(closeInput.value) || 0;\n            const days = parseInt(daysInput.value) || 0;\n\n            const curs = [pair.slice(0, 3), pair.slice(3)];\n            const price = profitData[2].rates[account] || 1;\n            const swapPrice = profitData[1].rates[curs[1]] || 1;\n            const pairsPrice = profitData[0].rates[curs[1]] || price;\n            \n            let currencyPair = CURRENCY_PAIRS.find(c => c.n === pair);\n            if (!currencyPair) currencyPair = CURRENCY_PAIRS.find(c => c.n === curs[1] + curs[0]);\n            if (!currencyPair) currencyPair = CURRENCY_PAIRS.find(c => c.n === curs[0] + 'USD');\n            if (!currencyPair) currencyPair = CURRENCY_PAIRS.find(c => c.n === 'USD' + curs[0]);\n            if (!currencyPair) currencyPair = CURRENCY_PAIRS.find(c => c.n === curs[1] + 'USD');\n            if (!currencyPair) currencyPair = CURRENCY_PAIRS.find(c => c.n === 'USD' + curs[1]);\n            if (!currencyPair) currencyPair = { d: 5, p: 0.0001 };\n            \n            const digits = currencyPair.d;\n            const pip = currencyPair.p;\n            \n            let pipValue = ((pip * size) \/ price);\n            let swapPipValue = ((pip * size) \/ swapPrice);\n            let swapLongValue = (swapPipValue * (swaps[pair] ? swaps[pair].long : 0)) \/ 10;\n            let swapShortValue = (swapPipValue * (swaps[pair] ? swaps[pair].short : 0)) \/ 10;\n            let openPrice = parseFloat(open.toFixed(digits));\n            let closePrice = parseFloat(close.toFixed(digits));\n            let swapLong = swapLongValue.toFixed(2);\n            let swapShort = swapShortValue.toFixed(2);\n            let swap = (side === '0' ? swapLongValue : swapShortValue);\n            let profitValue = 0;\n            \n            if (side === '1') { \/\/ sell\n                profitValue = ((openPrice - closePrice) * size * price + (days * swap)).toFixed(2);\n            } else { \/\/ buy\n                profitValue = ((closePrice - openPrice) * size * price + (days * swap)).toFixed(2);\n            }\n            \n            longInput.value = swapLong;\n            shortInput.value = swapShort;\n            resultDiv.textContent = profitValue;\n        }\n\n        \/\/ Demo function for fallback\n        function updateProfitDemo() {\n            const account = accountSelect.value;\n            const size = parseFloat(sizeInput.value) || 0;\n            const pair = pairSelect.value;\n            const side = document.querySelector('input[name=\"tradeSide\"]:checked').value;\n            const open = parseFloat(openInput.value) || 0;\n            const close = parseFloat(closeInput.value) || 0;\n            const days = parseInt(daysInput.value) || 0;\n\n            const curs = [pair.slice(0, 3), pair.slice(3)];\n            \n            \/\/ Demo exchange rates and swaps\n            const demoRates = {\n                'USD': 1.0, 'EUR': 0.93, 'GBP': 0.79, 'JPY': 0.0067,\n                'AUD': 0.65, 'CAD': 0.74, 'CHF': 1.12, 'SGD': 0.74,\n                'NZD': 0.60, 'HKD': 0.128\n            };\n            \n            const demoSwaps = {\n                'GBPUSD': { long: -2.5, short: 0.5 },\n                'EURUSD': { long: -3.2, short: 1.2 },\n                'USDJPY': { long: 1.8, short: -4.1 },\n                'AUDUSD': { long: -1.8, short: 0.3 },\n                'USDCAD': { long: 0.5, short: -2.1 }\n            };\n            \n            const price = demoRates[account] || 1.0;\n            const swapData = demoSwaps[pair] || { long: 0, short: 0 };\n            \n            let currencyPair = CURRENCY_PAIRS.find(c => c.n === pair);\n            if (!currencyPair) currencyPair = { d: 5, p: 0.0001 };\n            \n            const digits = currencyPair.d;\n            const pip = currencyPair.p;\n            \n            let pipValue = (pip * size) \/ price;\n            let swapLongValue = (pipValue * swapData.long) \/ 10;\n            let swapShortValue = (pipValue * swapData.short) \/ 10;\n            let openPrice = parseFloat(open.toFixed(digits));\n            let closePrice = parseFloat(close.toFixed(digits));\n            let swap = (side === '0' ? swapLongValue : swapShortValue);\n            let profitValue = 0;\n            \n            if (side === '1') { \/\/ sell\n                profitValue = ((openPrice - closePrice) * size * price + (days * swap)).toFixed(2);\n            } else { \/\/ buy\n                profitValue = ((closePrice - openPrice) * size * price + (days * swap)).toFixed(2);\n            }\n            \n            longInput.value = swapLongValue.toFixed(2);\n            shortInput.value = swapShortValue.toFixed(2);\n            resultDiv.textContent = profitValue;\n        }\n\n        \/\/ Debounce function to limit API calls\n        function debounce(func, wait) {\n            let timeout;\n            return function executedFunction(...args) {\n                const later = () => {\n                    clearTimeout(timeout);\n                    func(...args);\n                };\n                clearTimeout(timeout);\n                timeout = setTimeout(later, wait);\n            };\n        }\n\n        \/\/ Create debounced version of getProfitData\n        const debouncedGetProfitData = debounce(getProfitData, 300);\n\n        \/\/ Event listeners\n        sizeInput.addEventListener('input', debouncedGetProfitData);\n        accountSelect.addEventListener('change', () => {\n            profitData = null;\n            getProfitData();\n        });\n        pairSelect.addEventListener('change', () => {\n            profitData = null;\n            getProfitData();\n        });\n        sideRadios.forEach(radio => radio.addEventListener('change', updateProfit));\n        openInput.addEventListener('input', updateProfit);\n        closeInput.addEventListener('input', updateProfit);\n        daysInput.addEventListener('input', updateProfit);\n\n        \/\/ Initialize\n        getProfitData();\n    <\/script>\n<\/body>\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t<div class=\"elementor-element elementor-element-c77a63b e-con-full e-flex e-con e-child\" data-id=\"c77a63b\" data-element_type=\"container\" data-e-type=\"container\">\n\t\t\t\t<div class=\"elementor-element elementor-element-637bac5 elementor-widget__width-initial elementor-widget elementor-widget-text-editor\" data-id=\"637bac5\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t<svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"24\" height=\"24\" viewBox=\"0 0 24 24\" fill=\"none\">\n<path d=\"M12 16V12M12 8H12.01M22 12C22 17.5228 17.5228 22 12 22C6.47715 22 2 17.5228 2 12C2 6.47715 6.47715 2 12 2C17.5228 2 22 6.47715 22 12Z\" stroke=\"#111827\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"\/>\n<\/svg>\n<p>Let\u2019s say, your base currency is EUR and you wish to trade the GBP\/USD forex pair. You will select EUR from the dropdown in the Account Currency field and GBP\/USD from the dropdown in the Currency Pair field.\u00a0\u00a0<\/p>\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-5dec67f elementor-widget__width-initial elementor-widget elementor-widget-text-editor\" data-id=\"5dec67f\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\tLet\u2019s assume your desired position size is 10,000. Input this in the Position Size field. You went long, opening your position at a price of 1.15833 and closed it 5 days later at a price of 1.16007. So, you will select the button next to BUY\/LONG, input 1.15833 in the Opening Trade Price field and 1.16007 in the Closing Trade Price field.\u00a0\u00a0\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-5311c33 elementor-widget__width-initial elementor-widget elementor-widget-text-editor\" data-id=\"5311c33\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\tYou will then input \u201c5\u201d in the Period in Days field. You will instantly see your profit of EUR15.58 in the Profit field. If the value in the Profit field is negative, it means you made a loss on the trade.\u00a0\u00a0\u00a0\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t","protected":false},"excerpt":{"rendered":"<p>Profit Calculator Calculate the profit you made from each trade Account Currency USDEURAUDCADGBPSGDNZDJPYHKDCHF Currency Pair AUD\/CADAUD\/CHFAUD\/JPYAUD\/NZDAUD\/SGDAUD\/USDCAD\/CHFCAD\/JPYCHF\/JPYCHF\/SGDEUR\/AUDEUR\/CADEUR\/CHFEUR\/DKKEUR\/GBPEUR\/HKDEUR\/JPYEUR\/NOKEUR\/NZDEUR\/PLNEUR\/SEKEUR\/SGDEUR\/TRYEUR\/USDEUR\/ZARGBP\/AUDGBP\/CADGBP\/CHFGBP\/DKKGBP\/JPYGBP\/NOKGBP\/NZDGBP\/SEKGBP\/SGDGBP\/USDNOK\/JPYNOK\/SEKNZD\/CADNZD\/CHFNZD\/JPYNZD\/USDSEK\/JPYSGD\/JPYUSD\/CADUSD\/CHFUSD\/CNHUSD\/CZKUSD\/DKKUSD\/HKDUSD\/HUFUSD\/JPYUSD\/MXNUSD\/NOKUSD\/PLNUSD\/SEKUSD\/SGDUSD\/THBUSD\/TRYUSD\/ZAR Position Size Trade Side Buy\/Long Sell\/Long Opening Price Closing Price Days Swap Long Swap Short Total Profit\/Loss 0.00 Let\u2019s say, your base currency is EUR and you wish to trade the GBP\/USD forex pair. You will select EUR from [&hellip;]<\/p>\n","protected":false},"author":4,"featured_media":0,"parent":1127,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"_acf_changed":false,"inline_featured_image":false,"footnotes":""},"class_list":["post-1135","page","type-page","status-publish","hentry"],"acf":[],"_links":{"self":[{"href":"https:\/\/www.oneroyal.academy\/pt\/wp-json\/wp\/v2\/pages\/1135","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.oneroyal.academy\/pt\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/www.oneroyal.academy\/pt\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/www.oneroyal.academy\/pt\/wp-json\/wp\/v2\/users\/4"}],"replies":[{"embeddable":true,"href":"https:\/\/www.oneroyal.academy\/pt\/wp-json\/wp\/v2\/comments?post=1135"}],"version-history":[{"count":22,"href":"https:\/\/www.oneroyal.academy\/pt\/wp-json\/wp\/v2\/pages\/1135\/revisions"}],"predecessor-version":[{"id":2045,"href":"https:\/\/www.oneroyal.academy\/pt\/wp-json\/wp\/v2\/pages\/1135\/revisions\/2045"}],"up":[{"embeddable":true,"href":"https:\/\/www.oneroyal.academy\/pt\/wp-json\/wp\/v2\/pages\/1127"}],"wp:attachment":[{"href":"https:\/\/www.oneroyal.academy\/pt\/wp-json\/wp\/v2\/media?parent=1135"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}