The position detail keyword is one of the most important and versatile keywords of Tradetron. The same keyword can be used in various ways to control what your strategy does in a very precise ways. This keyword is a strategy level keyword which means that is is independent of sets and will take into consideration, all the positions within a strategy. In most keywords, a users is typically adds an input and hence receives an output in the form of the result. However while using position detail, one must first think of what is the output that the user wants to achieve and then built and input in position detail for the same.
Position detail has 4 inputs namely Condition type, Transaction Type, Instrument type and Underlying and 3 outputs Value, Quantity and Count of which anyone can be selected at a time

In order to explain the same consider the following cases:
Assume you buy one lot of Nifty 50 Monthly CE that has a lot size of 50.
Now if you use the position detail keyword with these settings, it will fetch number +50 as the system is looking at all the conditions in the strategy, all transactions and all instrument types.

However if I modify the filter to check for only entries and sell type transactions, the position detail keyword will return 0. This is because even though there is an entry here, there is no Sell in the strategy thus fetching 0.

Similarly if I modify the same keyword to look for entries of Buy transactions but the instrument is selected as PE, it will again return 0. This is because no PE has been currently traded in the strategy.

Now assume that the same Nifty 50 Monthly CE has been squared off by the repair once condition.
Now if I add the same keyword, with the settings shown above, it will fetch 0. This is because we are looking for the positions of 'all' condition types in the strategy. Thus the entry condition will fetch number +50(since we went long) and the repair condition will fetch -50(since we went short). When we look for the summation of all the condition types, we get (+50) + (-50) thus returning 0
If I select repair once as the condition type and keep the transaction and instrument type as all, the same keyword will return -50 and there was a short position taken in the repair once trade.

Using the above cases we are trying to point to the fact that position detail can be used effectively to check if certain positions are taken or not taken. Based on the same you get granular logical control over the positions being taken by your strategy at every point.
Position detail in a strategy level keyword and not a set level keyword. No matter which set you use it in, it will return the output based on all the sets ie. the strategy.
Let us understand the use of position detail with an example
#Example 1
Suppose you have 2 sets in a NIFTY 50 straddle strategy where each set is selling a straddle and you want that only 1 set must be active at a time, then you can use the below position detail configuration in the entry of both the sets

In the above configuration, we are basically checking the net quantity of the strategy whether it is 0 or not. If it is 0, that means no set is active and anyone set can be active.
Suppose set 2 enters then position detail will return -100 as it is CE and PE sell each 1 lot so net quantity is -100. Now after some time set exit happens and positions are squared off then the net quantity becomes 0.
#Example 2
Suppose you have a 1 set strategy where you are building a long straddle. Now you wish that set 1 enters only once per day.
So in set 1 since it is buying CE and PE, we will use the below configuration in set 1 entry conditions
In this arrangement, we are selecting Entry and B because when buy legs are traded for the first time, Position detail keyword will return 0 as no trades have occurred and thus it will allow first entry. Now as soon as set 1 entry happens the position detail keyword will return 100 as ENTRY, B, ALL, Quantity = 100, thus condition will not be satisfied for the second entry, preventing re-entry for set 1
The above keyword will scan only the Entry blocks of both sets and return the Buy quantity
#Example 3
Suppose you are trading a list of stocks and want to limit the number of entries by 5 for the day/counter. You can use the count function of position detail. It is generally used when using a list of stocks.

The above keyword will limit the entries to 5. Count function will give the output of no. of times unique instruments have been traded.
For simplicity Position detail count will return the no. of rows in the deployed page, consider the image below.

In the above image, 5 rows are visible. Position detail count will return 5 as 5 unique instruments (stocks) have been traded. Even if LT from that list entered, exited 3 times, Position detail Count will still return 5 as unique instruments are only 5.
Note: Suppose 6 stocks satisfy at an instant, position detail count will allow entry for all 6 stocks instead of 5 and next condition check it won't allow entry. To have a foolproof method of limiting entry, you need to decrease the size of the list such that the probability of multiple stocks satisfying conditions at the same instance is reduced or can go for custom coding.
You can use the same logic for restricting entry in option strategy. But note that Option instruments are unique if strike, expiry option type is different.