Keywords are the building blocks of any Tradetron strategy. They are like functions in the programming language, and every function (or keyword) serves a specific purpose. In order to build an algorithmic strategy in Tradetron, you need to be well versed with all the keywords they offer. In this article, we will talk about the 10 most useful Tradetron keywords that you must know to get started with this platform.
If you haven’t signed up for Tradetron yet, click on this link to get started.
The 10 Most Useful Tradetron Keywords
These 10 keywords are not sorted in any particular order. All of them are equally useful for developing a trading strategy.
Keyword 1: Position
99% of strategies built withTradetron would have a Position keyword on them. This keyword allows you to fetch the value of OHLC prices or any technical indicator for any particular candle. For example, if you need the ADX value from the previous candle, you would use the position keyword.
The current candle corresponds to position 0, previous candle is position -1, previous to that is position -2… and so on. Once you add a Position keyword in your condition, you can further define the timeframe and instrument name(s).
See the below image for the full construct of the Position keyword:
In short, the position keyword is the backbone of any Tradetron strategy.
Keyword 2: LTP
The LTP keyword returns the last traded price of the selected instrument. It is generally used to build stop loss and target conditions. For example – if LTP < 95% of Traded Price, then you exit the trade (5% stop loss hit).
The LTP can be fetched based on any of the 4 criteria in the below screenshot:
- ‘Futures’ return the LTP of the specified futures instrument.
- ‘Get runtime’ fetches LTP based on the variable set in the custom python code.
- ‘Instrument Name’ can be used to get the last traded price of an equity, futures, or options symbol.
- ‘Traded Instrument Name’ gets you the LTP of the symbol you have already traded in one of the strategy sets.
To understand in detail how a strategy is organized in Tradetron, please see this article.
Keyword 3: Traded Instrument
Another interesting keyword, ‘Traded Instrument’ can fetch you the price, strike, or quantity of the instrument already traded as part of any set or condition in the strategy.
For example – if you want to compare the traded price with the current price and take actions based on it, you would need to use Traded Instrument keyword.
See below the structure of the Traded Instrument keyword:
- ‘Condition Type’ can be entry, repair, or exit.
- ‘Field’ is what you want to fetch. It can be price, strike, or quantity.
- ‘Underlying’ is your instrument name
- ‘Set’, ‘Condition’ or ‘Leg’ numbers represent the section of the strategy from where you want to fetch the details.
Keyword 4: Positions Detail
The Positions Detail keyword is used to know the quantity or value of the position already taken as part of the strategy.
It can be used to restrict the trades based on a certain condition. For example, the below setup will take trade only when time is greater than 10 AM and there isn’t any entry position already taken on Nifty 50
The structure of the position detail keyword is as under:
- ‘Condition Type’ can be entry or repair
- ‘Transaction Type’ can be buy, sell, or all
- ‘Instrument Type’ can be CE, PE, or All
- ‘Value/Quantity’ is used to specify whether you want to fetch the transaction value or the quantity from the position.
- ‘Underlying’ is your instrument name
Keyword 5: ORB
ORB or Opening Range Breakout keyword can fetch you either the highest high or lowest low price from a given time range. It doesn’t necessarily have to be an opening range, you can specify any time range and get the high or low prices for it.
The below configuration of the ORB keyword will return the highest high price of the first 15-minute candle (9:15 AM to 9:30 AM).
In the ‘Instrument’ dropdown, you can pick one of the below options:
- Get runtime
- Instrument Name
- Traded Instrument Name
These options work similarly to how they work for the LTP keyword (described above).
Keyword 6: Time
This is probably the simplest but most used keyword in Tradetron. It is very helpful while creating intraday trading strategies.
The keyword returns the current time in HHMM format. Please note that the time is returned in 24H format. So 3:15 PM means 1515.
See the below screenshot where the current time is compared against a number 1515. If it is greater than that, the rule condition is met.
The keyword accepts “Exchange Name” as a parameter. We are not sure about the reason for the same, as time is universal and shouldn’t depend on any exchange.
Keyword 7: PNL & PNL Underlying
PNL stands for Profit and Loss. As the name suggests, the keyword returns the PNL of the strategy at a given point.
It is a strategy level keyword and considers all the sets and conditions defined in the strategy for PNL calculation.
PNL keyword doesn’t require any parameters. While PNL Underlying accepts symbol name or list name as the parameter, the profit or loss, in that case, would be returned only for a particular symbol.
Keyword 8: Day
The Day keyword is particularly useful for strategies that only trade on certain days. For example – most option sellers don’t prefer to trade on Fridays due to low premium decay. So day keyword would be handy in such cases.
The keyword returns the day of the week as an integer. 0 for Sunday, 1 for Monday, and so on.
See the below screenshot where it is checked if the current day is not equal to Friday
Keyword 9: Open Positions
The Open Positions keyword returns the number of open positions for a strategy at a given point in time. The keyword accepts the underlying symbol or list name as a parameter.
This keyword is very useful in position sizing. For example – If you want to take only 4 positions at a given time, you can configure this rule using this keyword.
See the below screenshot where it is checked if the number of open positions for the Nifty 50 list is less than or equal to 4.
Keyword 10: Cross
The Cross keyword is very useful in implementing crossover type strategies such as moving average crossover.
It accepts two parameters – Series 1 and Series 2. If you want to check if the close price has crossed over the moving average, then your series 1 would be close price and series 2 would be SMA.
The keyword returns binary values TRUE or FALSE. If the crossover condition is met, it returns TRUE otherwise FALSE
Those were the 10 most useful Tradetron keywords. If you get familiar with these, you would be able to develop 99% of the strategies. Please note that you don’t have to code these keywords anywhere. Tradetron has a drag and drop web interface where these keywords can be configured within seconds.
There are 100’s of other keywords apart from these, but cannot really cover all of them in one article. But do let us know if you need help understanding any specific keyword.