I was hoping to get some assistance regarding adding constraints to parameters when running optimization on a strategy.
Specifically, I have a few parameters I am optimizing which could all theoretically be any value between .5 and 3. However, there are certain parameters which should always be less than others in order for the strategy to function properly. For instance if I have a variable RR, which represents the risk/reward of the trade structure, and another variable BE which represents the R multiple needed to move stop to breakeven, ideally BE should always be less than RR. If the optimizer tried something like a "2 RR" value with a "3 BE" value, that would essentially cancel the function out all together.
Currently, in the actual strategy I am trying to optimize, I have 4 parameters which I'd like to have some sort of rules for:
RR- double representing initial risk/reward structure of trade
BE- double representing relative "RR" multiple needed to move stop to entry price
PL - double representing relative "RR" multiple needed to move stop into profit
ProfitLock - double representing relative "RR" amount of profit to lock in (controls how far into profit stop is moved)
Since these are all relative to RR, I'd really like a way to constrain the optimizer to making sure that it does not make any of these parameters greater than RR while searching for parameter values. Preferably I'd also like BE to always be < PL, and Profitlock to always be < PL, and RR to always be the greatest value of the 4.
A workaround would be hard coding a check inside the code that automatically changes the values if they are not structured correctly, but I'd prefer the optimizer handle this so it can be more efficient.
Thanks,
Curtis
Comment