Page 1 of 1

Please respond! Logical and or not programming

Posted: Sun Dec 04, 2022 2:51 am
by Inboxmover
Hallo!

As you can see in the graph, I have lines for open price based on 30 min, 1H, 4H, 1D, week. When price crosses these lines, I get buy signals that I trade on today. I want to program it more advanced with logical operators (and, or not) Especially or, because then I could set up a whole bunch of conditions.

Small green = 30 Min
Black = 1H
Brown = 4 H
Silver = 1D
Gold = 1 week

I can't manage to get a drop down box with input option and, or, not.

input option must be input string.

Anyone have suggestions for code to create a multi filter with and, or and not?

I am trying to build a logical programming with a lot of combinations.

Sincerely, Lars Miore, Sweden




Image

Re: Please respond! Logical and or not programming

Posted: Thu Dec 08, 2022 7:25 pm
by purplemint22
Interesting idea. This is how I would go about setting up a drop down for your input string with or as the default value since it has the highest priority.

logicalOperatorInput = input.string("or", title = "Logical Operator Options", options = ["or", "and", "not"])

Re: Please respond! Logical and or not programming

Posted: Sun Feb 05, 2023 5:14 pm
by processingclouds
Hey,

Even if the input is string, like "or" , "and" or any other, you can use this in the code with
IF to check if logicInput == "or" than do OR operation and so on