For code/output blocks: Use ``` (aka backtick or grave accent) in a single line before and after the block. See: http://commonmark.org/help/
Optimizing MA crossover periods in optstrategy
I have what I think is a fairly basic question, but can't seem to find the answer anywhere!
Say I have a simple MA crossover strategy(buy when fast MA crosses over slow MA, sell when fast MA crosses under slow MA).
Now, I want to test a wide range of parameters, but I would like to ensure that fast MA period is always smaller than the slow MA period.
This could also roughly cut the optimisation time in half.
I tried tinkering with cerebro.optstrategy:
cerebro.optstrategy( MACross, MAfast=list(range(2, 50, 2)), MAslow=[x > MAfast for x in list(range(10, 200, 10))],)
cerebro.optstrategy( MACross, MAfast=list(range(2, 50, 2)), MAslow=[x > self.p.MAfast for x in list(range(10, 200, 10))],)
or other variants using
MAslow=[x > MACross.p.MAfast for x in list(range(10, 200, 10))],)
MAslow=[x > strategy.p.MAfast for x in list(range(10, 200, 10))],)
but none of these seem to work...
I get errors like:
NameError: name 'MAfast' is not defined
NameError: name 'self' is not defined
Not sure how I can approach that problem...
Thanks for your help!
@run-out OK, wow, I thought it would be something way simpler...
I might just keep on deleting them from my results.