OPEN-SOURCE SCRIPT
Atualizado

Futures Margin Lookup Table

374
This script applies a table to your chart, 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 under futures margin requirements.

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 during paper trading, as the flat percentage rule is not accurate.

An example of information 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:
  1. 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.
  2. There is also a line / character limit to the text input fields within pinescript. Ensure the text you enter / 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.
Notas de Lançamento
Contract Counts:
Account size and risk percentage values have been added to the indicator settings.
Account balance is not able to be queried directly in pinescript, so it must be entered.
This information is used to provide max contract counts based on your risk percentage.

Speed improvements:
The table removes redundant work making the update much faster and more efficient

Note:
The format of the text input expected by the user has changed.
Whereas previously the simple text as input was used, pinescript now needs to be able to interpret the input as numbers (in order to calculate risk). For this reason currency symbols and commas are no longer valid input, and a warning will be displayed.
Simply remove these characters from the input text.
For example...
Pine Script®
// OLD MES;Micro S&P;$50;$2,406 // NEW MES;Micro S&P;50;2406


Aviso legal

As informações e publicações não devem ser e não constituem conselhos ou recomendações financeiras, de investimento, de negociação ou de qualquer outro tipo, fornecidas ou endossadas pela TradingView. Leia mais em Termos de uso.