Simple Ultimate Oscillator█ OVERVIEW
This indicator as an educational and showcase the usage of user-defined types (UDT) or objects for Ultimate Oscillator.
█ CREDITS
TradingView
█ FEATURES
1. Color of plot is based on contrast color of chart background.
2. Plot fill of overbought and oversold.
3. Support Multi Timeframe.
Object
Simple Ichimoku Kinko Hyo Cloud█ OVERVIEW
This indicator as an educational and showcase the usage of user-defined types or objects (UDT) for Ichimoku Kinko Hyo or Ichimoku Cloud.
█ CREDITS
TradingView
Regression Channel Alternative MTF V2█ OVERVIEW
This indicator is a predecessor to Regression Channel Alternative MTF , which is coded based on latest update of type, object and method.
█ IMPORTANT NOTES
This indicator is NOT true Multi Timeframe (MTF) but considered as Alternative MTF which calculate 100 bars for Primary MTF, can be refer from provided line helper.
The timeframe scenarios are defined based on Position, Swing and Intraday Trader.
Suppported Timeframe : W, D, 60, 15, 5 and 1.
Channel drawn based on regression calculation.
Angle channel is NOT supported.
█ INSPIRATIONS
These timeframe scenarios are defined based on Harmonic Trading : Volume Three written by Scott M Carney.
By applying channel on each timeframe, MW or ABCD patterns can be easily identified manually.
This can also be applied on other chart patterns.
█ CREDITS
Scott M Carney, Harmonic Trading : Volume Three (Reaction vs. Reversal)
█ TIMEFRAME EXPLAINED
Higher / Distal : The (next) longer or larger comparative timeframe after primary pattern has been identified.
Primary / Clear : Timeframe that possess the clearest pattern structure.
Lower / Proximate : The (next) shorter timeframe after primary pattern has been identified.
Lowest : Check primary timeframe as main reference.
█ FEATURES
Color is determined by trend or timeframe.
Some color is depends on chart contrast color.
Color is determined by trend or timeframe.
█ EXAMPLE OF USAGE / EXPLAINATION
RSI Divergence Method█ OVERVIEW
This is a divergence indicator based on Relative Strength Index (RSI).
My attempt to make this indicator updated based on latest pine script features such as type, object and method.
█ FEATURES
1. Color of plot and label is based on contrast color of chart background. Able to customize color from style menu.
2. Big divergence (Regular Divergence) is based on lime / red color.
3. Small divergence (Hidden Divergence) is based on contrast color of chart background.
█ EXAMPLES / USAGES
store - larger data storage for complex item typesLibrary "store"
Object/Property Storage System Semi-Simplified. .
It's a helpful toolset while designing UDT's as it remains flexible,
this helps in not having to remap an entire script while tinkering.
Set an object up, and add as man properties as yyou wish.
a property can be one of any pine built in types. so a single
object can contain sa, ohlc each with a color, a float, an assigned int
and those 4 props each have 3 sub-assigned values.
as in demo, the alternating table object has 2 different tables
it's a pseudo more complex wa to create our own flexible
version of a UDT, but that will not ~break~ on library updates
so you can update awa without fear, as this libb will no change
saving ou the hassle of creating UDT's that continually change.
set(dict, _object, _prop, _item)
Add/Updates item to storage. Autoselects subclass dictionary on set
Parameters:
dict : (dictionary) dict.type subdictionary (req for overload)
_object : (string) object name
_prop
_item : () item to set
Returns: item item wwith column/row
set(dict, _object, _prop, _item)
Parameters:
dict
_object
_prop
_item
set(dict, _object, _prop, _item)
Parameters:
dict
_object
_prop
_item
set(dict, _object, _prop, _item)
Parameters:
dict
_object
_prop
_item
set(dict, _object, _prop, _item)
Parameters:
dict
_object
_prop
_item
set(dict, _object, _prop, _item)
Parameters:
dict
_object
_prop
_item
set(dict, _object, _prop, _item)
Parameters:
dict
_object
_prop
_item
set(dict, _object, _prop, _item)
Parameters:
dict
_object
_prop
_item
set(dict, _object, _prop, _item)
Parameters:
dict
_object
_prop
_item
set(dict, _object, _prop, _item)
Parameters:
dict
_object
_prop
_item
set(dict, _index, _item)
Parameters:
dict
_index
_item
set(dict, _index, _item)
Parameters:
dict
_index
_item
set(dict, _index, _item)
Parameters:
dict
_index
_item
set(dict, _index, _item)
Parameters:
dict
_index
_item
set(dict, _index, _item)
Parameters:
dict
_index
_item
set(dict, _index, _item)
Parameters:
dict
_index
_item
set(dict, _index, _item)
Parameters:
dict
_index
_item
set(dict, _index, _item)
Parameters:
dict
_index
_item
set(dict, _index, _item)
Parameters:
dict
_index
_item
set(dict, _index, _item)
Parameters:
dict
_index
_item
get(typedict, _object, _prop)
Get item by object name and property (string)
Parameters:
typedict : (dict) dict.type subdictionary (req for overload)
_object : (string) object name
_prop
Returns: item from storage
get(typedict, _object, _prop)
Parameters:
typedict
_object
_prop
get(typedict, _object, _prop)
Parameters:
typedict
_object
_prop
get(typedict, _object, _prop)
Parameters:
typedict
_object
_prop
get(typedict, _object, _prop)
Parameters:
typedict
_object
_prop
get(typedict, _object, _prop)
Parameters:
typedict
_object
_prop
get(typedict, _object, _prop)
Parameters:
typedict
_object
_prop
get(typedict, _object, _prop)
Parameters:
typedict
_object
_prop
get(typedict, _object, _prop)
Parameters:
typedict
_object
_prop
get(typedict, _object, _prop)
Parameters:
typedict
_object
_prop
get(typedict, _index)
Parameters:
typedict
_index
get(typedict, _index)
Parameters:
typedict
_index
get(typedict, _index)
Parameters:
typedict
_index
get(typedict, _index)
Parameters:
typedict
_index
get(typedict, _index)
Parameters:
typedict
_index
get(typedict, _index)
Parameters:
typedict
_index
get(typedict, _index)
Parameters:
typedict
_index
get(typedict, _index)
Parameters:
typedict
_index
get(typedict, _index)
Parameters:
typedict
_index
get(typedict, _index)
Parameters:
typedict
_index
remove(typedict, _object, _prop)
Remove a specific property from an object
Parameters:
typedict : (dict) dict.type subdictionary (req for overload)
_object : (string) object name
_prop
Returns: item from storage
remove(typedict, _object, _prop)
Parameters:
typedict
_object
_prop
remove(typedict, _object, _prop)
Parameters:
typedict
_object
_prop
remove(typedict, _object, _prop)
Parameters:
typedict
_object
_prop
remove(typedict, _object, _prop)
Parameters:
typedict
_object
_prop
remove(typedict, _object, _prop)
Parameters:
typedict
_object
_prop
remove(typedict, _object, _prop)
Parameters:
typedict
_object
_prop
remove(typedict, _object, _prop)
Parameters:
typedict
_object
_prop
remove(typedict, _object, _prop)
Parameters:
typedict
_object
_prop
remove(typedict, _object, _prop)
Parameters:
typedict
_object
_prop
remove(typedict, _index)
Parameters:
typedict
_index
remove(typedict, _index)
Parameters:
typedict
_index
remove(typedict, _index)
Parameters:
typedict
_index
remove(typedict, _index)
Parameters:
typedict
_index
remove(typedict, _index)
Parameters:
typedict
_index
remove(typedict, _index)
Parameters:
typedict
_index
remove(typedict, _index)
Parameters:
typedict
_index
remove(typedict, _index)
Parameters:
typedict
_index
remove(typedict, _index)
Parameters:
typedict
_index
remove(typedict, _index)
Parameters:
typedict
_index
delete(_dict, _object)
Remove a complete Object and all props
Parameters:
_dict
_object : (string) object name
Returns: item from storage
delete(_dict, _index)
Parameters:
_dict
_index
wipe(_dict, _object, _prop)
Remove Property slot for all 10 item types
Parameters:
_dict : (dictionary) The full dictionary item
_object : (string) object name
_prop
Returns: item from storage
wipe(_dict, _index)
Parameters:
_dict
_index
init(_Objlim, _Proplim)
Create New Dictionary ready to use (9999 size limit - (_objlim +_Proplim) for row/column 0)
# Full dictionary with all types
> start with this
Parameters:
_Objlim : (int) maximum objects (think horizontal)
_Proplim : (int) maximum properties per obj (vertical)
Returns: dictionary typoe object
boxdict
Fields:
keys
items
booldict
Fields:
keys
items
colordict
Fields:
keys
items
floatdict
Fields:
keys
items
intdict
Fields:
keys
items
labeldict
Fields:
keys
items
linedict
Fields:
keys
items
linefilldict
Fields:
keys
items
stringdict
Fields:
keys
items
tabledict
Fields:
keys
items
dictionary
Fields:
boxs
bools
colors
floats
ints
labels
lines
linefills
strings
tables
keys
item
Fields:
objCol
propRow
object
property
actionItem
dictionaries
Dictionar OF dictionaries
Fields:
dicts
Financials - Comparing CompaniesHello All
For a while I have been working on this indicator to compare financials of the companies and sort them accordingly. Finally I completed and published it. I preferred using new object type feature in Pine language™ and I hope it might be an example and helpful for the developers.
First of all, as we have limitation on security calls, the indicator can get and compare financials for 5 companies only. also Chart time frame must be 1Day or higher! ( I recommend 1Day time frame ). if not then the indicator stops and shows the error message: "Please set the time frame 1Day or higher" . More important than others: You should choose the companies from the same sector! Compare apples to apples :)
The Financials in the indicator:
Earnings Per Share
Price to Earnings Ratio
Price to Sales Ratio
Price to Book Ratio
Profit Margin
Dept to Equity
Current Ratio
Market Capitalization
Also more information shown for each stocks:
Closing Price, sets the color accordingly
2 Simple/Exponential moving average, you can set the length, also it checks if it is rising/falling and sets the color accordingly
Volume info
Average volume (20 days), you can set the period
Currency for each security
Lets see some features in it:
it sorts the companies according to the financials:
If you move the mouse onto any header then it shows explanation about the financial:
You can change location and text size:
You can set the type of Moving averages as SMA or EMA and you can also set the length for both . Headers for both are changed automatically by MA type and length
Colors for Closing price and MA cells are set automatically:
For new Objects in Pine language click here
P.S. You can use this indicator while analyzing the financials of the companies in same sector/industry. So please don't ask for the alerts :)
Enjoy!
Simple Zigzag UDT█ OVERVIEW
This indicator displays zigzag based on high and low, which is using user-defined types (UDT) or objects .
█ CREDITS
LonesomeTheBlue
█ FEATURES
1. Label can be resized.
2. Label can be display either short (Eg : HH, LL, H, L, etc) and long (Eg : Higher Low, etc)
3. Color can be customized either contrast color of chart background, trend color or customized color.
█ EXAMPLES / USAGES
Motion▮ FEATURES
Now as library version :)
String-based transition-effects
Performance optimization. Reduced memory consumption up to >90% by kicking the output to the "stdout".
Use marquee- or loader-effect on any possible string location.
Example: UI Price-Ticker
----------------------------------------------------------------------------
Library "Motion"
_getStringMono(_len, _str, _sep)
Parameters:
_len
_str
_sep
marquee(this, _extern, _ws, _subLen, _subStart)
Parameters:
this
_extern
_ws
_subLen
_subStart
transition(this, _subLen, _subStart)
Parameters:
this
_subLen
_subStart
hold(this)
Parameters:
this
keyframe
keyframe A keyframe object.
Fields:
seq
intv
step
length
update_no
frame_no
ltr
hold
Sort array alphabetically - educational🔶 OVERVIEW
• This educational script will sort an array of tickers alphabetically and place these values in an table , together with the according current price value next to each ticker .
🔶 SORT ALPHABETICALLY
🔹 I. We make a User Defined Type (UDT) obj , with:
· ticker - the string name of the ticker
· price - the current price (close)
• From this UDT we make an object obj.new() for each ticker
🔹 II. 2 array's are made:
• array of objects aObj , containing obj type obj.new() for every ticker
• array of strings sort , the ticker part of each object obj.new()
🔹 III. Now we make an object of each ticker with the createObject(sym ) function
object_1 = createObject("TICKER")
• the object object_1 consists off:
· ticker -> "TICKER"
· price -> current Daily close through request.security("TICKER") (non-repainting)
• object_1 will be added to the aObj array
• "TICKER" ( string ticker part of object ) will be added to the sort array
🔹 IV. The latter array is sorted alphabetically by using array.sort_indices()
EXAMPLE
originalArray = array.from("B", "A", "C")
indicesArray = // sorted indices
array.get(originalArray, 1) -> "A"
array.get(originalArray, 0) -> "B"
array.get(originalArray, 2) -> "C"
IMPORTANT
Alphabetically sorting is case sensitive , just like Java compareTo(String anotherString) !
• The comparison is based on the Unicode value of each character in the string, the lowest "Dec" values are sorted first in line.
• Comparing the "Dec" values at unicodelookup explains why default CAPITAL lettres will be sorted first,
• Default you would get this (A= 65, B= 66, a= 97, b= 98)
Aa
Ba
ab
bb
• Adding str.lower(string) in the toLowerCase() function will result to the following:
Aa
ab
Ba
bb
• (A= 65 is transformed to a= 97, ...)
• As a side note, should you write "AMZN" as "ÀMZN" this would be placed at the end, even after transforming to lower case the "Dec" values are higher (À= 192, à= 224).
• You can toggle "To Lower Case" to verify.
🔹 V. Values are placed in a table , using these sorted indices.
• With the usage of UDTs and objects , the current price has the same index in the aObj as their ticker ,
giving the advantage it is fairly easy to place every value correctly next to each other.
• The same can be done by make 2 separate arrays , 1 for the current price , the other for "TICKER" .
🔶 OTHER TECHNIQUES USED
• Alternative technique for adding comment
Instead of
// this is a comment
You can also do this:
_=" this is a comment "
• Alternate colour
· During a loop , alternate colour when i is even or odd , using the modulo operation (%) .
· This is the remainder when dividing.
EXAMPLE
· 3 % 2 = 1 -> 3 / 2 -> 1 * 2, 1 left (remainder)
· 4 % 2 = 0 -> 4 / 2 -> 2 * 2, 0 left (remainder)
· 5 % 2 = 1 -> 5 / 2 -> 2 * 2, 1 left (remainder)
for i = 0 to 10
even = i % 2 == 0
col = even ? thisColor : otherColor
• Adjust colour in script by using colour picker
Cheers!
Multiple Divergences (UDTs - objects) - Educational█ OVERVIEW
This script highlights the usage of User-defined Types (UDTs) and objects , and bullish /bearish divergences.
Pivotpoints are used to find divergences, the result of this script will be different against other public multiple divergences scripts.
FOR Pine Script™ CODERS
Besides the information found in CONCEPTS , the comments in the script will, hopefully ), guide you through my thought process.
█ CONCEPTS
The main principle of this script are bullish /bearish divergences, this with 3 different oscillators ( RSI , CCI , MFI )
If you want to know more about divergences, have a look at some Education and Research idea's .
On every bar, an object HLs is made, containing bar_index , high , low , and 2 bool variables ( isPh , isPl ).
On every bar, an object Osc is made, containing bar_index , o (oscillator value), and 2 bool variables ( isPh , isPl ).
If a pivothigh (ph ) is found, isPh will be true on that bar, false otherwise.
If a pivotlow (pl) is found, isPl will be true on that bar, false otherwise.
These objects are added to an array, with limited size.
If a ph is found, the script draws a testline from that ph to every previous ph , found in the array.
Then every high in between these 2 points are checked if they don't pierce the testline .
If the testline isn't broken, the Reg_Div_Piv() function will give 4 values, 1 check (not pierced) variable and the 4 points of the line.
The testline is deleted.
Once a positive check is found, the script will perform the same, but now with the Osc objects.
The script will ONLY compare Osc pivots which are maximum 1 bar away from the high/low pivot .
If everything is confirmed, a line is drawn, visible on the chart.
█ REMARKS
A label will be visible with a number, this is the amount of divergences found with the according oscillator .
EXAMPLE
Div with RSI and CCI -> 2
Div with MFI alone -> 1
Div with RSI and CCI and MFI -> 3
...
Divergences should only be used when confirmed, this is after bar close .
As an aid, lines that are not confirmed will be dotted , if confirmed, they will be solid .
The divergence check start when a ph/pl is found, after which oscillator pivot are checked.
Optionally the same can be done, when a oscillator pivot is found and then check the ph/pl ,
this should give more results, although it can make the script slower.
█ SETTINGS
Left - amount of bars at the left which needs to be lower/higher
Right - amount of bars at the right which needs to be lower/higher
Max values - maximum values in array of objects
3 oscillator settings with
• ON/OFF
• Length
• color bullish divergence
• color bearish divergence
Have FUN !
Object: object oriented programming made possible! Hash map's in Pinescript?? Absolutely
This Library is the first step towards bringing a much needed data structure to the Pine Script community.
"Object" allows Pine coders to finally create objects full or unique key:value pairs, which are converted to strings and stored in an array. Data can be stored and accessed using dedicated get and set methods.
The workflow is simple, but has a few nuances:
0. Import this library into your project; you can give it whatever alias you'd like (I'll be using obj)
1. Create your first object using the obj.new() method and assign it a variable or "ID".
2. Use the object's ID as the first argument into the obj.set() method, for the key and value there's one extra step required. They must be added as arguments to the appropriate prop_() method.
Note: While objects in this library technically only store data as strings, any primitive data type can be converted to a string before being stored, meaning that one object can hold data from multiple types at once. There's a trade off though..Pine Script requires that all exported function parameters have pre-defined types, meaning that as convenient as it would be to have a single method for storing and returning data of every type, it's not currently possible. Instead there are functions to add properties for each individual type, which are then converted to strings automatically (the original type is flagged and stored along with the data). Furthermore, since switch/if statements can only return values of the same type, there must also be "get" methods which correspond with each type. Again, a single "get" method which auto-detects the returned value's type was the goal but it's just not currently possible. Instead each get method is only allowed to return a value of its own type. No worries though, all the "get" methods will throw errors if they can't access the data you're trying to access. In that error message, you'll be informed exactly which "get" method you need to use if you ever lose track of what type of data you should be returning.
3. The second argument for obj.set() method is the obj.prop_() method. You just plug in your key as a string and your value and you're done. Easy as that.
Please do not skip this step, properties must be formatted correctly for data to be stored and accessed correctly
4. Obj.get_ (s: string, f: float, b: bool, i: int) methods are even easier, just choose whichever method will return the data type you need, then plug in your ID, and key and that's it. Objects will output data of the same type they were stored as!
There's a short example at the end of the script if you'd like to see more!
prop_string(string: key, string: value)
returns property formatted to string and flagged as string type
prop_float(string: key, float: value)
returns property formatted to string and flagged as float type
prop_bool(string: key, bool: value)
returns property formatted to string and flagged as bool type
prop_int(string: key, int: value)
returns property formatted to string and flagged as int type
Support for lines and shapes coming soon!
new()
returns an empty object
set(string : ID, string: property)
adds new property to object
get_f(string : ID, string: key)
returns float values
get_s(string : ID, string: key)
returns string values
get_b(string : ID, string: key)
returns boolean values
get_i(string : ID, string: key)
returns int values
More methods like Obj.remove(), Obj.size(), Obj.fromString, Obj.fromArray, Obj.toJSON, Obj.keys, & Obj.values coming very soon!!
ObjectStackLibrary "ObjectStack"
init()
push()
push()
push()
push()
push()
nextIndex()
nextIndex()
nextIndex()
nextIndex()
nextIndex()
delete()
delete()
delete()
delete()
delete()
cleanOldest()
cleanOldest()
cleanOldest()
cleanOldest()
cleanOldest()
Dictionary/Object LibraryThis Library is aimed to mitigate the limitation of Pinescript having only one structured data type which is only arrays.
It lacks data types like Dictionaries(in Python) or Object (in JS) that are standard for other languages. Tuples do exist, but it hardly solves any problem.
Working only with Arrays could be overwhelming if your codebase is large. I looked for alternatives to arrays but couldn't find any library.
So I coded it myself and it's been working good for me. So I wanted to share it with you all.
What does it do:
==================
If you are familiar with Python or Javascript, this library tries to immimate Object/Dictonary like structure with Key Value Pairs.
For Example:
object= {name:"John Doe", age: 28 , org: "PineCoders"}
And then it also tries to immitate the Array of Objects (I call it Stack)
like this:
stack= Array({name:"John Doe", age: 28 , org: "PineCoders"},
{name:"Adam Smith", age: 32 , org: "PineCoders"},
{name:"Paragjyoti Deka", age: 25 , org: "PineCoders"})
So there are basically two ideas: Objects and Stacks.
But it looks whole different in Pinescript for obvious reasons.
Limitation:
The major limitation I couldn't overcome was that, for all of the values: both input and return values for properties will be of string type.
This is due to the limiation of Pinecsript that there is no way to return a value on a if-else statement dynamically with different data types.
And as the input data type must be explicitly defined when exporting the library functions, only string inputs are allowed.
Now that doesn't mean you won't be able to use integer, float or boolens, you just need to pass the string value for it using str.tostring() method.
And the output for the getter functions will be in strings as well. But I have added some type conversion methods that you could use from this library itself.
From String to Float, String To Integer and String to Boolean: these three methods are included in this library.
So basically the whole library is based on a manipulatiion of Array of strings under the hood.
///////////////
Usage
///////////////
Import the library using this statement:
import paragjyoti2012/STR_Dict_Lib/4 as DictLib
Objects
First define an object using this method:
for eample:
object1= DictLib.init("name=John,age=26,org=")
This is similar to
object1= {name:"John",age:"26", org:""} in JS or Python
Just like we did here in for "org", you can set initital value to "". But remember to pass string values, even for a numerical properties, like here in "age".
You can use "age="+str.tostring(age). If you find it tedious, you can always add properties later on using .set() method.
So it could also be initiated like this
object= DictLib.init("name=John")
and later on
DictLib.set(object1,"age", str.toString(age))
DictLib.set(object1,"org", "PineCoders")
The getter function looks like this
age= DictLib.get(object1,"age")
name=DictLib.get(object1,"name")
The first argument for all methods .get, .set, and .remove is the pointer (name of the object).
///////////////////////////
Array Of Objects (Stacks)
///////////////////////////
As I mentioned earlier, I call the array of objects as Stack.
Here's how to initialize a Stack.
stack= DictLib.initStack(object1)
The .initStack() method takes an object pointer as argument. It simply converts the array into a string and pushes it into the newly created stack.
Rest of all the methods for Stacks, takes the stack pointer as it's first arument.
For example:
DictLib.pushStack(stack,object2)
The second argument here is the object pointer. It adds the object to it's stack. Although it might feel like a two dimentional array, it's actually an one dimentional array with string values.
Under the hood, it looks like this
////////////////////
Methods
////////////////////
For Objects
-------------------
init() : Initializes the object.
params: (string) e.g
returns: The object ( )
example:
object1=DictLib.init("name=John,age=26,org=")
...................
get() : Returns the value for given property
params: (string object_pointer, string property)
returns: string
example:
age= DictLib.get(object1,"age")
.......................
set() : Adds a new property or updates an existing property
params: (string object_pointer, string property, string value)
returns: void
example:
DictLib.set(object1,"age", str.tostring(29))
........................
remove() : Removes a property from the object
params : (string object_pointer, string property)
returns: void
example:
DictLib.set(object1,"org")
........................
For Array Of Objects (Stacks)
-------------------------------
initStack() : Initializes the stack.
params: (string object_pointer) e.g
returns: The Stack
example:
stack= DictLib.initStack(object1)
...................
pushToStack() : Adds an object at at last index of the stack
params: (string stack_pointer, string object_pointer)
returns: void
example:
DictLib.pushToStack(stack,object2)
.......................
popFromStack() : Removes the last object from the stack
params: (string stack_pointer)
returns: void
example:
DictLib.popFromStack(stack)
.......................
insertToStack() : Adds an object at at the given index of the stack
params: (string stack_pointer, string object_pointer, int index)
returns: void
example:
DictLib.insertToStack(stack,object3,1)
.......................
removeFromStack() : Removes the object from the given index of the stack
params: (string stack_pointer, int index)
returns: void
example:
DictLib.removeFromStack(stack,2)
.......................
getElement () : Returns the value for given property from an object in the stack (index must be given)
params: (string stack_pointer, int index, string property)
returns: string
example:
ageFromObject1= DictLib.getElement(stack,0,"age")
.......................
setElement() : Updates an existing property of an object in the stack (index must be given)
params: (string stack_pointer, int index, string property, string value)
returns: void
example:
DictLib.setElement(stack,0,"age", str.tostring(32))
........................
includesElement() : Checks if any object exists in the stack with the given property-value pair
params : (string stack_pointer, string property, string value)
returns : Boolean
example:
doesExist= DictLib.includesElement(stack,"org","PineCoders")
........................
searchStack() : Search for a property-value pair in the stack and returns it's index
params: (stringp stack_pointer, string property, string value)
returns: int (-1 if doesn't exist)
example:
index= DictLib.searchElement(stack,"org","PineCoders")
///////////////////////
Type Conversion Methods
///////////////////////
strToFloat() : Converts String value to Float
params: (string value)
returns: float
example:
floatVal= DictLib.strToFloat("57.96")
.............................
strToInt() : Converts String value to Integer
params: (string value)
returns: int
example:
intVal= DictLib.strToFloat("45")
.............................
strToBool() : Converts String value to Boolean
params: (string value)
returns: boolean
example:
boolVal= DictLib.strToBool("true")
.............................
Points to remember
...............
1. Always pass string values as arguments.
2. The return values will be of type string, so convert them before to avoid typecasting conflict.
3. Horses can't vomit.
More Informations
====================
Yes, You can store this objects and stacks for persisting through the iterations of a script across successive bars.
You just need to set the variable using "var" keyword. Remember this objects and stacks are just arrays,
so any methods and properties an array have it pinescript, would be applicable for objects and stacks.
It can also be used in security functions without any issues for MTF Analysis.
If you have any suggestions or feedback, please comment on the thread, I would surely be happy to help.
Highs & Lows by TaTraderHello,
This is my script for H&Ls. I am still working on it.
EDIT: be careful when using it!
It does NOT compare previous H&L levels with those in the making. It can only be used if you hold your positions a long time.