|
Algorithmic Trading
< Previous Next >
Re: Edit logicOperator="XOR"
Sergey Axenov / Metabit Systems Co., Ltd. 10 May 2010 9:25PM ET Thank you, everyone, for your opinions. I agree that the safest approach is to ask the client to refactor atdl file. That's what I am going to do.
However, just a small comment on ...
> All logical operators are binary....
Yes, it is true that all logical operators (AND, OR, XOR) can be considered as binary. But, for example, in Java and C# we can write an expression:
boolean result1 = true ^ true ^ true ^ true; (result1 = false - even number of true arguments)
boolean result2 = true ^ true ^ false ^ true; (result2 = true - odd number of true arguments)
boolean result3 = true ^ false ^ false ^ true; (result2 = false - even number of true arguments)
no matter what is your expression interpretation rules are:
- like that: true ^ (true ^ (true ^ true))
- or like that: (((true ^ true) ^ true) ^ true)
result going to be the same because the XOR operator in those languages is associative. I believe it is associative in many other languages too.
The same in logic gates, you can cascade two-input XOR gates into a multi-inputs XOR gate.
Therefore, generally speaking, I would not limit XOR operator in ATDL to two operand I would rather make it clearer in the spec that XOR is associative, which means
(A XOR B) XOR C = A XOR (B XOR C) = A XOR B XOR C
to avoid interpretations.
Re: Edit logicOperator="XOR" Sergey Axenov / Metabit Systems Co., Ltd. 10 May 2010 9:25PM ET |