Futures Margin Lookup TableThis script applies a table to the upper right corner of the screen, which provides the intraday and overnight margin requirements of the currently selected symbol.
In this indicator the user must provide the broker data in the form of specifically formatted text blocks. The data for which should be found on the broker website.
The purpose for it's creation is due to the non-standard way each individual broker may price their margins and lack of information within TradingView when connected to some (maybe all) brokers, including when paper trading, as the flat percentage rule is not accurate.
An example of information for NinjaTrader could look like this
MES;Micro S&P;$50;$2406
ES;E-Mini S&P;$500;$24,053
GC;Gold;$500;$16500
NQ;E-Mini Nasdaq;$1,000;$34,810
FDAX;Dax Index;€2,000;€44,311
Each symbol begins a new line, and the values on that line are separated by semicolons (;)
Each line consists of the following...
SYMBOL : Search string used to match to the beginning of the current chart symbol.
NAME: Human readable name
INTRA: Intraday trading margin requirement per contract
OVERNIGHT: Overnight trading margin requirement per contract
The script simply finds a matching line within your provided information using the current chart symbol.
So for example the continuous chart for NQ1! would match to the user specified line starting with NQ... as would the individual contract dates such as NQM2025, NQK2025, etc.
NOTES:
There is a possibility that symbols with similar starting characters could match.
If this is the case put the longer symbol higher in the list.
There is also a line / character limit to the text input fields within pinescript
Ensure the text you paste into them is not truncated.
If so there are 3 input fields for just this purpose.
Find the last complete line and continue the remaining symbol lines on the subsequent inputs.
User-defined
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
User Defined Momentum Change with Swing VisualsThis script is a groundbreaking, math-centric technical analysis tool that blends two well-established indicators, the Stochastic Oscillator and the Exponential Moving Average (EMA), to deliver a unique and visually engaging way of identifying momentum swings and stochastic indicators. Unlike mashups, this script is tailored to accommodate a wide range of trading strategies, providing traders with a distinctive perspective on market trends.
The innovation in this script lies in its mathematically-driven ability to effectively combine the Stochastic Oscillator and EMA, setting it apart from other available tools that simply offer a rehash of old ideas or slight modifications to popular indicators. The EMA is employed instead of a Simple Moving Average (SMA), enhancing the uniqueness of the calculations. This novel approach creates a new dimension for traders to evaluate potential momentum swings and visualize them on the chart, proving it to be more than just a mere mashup of existing indicators.
Central to the script's utility is its extensive customization options, which allow traders to adjust various inputs to suit their preferences and trading strategies. Users can modify the EMA length, swing range signal offsets, and smoothing factors for both the fast and slow components of the Stochastic Oscillator. Additionally, the script offers the ability to personalize the color thresholds, transparency, and line properties for the Stochastic Oscillator and swing range signal.
This script's visually dynamic representation of momentum swings empowers traders to make more informed trading decisions, particularly on the 6-hour timeframe. The swing range signal, represented by vertical lines on the chart, acts as a valuable visual aid for identifying potential entry or exit points. Furthermore, the Stochastic Oscillator provides insights into the strength and direction of momentum, which is beneficial for confirming potential trade signals.
To conclude, this script is not just another combination of MAs or a slightly modified version of a popular indicator. Instead, it offers traders a comprehensive, visually appealing, and customizable tool for technical analysis, which is both original and useful. By uniquely combining the EMA and the Stochastic Oscillator with a strong mathematical foundation, and allowing traders to adjust a variety of settings, this script adds value to the TradingView community and enhances the body of knowledge available for traders. It is designed to support traders in tailoring their analysis based on their own strategies and preferences, enabling them to make well-informed decisions in the financial markets.
WelcomeUDT█ OVERVIEW
This is a simplest example of user-defined types (UDT) or objects , which simplify as alternative to hello world.
█ CREDITS
Tradingview
█ USAGE
These are the types used during initializations, commonly variables.
export type Settings
int bar
float price
string phrase
...
Example of library function to print out label.
export printLabel(Settings setup) =>
if setup.variable
var label lab = na
label.delete(lab)
lab := label.new(setup.bar, setup.price, setup.phrase, color = setup.bg)
else
label.new(setup.bar, setup.price, setup.phrase, color = setup.bg)
Usage of types
Settings setup = Settings.new(bar_index , priceInput, phraseInput, colorInput, variableInput)
Alternative way to write types
Settings setup = Settings.new(
bar = bar_index ,
price = priceInput,
phrase = phraseInput,
variable = variableInput)
Usage of types into custom function / library function.
printLabel(setup)
printLabel(Settings)
Print out label
Parameters:
Settings : types
Returns: Label object
Settings
Initialize type values
Fields:
bar : X position for label
price : Y position for label
phrase : Text for label
bg : Color for label
variable : Boolean for enable new line and delete line