I remain ever grateful to those who have posted practical knowledge. I look forward to the next billion years.
Note: Chart candy is not Ichimoku Cloud.
Tenkan-sen ~ Kijun-sen cloud coding (periods 100-150) by Phylo, aka File45
Magenta MA = 200-LWMA
Indicators downloads >>>
https://www.forexfactory.com/thread/280525-kijun-sen-line-indicator
BTW: Kijun-sen and Tenkan-sen are one and the same indicator
Proof:
1. Attach Ichimoku indicator to chart. (note: Ichimoku was designed as a Daily period indicator).
2. Set Kijun-sen and Tenkan-Sen to same period (say, both 26) and set both lines to thickest.
3. Set all other line colors to 'None' - only KS & TS should have colors.
4. Only one indicator appears on the chart - the blue Kijun-sen is overlaid the red Tenkan-sen.
5. Change one indicator to, say 20 - two indicators now appear on the chart.
Green Indicators
The following commentary refers to MQL4 (MT4 Platform) code which is still widely in use and readily available in free unlimited demo for practice trading and code testing.
Most do not have access to paid-subscription platforms - example Sierra Chart.
https://www.sierrachart.com/
USDJPY - 15 seconds
Commentary references specifications.
The green text info indicator on the right calculates -
- against a given Capital -
- the maximum allowed Volume/Lots and
- the associated Margin and Equity against said calculated maximum Volume/Lots.
For those interested in self coding I was going to give a detailed rundown. However, the code is not as straightforward as would seem to avoid rounding errors and ensure calculated values duplicate live market condition with 100% accuracy. Time is ever masterful.
In brief - some pointers. (disclaimer: all values are randomly assigned merely for illustrative calculation purposes)
The following illustrative for a single product - multiple product allocation is beyond the scope of discussion.
Capital = Equity (EQ) + Margin(MRG).
Which can be described as EQ available for trading and thus subject to risk
+
Non tradeable MRG, which is a broker collateral - reserve surrendered on entrance of position and collectable on exit of position.
Note: Margin (MRG) is considered - dead meat - non tradeable broker collateral. If trader is smelling 100% margin trader is definitely not bringing home bacon - trader
IS the bacon and cook'n. Suffice, to say, not in a good way !*
* anyone, of course, is at liberty to trade as they choose - I would never consider interfering with anyone's right to trading self mutilation & disfigurement (literally- the figures and mood will be disfigured and mutilated).
RM = Risk Multiplier.
1. Any number multiplied by 100 will be 1 percent of the multiplication product/result. Proof 6 x 100 = 600. 6/600 x 100 = 1%. Thus an RM of 100 = 1%.
2. Any number multiplied by 050 will be 2 percent of the multiplication product/result. Proof 6 x 050 = 300. 6/300 x 100 = 2%. Thus an RM of 050 = 2%.
Both top & bottom calculations have an RM of 50 = 2%.
Note: SL distance in points, not pips. For US shares pips are non existent. $30.80 - $30.20 = $0.60 = 60 point price move. For FX: 1 pip = 10 points.
1. Top: Tradeable EQ = 42,505. SL value (SLv) = Vol x TV x Stop Loss distance(SLd) = 170.02 x 0.01 x 500 = 850.10.
850.10/42,505 x 100 = 2%.
850.10 x 50 = 42,505.
2. Bottom: Tradeable EQ = 42,500. SLv = Vol x TV x SLd = 170.00 x 0.01 x 500 = 850.00.
850.00/42,500 x 100 = 2%.
850.00 x 50 = 42,500.
Quantifiable Risk Units (numeric value of SL and its divide number into EQ) are easier to conceptualise and retain than nebulous references of %.
So - 850 represent 2% of initial tradeable EQ of 42,500.00 or 50 risk units at initial tradeable EQ of 42,500.00.
Numerically - in a perfect world of zero slippage and trading costs (commissions & swaps) aside, if a trader were to bang away at 50 consecutive losing trades (not a single profit 🥵) - without stop of trading to recalibrate-recalculate - trader would be down to 100% MRG = 7,491.90 (see image 3 line below).
The indicator shown is a test version - in finality, the only values required are the the 6 final values of the bottom 170.00 volume calculations.
Capital = Margin(MRG) + Equity (EQ)
The capital - which is input as required - is, in this instance, 50,000.
At 170.00 Volume/Lots MRG (7,491.90) = Capital of 49,991.90 used from the initial allotted* or available Capital of 50,000 and 8.10 remains spare capital.
* one may want to use, say, only, 50,000 of 70,000.
The right top calculation is always against micro lots and is a check reference.
The actual maximum allowed volume/lots calculation is 170.02754.
If this value is rounded to 2 decimal places it will be be 170.03. This value will result in EQ + MRG exceeding the available 50,000.
170.02754 has to be truncated at the 2nd decimal point - without rounding - to calculated values within the limits of 50,000.
Thus 170.02754 becomes 170.02. The test indicator displays this volume to 5 decimal places (170.02000) as a check that said Volume has be truncated at 2nd decimal.
The bottom calculation has to determine the product minimum Lot Step and minimum trading Lot Size - which, could be of same or different values.
Thus, the calculation code for the bottom calculations - in a number of instances - differs from that of the above calculation code.
If the bottom calculations reflects value for value in accordance with top calculations for a product with a
micro lots as minimum Lot Step - Lot Size, all is well.
The second calculation is against the product minimum trading Lot Step/Volume Step and Lot Size/Volume Size. Which could be - 0.01, 0.10, 1.00, 10,00 etc.
For this broker, US shares is traded in 1.00 standard lot sizes - as indicated in the indicator info text on the left and the panel trader on the right.
Thus, US share volume representation will always be standard lot sizes - 1.00, 34.00, 267.00 etc.
The margin leverage for US shares is 1:5 or 1:20, depending how it is represented >> 1/5 = 0.2, 0.2 x 100 = 20%, 20/100 = 1/5 etc.,etc., (this, in line with UK ESMA requirements)
Required margin = volume x margin leverage x price. (Vol x (ML x Pr)* ) = (Vol x (0.2 x Pr)*)
Note: * ML (0.2 in this instance) must be rounded (not truncated) to product price digits or decimal places (shares xx.12, FX xx.12345 and in some instances Gold x.123), then the product of ML X Pr must be rounded to currency 2 digits or decimal places before multiplying by Vol.
There are more dark dungeon tortuous calculation procedures lurking beneath the surface.
1. 0.2 x Pr x Vol >> 0.2 = 0.20** >> (0.20 x 220.37) = 44.074 >> 44.074 x 170.00 = 7,492.58 ❌ ** this has no effect in this instance, but would on 0.033333333333 = x.12345 = 0.03333 for FX. Further, keep in mind that calculations for FX lot equivalents are in currency units (CU), not lots. 1 lot = 100,000 CU, 0.10 lots 10,000 CU and 0.01 lots 1,000 CU.
2. 0.2 x Pr x Vol >> 0.2 = 0.20 >> (0.20 x 220.37) = 44.07 >> 44.07 x 170 = 7,491.90 ✅
In the live environment if margin rises to exceed availability of equity against available capital the volume size will reduce in size in accordance with the required value adjustments.
The blue indicator code returns the specific margin value set by the broker. If the broker has #-up the code will return a #-up value and all calculations go #-up. Real world example. Broker has set everything to 1:30 or 1/30 margin leverage. To bring US shared at 20%, 1:5 or 1/5 = 0.2 - to correct value, the 1/30 has to be x by 6, 1/30 x 6 = 0.2. And all other products with different margins adjusted accordingly. This is a #'n headache.
Retail CFD products are synthetic products not traded on a central exchange - with rigorous standards - that singularly controls a product's trading specific metrics-parameter. Because retail brokers control their individual products, each broker is at liberty to assign any value to any specific metric-parameter as they choose. One broker may assign - for product A - a tick value (TV) of 25.00; another, 5.00; another, 1.0; and yet another, 0.01.
For the same product different brokers will assign a different minimum lot step; a minimum trading lot size; Tick Size; etc.. etc., etc. In the UK brokers must assign margin leverage in accordance with ESMA.
Retail brokers lack rigorous central standards and operate with appalling incompetence - numeric illiterate maintenance constantly implementing plain nonsense bs specific metrics. They get away with it because most retail traders, themselves, are numerically inadequate and ignorant regarding product specific metrics-parameters computation-calculation.
It will be seen by applying relevant calculations that increasing the Volume/Lots from 170.00 to 171.00 will result in MRG + EQ values exceeding the allotted or maximum available capital of 50,000.
M15 - vertical dot separation lines: weekly
The chart candle color candy is primary illustrative and indicative of general price movement-action:
can but
does not necessarily indicate entry or exit signals.