Reply

Possible to use a variable in this situation?

2 replies

Threshold

Customer, bbp_participant, community, 715 replies.

Visit profile

6 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

tomas262

Administrator, sq-ultimate, 679 replies.

Visit profile

6 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

Customer, bbp_participant, community, 715 replies.

Visit profile

6 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 3 posts - 1 through 3 (of 3 total)