How do I get the FillPrice when a position is bought?

How can I get the FillPrice i.e. price at which a position was bought as a static (non-changing) value?

I'm building a strategy using Limit Orders and a mid-level CBT.
SetTradeDelays are 0.
BuyPrice = Min(Open,LimitEntryPrice), where Open is today's open and LimitEntryPrice is yesterday's Close * 0.97.

Two of the system rules are:

  • Exit if today's close < FillPrice - (3 * ATR(14)).
  • Exit if the trade is longer than 6 days

This (and other) exit rules are implemented via the Sell variable not via ApplyStop.

I can't work out how to implement FillPrice as a static (non-changing) value as of the Buy signal.

There could be multiple Buy signals in a row, and I only want the first one until a reset of the Buy array.

IOW, if I have:

Buy = [1,1,1,0,0,1,1,0,1]

FillPrice should be as of Bars 0, 5, and 8.

I've investigated BarsSince() (and searched the forum), but I can't use ExRem(Buy,Sell) since I need the FillPrice to derive the Sell array.


This topic was automatically closed 100 days after the last reply. New replies are no longer allowed.