NexusFi: Find Your Edge


Home Menu

 





EasyLanguage coding questions


Discussion in EasyLanguage Programming

Updated
    1. trending_up 1,199 views
    2. thumb_up 0 thanks given
    3. group 1 followers
    1. forum 2 posts
    2. attach_file 1 attachments




 
Search this Thread

EasyLanguage coding questions

  #1 (permalink)
 BeetleBaum 
East Ridge, Tennessee, USA
 
Experience: Master
Platform: TradeStation
Trading: Futures, Stocks, Options, Forex
Posts: 17 since Nov 2022
Thanks Given: 4
Thanks Received: 4

PRICE DENSITY INDEX


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

Attached Thumbnails
Click image for larger version

Name:	PDI Illustration.jpg
Views:	46
Size:	335.0 KB
ID:	328664  
Started this thread Reply With Quote

Can you help answer these questions
from other members on NexusFi?
Trade idea based off three indicators.
Traders Hideout
Pivot Indicator like the old SwingTemp by Big Mike
NinjaTrader
MC PL editor upgrade
MultiCharts
NT7 Indicator Script Troubleshooting - Camarilla Pivots
NinjaTrader
Better Renko Gaps
The Elite Circle
 
Best Threads (Most Thanked)
in the last 7 days on NexusFi
Spoo-nalysis ES e-mini futures S&P 500
48 thanks
Just another trading journal: PA, Wyckoff & Trends
33 thanks
Tao te Trade: way of the WLD
24 thanks
Bigger Wins or Fewer Losses?
24 thanks
GFIs1 1 DAX trade per day journal
22 thanks
  #2 (permalink)
 BeetleBaum 
East Ridge, Tennessee, USA
 
Experience: Master
Platform: TradeStation
Trading: Futures, Stocks, Options, Forex
Posts: 17 since Nov 2022
Thanks Given: 4
Thanks Received: 4

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?...

Input: MinRatio (3.1415927);

Input: TrigSet(4);

Variables: LowPivotPrice1(0), LowPivotBar1(0), HighPivotPrice1(0), HighPivotBar1(0);
Variables: LowLS1(1), LowRS1(TrigSet), HighLS1(1), HighRS1(1);

Value1 = TrigSet - 1;
Value2 = High[Value1];
Value3 = Low[Value1];

// SHORT trade setup conditions

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> }

Condition4 = Pivot(High, 233, HighLS1, HighRS1, 1, 1, HighPivotPrice1, HighPivotBar1) <> -1;
{ High Pivot behind Low Pivot }

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 }


// ***************************************************


Variables: LowPivotPrice2(0), LowPivotBar2(0), HighPivotPrice2(0), HighPivotBar2(0);
Variables: HighLS2(1), HighRS2(TrigSet), LowLS2(1), LowRS2(1);


// LONG trade setup conditions

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> }

Condition12 = Pivot(Low, 233, LowLS2, LowRS2, 1, -1, LowPivotPrice2, LowPivotBar2) <> -1;
{ Low Pivot behind High Pivot }

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 }

Condition17 = (BarNumber[Value1] - BarNumber[HighPivotBar1]) / TrigSet >= MinRatio;

Condition18 = (BarNumber[Value1] - BarNumber[LowPivotBar2]) / TrigSet >= MinRatio;

If Condition17 and LowPivotBar1 = LowRS1 then
begin
PlotPaintBar[TrigSet](High, Low, "Short Trade", Red);
Alert("Short Trade Alert!");
end;

Started this thread Reply With Quote
  #3 (permalink)
 
bobwest's Avatar
 bobwest 
Western Florida
Site Moderator
 
Experience: Advanced
Platform: Sierra Chart
Trading: ES, YM
Frequency: Several times daily
Duration: Minutes
Posts: 8,168 since Jan 2013
Thanks Given: 57,468
Thanks Received: 26,279



BeetleBaum View Post
PRICE DENSITY INDEX


[SIZE="4"][SIZE="3"]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.


BeetleBaum View Post
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?...

Can someone give a look at these EasyLanguage questions and give a hand?

Bob.

When one door closes, another opens.
-- Cervantes, Don Quixote
Reply With Quote




Last Updated on December 23, 2022


© 2024 NexusFi™, s.a., All Rights Reserved.
Av Ricardo J. Alfaro, Century Tower, Panama City, Panama, Ph: +507 833-9432 (Panama and Intl), +1 888-312-3001 (USA and Canada)
All information is for educational use only and is not investment advice. There is a substantial risk of loss in trading commodity futures, stocks, options and foreign exchange products. Past performance is not indicative of future results.
About Us - Contact Us - Site Rules, Acceptable Use, and Terms and Conditions - Privacy Policy - Downloads - Top
no new posts