Possible to use a variable in this situation?
2 replies
Threshold
11 years ago #113938
This is just 1 example, but it could be applicable to an infinite number of situations.
Here it is.
I’m defining the trend for a piece of a strategy.
Create variables
‘Bullish’ = false
‘Bearish = false
————————————
if
close [1]> 200SMA
close [2]> 200SMA
close [3]> 200SMA
then
assign variable
Bullish = true
assign variable
Bearish = false
————————————-
if
close [1]< 200SMA
close [2]< 200SMA
close [3]< 200SMA
then
assign variable
Bullish = false
assign variable
Bearish = true
I want to optimize the number of closes above or below the 200SMA to find the best ‘definition’ of a bull or bear trend. Is it possible to create a variable for the number of closes >/< 200SMA?
0
Tomas Matejka
11 years ago #131300
This would require an additional function because to count closes above MA you need to use “cycle from 1 to X”. I will consider posting code here or adding it to next EA Wizard update.
0
Threshold
11 years ago #131301
Thanks, I find myself running into this very often. Would be a big help to have a way to optimize it.
0
Viewing 2 replies - 1 through 2 (of 2 total)