Need EntryTime_s and ExitTime_s  [SOLVED]

Questions about MultiCharts and user contributed studies.
User avatar
syswizard
Posts: 271
Joined: 15 Dec 2012
Has thanked: 16 times
Been thanked: 24 times

Need EntryTime_s and ExitTime_s

Postby syswizard » 18 Sep 2022

For the purpose of tracking high frequency trades, I need the time to be more granular....down to the second level.
Anyone else have a need for this ?

User avatar
ABC
Posts: 677
Joined: 16 Dec 2006
Has thanked: 121 times
Been thanked: 382 times
Contact:

Re: Need EntryTime_s and ExitTime_s

Postby ABC » 19 Sep 2022

syswizard,

in my opinion there is no need for these reserved words, as we can access a better granularity using PosTradeEntryDateTime and PosTradeExitDateTime already.

Regards,

ABC

User avatar
syswizard
Posts: 271
Joined: 15 Dec 2012
Has thanked: 16 times
Been thanked: 24 times

Re: Need EntryTime_s and ExitTime_s

Postby syswizard » 19 Sep 2022

syswizard,
in my opinion there is no need for these reserved words, as we can access a better granularity using PosTradeEntryDateTime and PosTradeExitDateTime already.
Whoa....I was unaware of the Pos... functions. Thanks for that.
However, how do I get the TradeNumber ?

User avatar
ABC
Posts: 677
Joined: 16 Dec 2006
Has thanked: 121 times
Been thanked: 382 times
Contact:

Re: Need EntryTime_s and ExitTime_s  [SOLVED]

Postby ABC » 19 Sep 2022

syswizard,

check the respective reserved word in the help file. This should answer your questions.
PosTradeExitDateTime
Returns double-precision decimal DateTime for exit order. As an example see ComputerDateTime

Usage
PosTradeExitDateTime(PosAgo,TradeNumber)

Where: PosAgo - a numerical expression, specifying the position:

0 - open position;

1 - one position back (the last position closed);

2 - two positions back, etc.

TradeNumber - a numerical expression, specifying the number of trade (zero-based).

Notes
This function can only be used in signals.

To retrieve the total number of trades in specified position use PosTradeCount

Example
PosTradeEntryDateTime(1,1) will return a value of 39448.25000000 for the second trade of the last closed position, if this trade was closed at 6:00 AM on January 1st, 2008.
Regards,

ABC

User avatar
syswizard
Posts: 271
Joined: 15 Dec 2012
Has thanked: 16 times
Been thanked: 24 times

Re: Need EntryTime_s and ExitTime_s

Postby syswizard » 19 Sep 2022

TradeNumber - a numerical expression, specifying the number of trade (zero-based).
I've been told this value should be zero....almost always.
To retrieve the total number of trades in specified position use PosTradeCount
Wait ! I need a function to tell me how many TRADES were made so far in the session(s).
Otherwise I must loop to compare all EntryDates and EntryTimes and increment a counter.

bomberone1
Posts: 270
Joined: 02 Nov 2010
Has thanked: 23 times
Been thanked: 19 times

Re: Need EntryTime_s and ExitTime_s

Postby bomberone1 » 20 Sep 2022

Hi syswizars,
which indicator do you want to build?
If you want to build a strategy with this information what do you use it for?


Return to “MultiCharts”