Library "external_input_utils" Collection of external input utilities for conversion and other hacky functions
str_to_src(value) str_to_src - Convert the string value to the coresponding source series. It can be used to limit the "input.source" choices provided to the end user. The most interesting part is that it can be used to overcome the "one input.source call limitation" for external inputs to your script Parameters: value: - The string equivalent to the source to be converted Returns: series of the coresponding source
eval_cond(input, operator, value, defval) eval_cond - Evaluate the condition given an operator Parameters: input: - The input to be compared with. It can be an external input or a regular one operator: - The string operator that describe the coparison operation value: - The value to compare with the input. This can be a serries or a constant defval: - The boolean value to return when 'noop' is selected Returns: series of bool the result of the operation evaluation
Note di rilascio
⋅
v2 add mod10 and /10 operators
Note di rilascio
⋅
v3
Note di rilascio
⋅
v4
add mod100 operator
append the '==' in mod operator strings to better describe the operation
Note di rilascio
⋅
v5 change the default of the noop eval_cond function to false
Note di rilascio
⋅
v6 Add error messages on invalid value and operator
Note di rilascio
⋅
v7 Added rising and falling conditions and removed mod div. Follow naming conventions.
Hey! This may be part of my problem in my strategy, I'm not very good at programming but have a system that can make it possible to program with logical operators combined with price executing some horizontal linear open, high, low and close lines.
I use the system today but unfortunately only have the combination that the price passes open at different time periods. I want to combine these to create logical orders in combinations.
Hope I will succeed even if it takes a long time!
jason5480
⋅
Hello @inboxmover, I am not entirely sure I understood your current situation. You can see how I use that library in the "Template Trailing Strategy" and in "Template Signal Indicator" scripts. This is used so the user of the aforementioned scripts can set as external input a value from a third script. Of course you can combine many scripts but there is still the limitation of one external input per script that is imposed by TV.
inboxmover
⋅
@jason5480, Hey! I have understood that you are a good programmer. Thought I'd check if I can ask for help. I have also asked others on the Pine chat.
How do I write the code for the variable BUY that I have in strategy.entry I will use this code to write the Variable BUY code: LineEnabled = input.bool(defval = true, title = 'Overorunder', tooltip = 'Enable trades based on Over or under', group = 'Strategy1') Line1 = input.string(defval = none, title = 'Line1', inline = 'Operator1', group = 'Strategy1', options=[none, srcsm1, srcsm2, srcsm3, srcto1, srcto2, srcto3, srcth1, srcth2, srcth3, srctl1, srctl2, srctl3]) Operator1 = input.string(defval = 'none', title = 'Operator', inline = 'Operator1', group = 'Strategy1', options = ['none', '==', '<', '>', '<=', '>=', '!=', 'crossover', 'crossunder']) Line2 = input.string(defval = none, title = 'Line2', inline = 'Operator1', group = 'Strategy1', options=[none, srcsm1, srcsm2, srcsm3, srcto1, srcto2, srcto3, srcth1, srcth2, srcth3, srctl1, srctl2, srctl3]) So I have LineEnabled, Line1, Operator and Line2. As you might understand, these Line1 and Line2 must be compared using Operator1. Checked LineEnabled and the code should be active.
jason5480
⋅
@inboxmover, I use this library in my "Template Trailing Strategy" script you might want to look at it. What I believe you have to do is: