EasyLanguage coding questions - futures io
futures io



EasyLanguage coding questions


Discussion in EasyLanguage Programming

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




Welcome to futures io: the largest futures trading community on the planet, with well over 150,000 members
  • 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 and simple.

-- Big Mike, Site Administrator

(If you already have an account, login at the top of the page)

 
Search this Thread
 

EasyLanguage coding questions

(login for full post details)
  #1 (permalink)
 BeetleBaum 
East Ridge, Tennessee, USA
 
Experience: Master
Platform: TradeStation
Trading: Futures, Stocks, Options, Forex
 
Posts: 14 since Nov 2022
Thanks: 3 given, 1 received

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:	16
Size:	335.0 KB
ID:	328664  
Started this thread Reply With Quote

Can you help answer these questions
from other members on futures io?
Multi Time Frame High/Low/Median levels
NinjaTrader
Market on Close data within IB
Platforms and Indicators
in depth understanding of last, bid, and ask volume in c …
NinjaTrader
Demo accounts order fill
Emini and Emicro Index
Big Mo Indicator for NT8
NinjaTrader
 
Best Threads (Most Thanked)
in the last 7 days on futures io
Is anyone actually making money?
52 thanks
An embarrassing, honest confession
37 thanks
Sierra vs. Ninja : why I chose .....
8 thanks
Machine Learning Journal
5 thanks
Institutional Grade Massive Data Dump for Quant Research …
5 thanks
 
(login for full post details)
  #2 (permalink)
 BeetleBaum 
East Ridge, Tennessee, USA
 
Experience: Master
Platform: TradeStation
Trading: Futures, Stocks, Options, Forex
 
Posts: 14 since Nov 2022
Thanks: 3 given, 1 received

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
 
(login for full post details)
  #3 (permalink)
 bobwest 
Site Moderator
Sarasota FL
 
Experience: Advanced
Platform: Sierra Chart
Trading: ES, YM
 
bobwest's Avatar
 
Posts: 7,682 since Jan 2013
Thanks: 55,215 given, 25,270 received



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


futures io Trading Community Platforms and Indicators EasyLanguage Programming > EasyLanguage coding questions


Last Updated on December 23, 2022


Upcoming Webinars and Events
 

NinjaTrader Indicator Challenge!

Ongoing
     



Copyright © 2023 by futures io, s.a., Av Ricardo J. Alfaro, Century Tower, Panama, Ph: +507 833-9432 (Panama and Intl), +1 888-312-3001 (USA and Canada), info@futures.io
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.
no new posts