Okay so I am trying to optimize but keep getting same result for each parameter except the best optimal result. How can I go about it? Check below for screenshots. Here lies the code:
Yes that is true the ma_period variable isnt used in the trade rule, I get it now why it was not optimized. But in reality, the ma_period affects the bands of the bollinger thereby affecting the entry and exit signals.
How can I include the ma_period variable in optimization yet excluded from the trade rules?
I'm not sure what you are trying to do. If you pass the ma_period to the BBands function, it will be optimized. But why would you want to exclude it from the trade rules?
It was excluded from the trading rules because I want a bollinger system that enters on a breakout and exit and also reverse position on the breakout to the other side
Your code makes no logical sense to me. You optimize the ma_period for no reason and your rRealUpperBand & rRealLowerBand variables have default values.