Feature Request: TradeTime for Closed

Posted By: GPEngine

Feature Request: TradeTime for Closed - 10/21/14 15:00

TradeTime
The number of bars since the trade was entered (for pending trades) or opened (for open trades).

Feature request. Extend this to be
TradeTime
The number of bars since the trade was entered (for pending trades) or opened (for open trades) or the trade duration (for closed trades).

I just noticed that TradeTime is not frozen when the trade is closed. This means it equals [Last Bar in simulation] - [Trade Open Bar] for Closed trades, a decidedly useless value once you're in the EXITRUN looping over your trades laugh
Instead I would like to get at the number of bars from Open to Close for each trade.
Posted By: GPEngine

Re: Feature Request: TradeTime for Closed - 10/22/14 13:40

I think I see, TradeTime is useful for supplying an offset to date related functions
hour(TradeTime)
perhaps that is it's main purpose? If so, it would have been more obvious if it had the word offset in its name.
Posted By: jcl

Re: Feature Request: TradeTime for Closed - 10/22/14 16:58

You can see the definitions in variables.h - TradeTime is not a real variable, but a macro. The trade duration for closed trades would be (TradeBarClose-TradeBarOpen).
© 2024 lite-C Forums