Tony, Thanks for the idea. I seem to get even more bizarre results using ==.
The results using _trace and text output are consistent. By way of example I now get: XPermK = 88.497 XPermD = 89.110 XpermShort = 0.000 XpermLong = 1.000 Test1L = 0.000 Test2L = 0.000 Test3L = 0.000 Test1S = 0.000 Test2S = 0.000 Test3S = 0.000 Value4 = 100.000 TempL = 0.000 Inter2 = 0.613 Upperbound is 85 and lowerbound is 15. Hence, would expect to find templ is true and test1L is true etc... ----- Original Message ----- From: Tony Grimes To: [email protected] Sent: Saturday, December 02, 2006 1:19 PM Subject: Re: [amibroker] Code Help Please Try using == instead of = in your IIF statements. For example, IIF(templ = True should be coded as IIF(templ == True David Jennings wrote: I have a piece of code which seems straight forward but I seem to be struggling. i have written it in a number of different ways e.g. using if statements in a loop and using iif statements as below. However, I seem to have a problem which ever way I write it insofar that Test1L & Test1S fail to evaluate correctly. Herewith a snippet: t1 = XPermK - XpermD; inter2 = abs(XPermK - XpermD); TempL = IIf (XpermD[j] >UpperBound AND XPermK[j] >UpperBound, True,False); Test1L = IIf(tempL = True AND abs(t1) < 2, True, False); Test2L= IIf(XpermD < Lowerbound AND XPermK < Lowerbound AND t1 > 2.0,True, False); Test3L=IIf(XPermK >Lowerbound AND XPermK > XPermD,True,False); Test1S = IIf(XpermD < Lowerbound AND XPermK < Lowerbound AND abs(t1) < 2,True,False); Test2S = IIf(XpermD > UpperBound AND XPermK[k] > UpperBound AND t1> 2,True,False); Test3S = IIf(XPermK < UpperBound AND XPermK < XPermD,True,False); XPermLong = IIf(Test1L = True OR Test2L[j] = True OR Test3L[j] = True,True, False); XpermShort =IIf(Test1S = True OR Test2S = True OR Test3S = True,True,False); For instance Test1l can return false and Test1L will evaluate as true. Most grateful if someone could help me understand why I have it around my neck.
