in this code I am trying to put two scaled financial numbers on the chart after scaling them:
- Free Cash Flow
- Net Income
But they look similar after scaling them, I tried many ways to scale them but I get the same issue.
Can anyone tell me how to solve this issue?
Here is the code I wrote
//@version=6
indicator("Stocks In an Index", "Stocks Analysis", overlay=false)
//Free Cash Flow
FreeCashFlow = request.financial(syminfo.tickerid, "FREE_CASH_FLOW", "FY")
var float FreeCashFlowMin = na
var float FreeCashFlowMax = na
if not na(FreeCashFlow)
FreeCashFlowMin := na(FreeCashFlowMin) ? FreeCashFlow : (FreeCashFlow < FreeCashFlowMin ? FreeCashFlow : FreeCashFlowMin)
FreeCashFlowMax := na(FreeCashFlowMax) ? FreeCashFlow : (FreeCashFlow > FreeCashFlowMax ? FreeCashFlow : FreeCashFlowMax)
normalizedFreeCashFlow = not na(FreeCashFlow) and (FreeCashFlowMax != FreeCashFlowMin) ? (FreeCashFlow - FreeCashFlowMin) / (FreeCashFlowMax - FreeCashFlowMin) : na
plot(normalizedFreeCashFlow, color=color.purple, title="Normalized FREE_CASH_FLOW")
//Net Income
netIncome = request.financial(syminfo.tickerid, "NET_INCOME", "FY")
var float netIncomeMin = na
var float netIncomeMax = na
if not na(FreeCashFlow)
netIncomeMin := na(netIncomeMin) ? netIncome : (netIncome < netIncomeMin ? netIncome : netIncomeMin)
netIncomeMax := na(netIncomeMax) ? netIncome : (netIncome > netIncomeMax ? netIncome : netIncomeMax)
normalizednetIncome = not na(netIncome) and (netIncomeMax != netIncomeMin) ? (netIncome - netIncomeMin) / (netIncomeMax - netIncomeMin) : na
plot(normalizednetIncome, color=color.green, title="Normalized Net Income")