Let's say that there are four predefined price levels: A, B, C, D. If price is above any two of these levels, then I want to branch off in one direction of code, but if price is above only one of these levels, a different code should be executed. It is obviously possible to hard code for each possible set of outcomes where price would be above A and B, above A and C, above A and D, above B and C, above B and D, etc. but this could be very lengthy if a fifth or sixth predefined price level was also tested for.
I am sure that there is a way to do this in a more programmatically elegant way, but I am not sure what to search for. Is this some sort of conditional testing, conditional branching, or something else?
Could someone point me in the right direction and tell me what type of programmatic structure this is? Also, if anyone knows of an online reference that would show a few generic examples, that would be very useful.
Comment