Page 1 of 1

Get these arows (< >) in the input settings menu?

Posted: Sun Dec 04, 2022 4:01 pm
by Inboxmover
Hey!

How do I write code so that I can have these < > to choose from in the input settings menu. It is so hard to write fixed decided code and there are so many different variants to analyze the best choice.

Sincerely, Lars Miore, Sweden



BUY =

ENT == srcsm1 and TIME and extrak1 and extrak2 and extrak3 and extrak4 and extrak5 and extrak6 and extrak7 ? sm1 > sm2 :
ENT == srcsm2 and TIME and extrak1 and extrak2 and extrak3 and extrak4 and extrak5 and extrak6 and extrak7 ? pris > sm2 :
ENT == srcsm3 and TIME and extrak1 and extrak2 and extrak3 and extrak4 and extrak5 and extrak6 and extrak7 ? pris > sm3 :
ENT == srcto1 and TIME and extrak1 and extrak2 and extrak3 and extrak4 and extrak5 and extrak6 and extrak7 ? pris > to1 :
ENT == srcto2 and TIME and extrak1 and extrak2 and extrak3 and extrak4 and extrak5 and extrak6 and extrak7 ? pris > to2 :
ENT == srcto3 and TIME and extrak1 and extrak2 and extrak3 and extrak4 and extrak5 and extrak6 and extrak7 ? pris > to3 :
ENT == srcth1 and TIME and extrak1 and extrak2 and extrak3 and extrak4 and extrak5 and extrak6 and extrak7 ? pris > th1 :
ENT == srcth2 and TIME and extrak1 and extrak2 and extrak3 and extrak4 and extrak5 and extrak6 and extrak7 ? pris > th2 :
ENT == srcth3 and TIME and extrak1 and extrak2 and extrak3 and extrak4 and extrak5 and extrak6 and extrak7 ? pris > th3 :
ENT == srctl1 and TIME and extrak1 and extrak2 and extrak3 and extrak4 and extrak5 and extrak6 and extrak7 ? pris > tl1 :
ENT == srctl2 and TIME and extrak1 and extrak2 and extrak3 and extrak4 and extrak5 and extrak6 and extrak7 ? pris > tl2 :
ENT == srctl3 and TIME and extrak1 and extrak2 and extrak3 and extrak4 and extrak5 and extrak6 and extrak7 ? pris > tl3 :

Re: Get these arows (< >) in the input settings menu?

Posted: Thu Dec 08, 2022 7:42 pm
by purplemint22
I think you would have to set up a work around for this since you can't create an options list for a logical operator that won't translate this input as a string and a string won't be able to perform a comparison.

I would suggest creating another level to this with a boolean input so that false translates to > and true translates to < in the code.

Then you could use the boolean in an if statement, which could look something like this.

if logicalOperatorBoolean == true
ENT == srcsm1 and TIME and extrak1 and extrak2 and extrak3 and extrak4 and extrak5 and extrak6 and extrak7 ? sm1 > sm2 :

else
ENT == srcsm1 and TIME and extrak1 and extrak2 and extrak3 and extrak4 and extrak5 and extrak6 and extrak7 ? sm1 < sm2 :

Re: Get these arows (< >) in the input settings menu?

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

You can use the options input as > or < , than use logical check on this considering them as strings.

e.g.

Code: Select all

whichWay = input.string(defval = ">", options = [">", "<"])
BUY = 
(ENT == srcsm1 and TIME and extrak1 and extrak2 and extrak3 and extrak4 and extrak5 and extrak6 and extrak7) ? (whichWay==">" ? sm1 > sm2 : sm1 < sm2) : 
...................