DiscordWebhookFunctionLibrary "DiscordWebhookFunction"
discordMarkdown(_str, _italic, _bold, _code, _strike, _under) Convert string to markdown formatting User can combine any function at the same time.
Parameters:
_str : String input
_italic : Italic
_bold : Bold
_code : Code markdown
_strike : Strikethrough
_under : Underline
Returns: string Markdown formatted string.
discordWebhookJSON(_username, _avatarImgUrl, _contentText, _bodyTitle, _descText, _bodyUrl, _embedCol, _timestamp, _authorName, _authorUrl, _authorIconUrl, _footerText, _footerIconUrl, _thumbImgUrl, _imageUrl) Convert data to JSON format for Discord Webhook Integration.
Parameters:
_username : Override bot (webhook) username string / name,
_avatarImgUrl : Override bot (webhook) avatar by image URL,
_contentText : Main content page message,
_bodyTitle : Custom Webhook's embed message body title,
_descText : Webhook's embed message body description,
_bodyUrl : Webhook's embed body direct link URL,
_embedCol : Webhook's embed color,
_timestamp : Timestamp,
_authorName : Webhook's embed author name / title,
_authorUrl : Webhook's embed author direct link URL,
_authorIconUrl : Webhook's embed author icon by image URL,
_footerText : Webhook's embed footer text / title,
_footerIconUrl : Webhook's embed footer icon by image URL,
_thumbImgUrl : Webhook's embed thumbnail image URL,
_imageUrl : Webhook's embed body image URL.
Returns: string Single-line JSON format
Utilities
function: Array DownsamplingA low cost function to down sample a array.
specially useful for pattern recognition algorithms.
Multi-Timeframe Configuration DemoThis is a developer friendly solution to the current PineScript limitation of not being able to easily configure presets for multiple timeframes.
If you're developing multi-timeframe strategies then you've no doubt done battle with built-in `input` function which only allows for a single default value. You've probably come up with all kinds of fancy workarounds, including messy hardcoding, and even gritting your teeth and patiently reentering all the necessary values each time you refresh the chart or change the timeframe. The last one is my personal favourite.
As you can see in the code below we have defined a `usePresets` condition which tells the script to use our preset configuration, otherwise the default `input` values will be used. If `usePresets` is false then we use our presets which are defined in a (fairly) easy to read condition chain with the help of some basic timeframe utility functions.
Obviously this is nothing groundbreaking, but its helped me clean up my scripts a bit, so hopefully it will help you too.