ICT index correlated market indicator
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © SimoneMicucci00

//@version=5
indicator("Correlation indicator", "Correlation Analisys")

//input data
sel = input.string("S&P500", "main source", ["S&P500", "Nasdaq", "Dow Jon IA", "DXY", "EURUSD", "GBPUSD"])
other = input.bool(false, "", "", "1")
sel2 = input.symbol("ES1!", "other source", "", "1")

//input customization
BullBodyColor = input.color(#00bc08, "body", "", "x", "color")
BearBodyColor = input.color(#000000, "", "", "x", "color")
BullBorderColor = input.color(#000000, "border", "", "y", "color")
BearBorderColor = input.color(#000000, "", "", "y", "color")
BullWickColor = input.color(#000000, "wick", "", "z", "color")
BearWickColor = input.color(#000000, "", "", "z", "color")

//data selector
data = other ? sel2 : sel == "S&P500" ? "ES1!" : sel == "Nasdaq" ? "NQ1!" : sel == "Dow Jon IA" ? "YM1!" : sel == "DXY" ? "TVC:DXY" :
     sel == "EURUSD" ? "FX:EURUSD" : sel == "GBPUSD" ? "FX:GBPUSD" : na

//data request
open_ = request.security(data,"",open)
high_ = request.security(data,"",high)
low_ = request.security(data,"",low)
close_ = request.security(data,"",close)

//plot
plotcandle(open_, high_, low_, close_, "Data selected", open_<close_ ? BullBodyColor : BearBodyColor, open_<close_ ? BullWickColor : BearBodyColor, bordercolor = open_<close_ ? BullBorderColor : BearBorderColor)
