Misery index strategy
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © DynamicSignalLab
//@version=5
strategy("Misery index", overlay=false)
unemployment = request.security("FRED:UNRATE","M",close) 
inflation = request.security("ECONOMICS:USIRYY","M",close)
misery = unemployment+inflation
plot(misery)
longCondition = misery<misery[1]
if (longCondition)
    strategy.entry("My Long Entry Id", strategy.long)

shortCondition = misery>misery[1]
if (shortCondition)
    strategy.entry("My Short Entry Id", strategy.short)
