Referencing Entry bar values

Questions about MultiCharts and user contributed studies.
jules7
Posts: 2
Joined: 14 Oct 2010
Has thanked: 1 time

Referencing Entry bar values

Postby jules7 » 06 Feb 2014

It would be extremely useful to be able to reference the OHLC values of a trade entry bar with a view to anchoring an exit to one of the values.

For example let's say my strategy usually puts me in a long position within 3 bars of the last swing low and I wish to put a stop loss at that swing low. In EasyLanguage I would use a simple line of code:

Code: Select all

Sell next bar from entry("MY LE") At$ lowest(low,3)Stop;
In other words place a stop loss at the lowest low in the 3 bars back from the bar my strategy entered on.

Unfortunately PowerLanguage still doesn't support the reserved word "At$" which I find surprising as placing a stop at or just below the nearest swing low or above the nearest swing high for a short position is pretty common practice. It would be nice to be able to do that easily in an automated strategy.

Is it likely that At$ will be implemented in PowerLanguage any time soon? If not I would be most grateful to hear from anyone who has a workaround solution they would be kind enough to share.

User avatar
Henry MultiСharts
Posts: 9165
Joined: 25 Aug 2011
Has thanked: 1264 times
Been thanked: 2957 times

Re: Referencing Entry bar values

Postby Henry MultiСharts » 07 Feb 2014

Hello jules7,

That is possible to store the values of the entry OHLC bar in a variable for future reference or get the bar number using PosTradeEntryBar, then get the required bar's OHLC values.


Return to “MultiCharts”