+1 888 340 6572

# Keeping Track of Bar Number with Pyramid Trading

Description

Unfortunately the reserved word BarsSinceEntry() will not do what is needed when trading multiple contracts with multiple entries (i.e. Pyramid Trading). Also, the reserved words CurrentEntries and TotalTrades, although helpful, are not an idea fix to our issue. Our issue is that we need a reserved word, say, BarsSinceEntryPyramid(), that can keep track of the bar number of each position that is either open. For example, let's say a strategy buys three contracts on each entry. Let's say the strategy has four open positions and that it's on a daily price series. Out of these four open positions, which may have up to 12 contracts open since 3 lots are bought each time, the reserved word needs to tell us how many bars ago the system bought all three lots (since three lots is a position when buying 3 at a time). And if the system is long only 10 lots in this scenario (2 lots were exited at profit from the first 3 lot position), the reserved word needs to work. The current reserved word requires that positions be closed out for it to work.
Basically, we need a new feature to deal with strategy developers who use pyramid trading and multiple contracts per entry with pyramiding.
Thanks for the consideration.

Steps to reproduce this issue

Set up a strategy to buy say three lots on three dates close to each other such that you can see it on the chart. Then use the current reserved word, BarsSinceEntry() on a few subsequent bars to see how it is working. Use it on bars where the system is open all 9 lots from all three entries; use it when the system is long 8 lots, 7 lots, 6 lots, 5 lots, 4 lots, 3 lots, 3 lots, 1 lots, and then zero lots. You will then see the short-fall of the current reserved word.
You could use If MarketPosition = 1 then Value1 = Text_new(D, T, L - 2, NumtoStr(BarsSinceEntry(2), 0));
or some similar statement to print on the chart for viewing how the current BarsSinceEntry() funtion operates under these conditions.

History
Issue basics
• Type of issue
Feature request
• Category
Usability
• Targeted for
Not determined
• Status
Not Reviewed
User pain
• Type of bug
Not triaged
• Likelihood
Not triaged
• Effect
Not triaged
Affected by this issue (2)
People involved
Times and dates
• Posted at
• Last updated
Issue details
• Resolution
Not determined
• Severity
Normal
Attachments (0)
There is nothing attached to this issue
Commits (0)
There are no code checkins for this issue
Duplicate issues (0)
This issue does not have any duplicates