Welcome to NexusFi: the best trading community on the planet, with over 150,000 members Sign Up Now for Free
Genuine reviews from real traders, not fake reviews from stealth vendors
Quality education from leading professional traders
We are a friendly, helpful, and positive community
We do not tolerate rude behavior, trolling, or vendors advertising in posts
We are here to help, just let us know what you need
You'll need to register in order to view the content of the threads and start contributing to our community. It's free for basic access, or support us by becoming an Elite Member -- see if you qualify for a discount below.
-- Big Mike, Site Administrator
(If you already have an account, login at the top of the page)
Can someone code the following measure of congestion at each price level on a chart? Only certain ones above an input set threshold would be displayed.
The idea is to look back from the current price to all levels above and below to calculate how many bars behind the current bar contain a price matching the given price.
(Close <= the high and Close >= the low of each given bar)
The first match, no matter how far back it is, begins the count at 1. From there, each bar back to the first one loaded on the chart is checked for a match to the given price. You add up the bars checked from the first match back to the beginning of the chart.
And one bar at a time, it will calculate the following formula for each price level one tick apart:
(Bar Matches / Bars Checked) * Bar Matches = PDI
Once this is calculated with each bar in regression, the maximum value out from all bars checked and calculated one at a time for that given price level is recorded as pertaining to that level.
As an example, 5 bars in a row to start the count would equal a running PDI of 5. If the next two bars checked did not match, then two more then did, it would be a total of 7 matches out of 9 checked. This would yield a PDI of (7 / 9) * 7 or 5.44. I have attached a chart for a visual example on a limited number of bars.
The idea is to compare this number at each level in both favorable and adverse movement to the Thrust Factor of a pattern traded to determine an exit point with a MIT order wherever the PDI is bigger than the Thrust Factor (TBD).
Any questions please post...thanks in advance!
Matt Thomas PDI Illustration
Can you help answer these questions from other members on NexusFi?
QUESTION: Why does the following code used to detect and plot a PaintBar for certain specified Pivots fail in giving the error that it cannot reference historical data into the future?...
Condition1 = Low < Lowest(Low, Value1)[1]; { Active or pertinent Low breaks below the Low Pivot to be called the Trigger Point at 1 tick below that Trigger Pivot }
Condition2 = Value2 >= Highest(High, Value1);
{ High for the Trigger Set is the Trigger Set Extreme at its first bar (subsequent ties allowed) }
Condition3 = Pivot(Low, 233, LowLS1, Trigset, 1, -1, LowPivotPrice1, LowPivotBar1) <> -1;
{ Low Pivot with a minimum Right Strength of <Trigger Set> }
Condition5 = High[Value1] > HighPivotPrice1;
{ High Pivot must be less than the Trigger Set Extreme High }
Condition6 = Open[Value1] >= Low[LowPivotBar1] or High[Value1] >= Low[LowPivotBar1];
{ Prevents gaps from causing unwanted entry points too far from the Trigger Point if not filled on that bar by the eventual High for that bar }
Condition7 = BarNumber[LowPivotBar1] > BarNumber[HighPivotBar1];
{ High Pivot must occur first }
{ Not sure how to disregard any High Pivots occurring within the Trigger Set that would usurp the 1st instance of a High Pivot that must occur behind the Trigger pivot }
Value4 = Value2 - LowPivotPrice1;
{ Distance from the Trigger Set Extreme to the Low Pivot (Trigger Pivot) called the Standard Profit Projection (SPP) to be later used for stop placements }
Value5 = HighPivotPrice1 - LowPivotPrice1;
{ Height of the bars prior to the Trigger Set back to the High Pivot }
Condition8 = Value2 - HighPivotPrice1 <= Value5;
{ Disallows any overly long "tail" in the Trigger Set that would cause a lopsided pattern }
Condition9 = High > Highest(High, Value1)[1]; { Active or pertinent High breaks above
the High Pivot to be called the Trigger Point at 1 tick above that Trigger Pivot }
Condition10 = Value3 <= Lowest(Low, Value1);
{ Low for the Trigger Set is the Trigger Set Extreme at its first bar
(subsequent ties allowed) }
Condition11 = Pivot(High, 233, HighLS2, HighRS2, 1, 1, HighPivotPrice2, HighPivotBar2) <> -1;
{ High Pivot with a minimum Right Strength of <Trigger Set> }
Condition13 = Low[Value1] < LowPivotPrice2;
{ Low Pivot must be greater than the Trigger Set Extreme Low }
Condition14 = Open[Value1] <= High[HighPivotBar2] or Low[Value1] <= High[HighPivotBar2];
{ Prevents gaps from causing unwanted entry points too far from the Trigger Point if
not filled on that bar by the eventual Low for that bar }
Condition15 = BarNumber[HighPivotBar2] > BarNumber[LowPivotBar2];
{ Low Pivot must occur first }
{ Not sure how to disregard any Low Pivots occurring within the Trigger Set that
would usurp the 1st instance of a Low Pivot that must occur behind the Trigger Pivot }
Value6 = HighPivotPrice2 - Value3;
{ Distance from the Trigger Set Extreme to the Low Pivot (Trigger Pivot) called the
Standard Profit Projection (SPP) to be later used for stop placements }
Value7 = HighPivotPrice2 - LowPivotPrice2;
{ Height of the bars prior to the Trigger Set back to the High Pivot }
Condition16 = HighPivotPrice2 - Value3 <= Value7;
{ Disallows any overly long "tail" in the Trigger Set that would cause a lopsided pattern }