Hello Everybody,
Hope someone can help me. For a while i was having no trouble with a tradingsystem that run on multiple timeframes. On the four hour chart it watsches the historic volatility and on the 5 minutes charts i watch the trend . The system has worked perfectly, but suddenly i got the error that there was a division by zero.
I checked everything and pinpointed it to the coding i use to first check the 4 hour chart and use this as a condition in my 5 minute chart.
The coding without multiple timeframes was:
DEFPARAM CumulateOrders = False
DEFPARAM FLATBEFORE = 080000
DEFPARAM FLATAFTER = 220000
daysForbiddenEntry = OpenDayOfWeek = 6 OR OpenDayOfWeek = 0
ONCE Nbbarlimit = L
var1 = ExponentialAverage[20](close)>= ExponentialAverage[100](close)
var2 = High[0] < High[1]
var3 = Low[0] > Low[1]
var4 = ExponentialAverage[20](close)<= ExponentialAverage[100](close)
var5 = myhv >= B
indicator1 = CALL "Moving Average"[20, 1](close)
c1 = (indicator1 >= 8)
C2 = (indicator1 <= -8)
IF not onmarket and var1 AND var2 AND var3 and C1 then
When i add the coding for the multple timerframes it now gives the error “divison by 0”. Does anybody know what i am doing wrong?
DEFPARAM CumulateOrders = False
DEFPARAM FLATBEFORE = 080000
DEFPARAM FLATAFTER = 220000
daysForbiddenEntry = OpenDayOfWeek = 6 OR OpenDayOfWeek = 0
timeframe(4hour)
myhv = HistoricVolatility[20](close)
timeframe(5minute)
ONCE Nbbarlimit = L
var1 = ExponentialAverage[20](close)>= ExponentialAverage[100](close)
var2 = High[0] < High[1]
var3 = Low[0] > Low[1]
var4 = ExponentialAverage[20](close)<= ExponentialAverage[100](close)
var5 = myhv >= 0.12
indicator1 = CALL "Moving Average"[20, 1](close)
c1 = (indicator1 >= 8)
C2 = (indicator1 <= -8)
IF not onmarket and var1 AND var2 AND var3 and C1 then
kind regards,
Jaldidee
A “division by zero”error is expected to be reported by a division,
I can’t spot any division in your code, so it’s impossible to know the source.
Maybe there’s a division in the indicator or in the missing code.
Check your “Moving Average” indicator’s code for any division.