Rule Scripting - (t.*) Trade Operands
This page covers the various trade operands (t.*) used in our rule scripting that relates to the current trade. By default, trade operands relate to the direction (buy/sell) and trade index that is being evaluated. Operands that related to all trade indexes usually contain 'Any' in the name or 'Any' and 'Dir' if any trade indexes but only in the evaluated direction.
- t.alertPrice=price that alert happened, 0 = none, -1 = ready for next
- t.alerttime=alert time, in seconds since EPOC
- t.amntFromPeak=how much profit amount has dropped by since trade whas opened
- t.amntPerPip=amount per pip per lot in account currency
- t.ask=current ask price
- t.atScaleInPrct=percentage to which current trade has been scaled in by
- t.base=base currency if chart symbol is a currency pair
- t.baseIdx=index into Gen_currencies for base currency of chart symbol
- t.bbish=returns 'bullish' if buy direction, else 'bearish'
- t.bid=current bid price
- t.breakEvenSet=returns 1 if set for break even, else 0
- t.brokerSL=broker SL price or nearest if multiple scale-in tickets
- t.brokerSL=broker stop loss price (min if more than one ticket)
- t.brokerSLMax=broker SL price or furthest if multiple scale-in tickets
- t.brokerTP=broker TP price or nearest if multiple scale-in tickets
- t.brokerTPMax=broker TP price or furthest if multiple scale-in tickets
- t.buySell=returns 'buy' if a buy trade and 'sell' if a sell trade
- t.buySellIdxInv=returns 1 for sell and 0 for buy
- t.buySellInv=returns 'sell' if a buy trade and 'buy' if a sell trade
- t.buySellShort=returns 'B' if a buy trade and 'S' if a sell trade
- t.buySellUC=returns 'BUY' if a buy trade and 'SELL' if a sell trade
- t.closeReason=returns reason for recent trades closeure, e.g. SL, TP
- t.closeReasonOpp=returns reason for recent trade close in other direction
- t.counter=counter currency if chart symbol is a currency pair
- t.counterIdx=index into Gen_currencies for counter currency of chart symbol
- t.dayCloesProfitPips=profit in pips of trade closed today for chart symbol
- t.dayClosedProfit=profit of trade closed today for chart symbol
- t.direction=returns 0 for sell and 1 for buy
- t.directionInv=returns 1 for sell and 0 for buy
- t.dirOpen=return 1 any trade open in direction being evaluated
- t.dirOpen=returns 1 if trade open for any trade index
- t.dirOpenOpp=return 1 any trade open in opposite direction being evaluated
- t.dirOpenOpp=returns 1 if trade open for any trade index in the opposite direction
- t.durationBars=current open trade duration in bars/candles
- t.durationMins=current open trade duration in minutes
- t.durationSecs=current open trade duration in seconds
- t.eventLong=long value input for received event
- t.eventStr=string value input for received event
- t.filersActive=lists filters that are currently blocking trade direction
- t.filersActiveOS=lists onSignal filters that are currently blocking trade direction
- t.filtersActiveOpp=lists filters that are blocking opposite direction
- t.filtersActiveOSOpp=lists onSignal filters that are blocking opposite direction
- t.hasEntry=returns 1 if indicator configured that is being used for entry, else 0
- t.indiEntry=percentage of entry indicators in agreement for direction being evaluated
- t.indiEntryVoid=returns 1 if HighAndStart indicators are voiding currently signalled direction, else 0
- t.indiExit=percentage of exit indicators gone opposite for current trade
- t.indiMissing=return 'no <referenceID>' if custom indicator is missing/not loading
- t.indiReset=percentage of reset indicators gone opposite for current trade
- t.justOpenedAny=briefly returns 1 if trade just been opened in any direction, else 0
- t.keypressChar=uppercase character of pressed key - set when evaluating keypress rules
- t.keypressCode=code of pressed key - set when evaluating keypress rules
- t.keypressCount=repeat count for pressed key
- t.keypressMask=shift alt control mask when key pressed
- t.lastScreenshot=filename of most recent screenshot
- t.lastTicketCloseTime=close time of most recently closed ticket
- t.lastTicketOpenTime=open time of mpost recent open ticket
- t.loopIdx=loop index number when rule set to loop
- t.loopIdxMinus1=loop index number minus 1
- t.loopIdxPlus1=loop index number plus 1
- t.magicNum=magic number for trade
- t.marginFreePrct=free margin divided by margin required for trade * 100
- t.martingale=number of consecutive losing trades currently had
- t.mode=auto entry mode, e.g. TC
- t.modeEval=1 if auto entry mode to EVL (evaluate), else 0
- t.modeExit=auto exit mode, e.g. AUTO
- t.modeTrade=1 if auto entry mode is one of T*, else 0
- t.moveOkay=returns 1 if pips between market & signal <= configured maximum
- t.newBar=1 if new candle/bar has formed, else 0
- t.newBarTick=number of ticks since new bar, where 1 is first (will be 0 after restart)
- t.numTickets=number of tickets for the trade, i.e. including scale-in tickets
- t.numTPlevels=number of configured take profit targets/levels
- t.opening=1 if trade open is in progress, else 0
- t.openingEither=1 if trade open is in progress in either direction, else 0
- t.openOrCurrent=original open price or pending price if set, else current market price
- t.openOrCurrent2=as t.openOrCurrent but if market price returned then bid price
- t.openPrice=original trade open price
- t.openSignalled=1 if TRADE_OPEN command has been called, else 0
- t.openTime=original trade open time
- t.origSLprice=original stop loss price at trade open
- t.peakPips=peak pips achieved since trade opened
- t.peakPrice=peak price achieved since trade opened (in profit direction)
- t.peakProfit=peak profit amount achieved since trade opened
- t.peakRR=peak risk reward ratio since trade opened
- t.pendPrice=pending price that has been set
- t.pendPriceOpp=pending price that has been set in the opposite direction
- t.period=period of chart as string literal, e.g. M15
- t.periodMin=period of chart in minutes
- t.periodSet=period set for calculations (say stop loss), e.g. M15 or 0
- t.pipValPerLot=pip value in account currency per lot
- t.point=point value of chart symbol, e.g. 0.00001
- t.prevPeakPips=peak pips for previous rule evaluation (in profit direction)
- t.prevTimestamp=previous timestamp of last tick from market in seconds since EPOC
- t.profit=profit of open trade
- t.profitAny=total profit of all trade indexes in both directions
- t.profitAnyDir=total profit of all trade indexes for currently evaluated direction
- t.profitClosePips=pips profit between last closed price and trade open price
- t.profitDisplay=profit amount displayed in status text
- t.profitDisplayColor=profit color displayed in status text
- t.profitOpp=profit of open trade in opposite direction
- t.profitPips=trade profit in pips
- t.profitPipsAny=total profit pips of trade indexes in both directions
- t.profitPipsOpp=trade profit in pips for opposite direction
- t.profitTicketPipsAny=trade profit in pips for all tickets based on open price and current difference
- t.risk=risk setting as set on panel
- t.riskPips=risk in pips, i.e. SL pips plus spread
- t.signalBars=how many bars/candles have past since trade signal
- t.signalPrice=price that signal happened, 0 = none, -1 = ready for next
- t.signalSecs=how many signals have past since trade signal
- t.signalTime=signal time, in seconds since EPOC
- t.slAutoPrice=price being return by auto SL calculation method
- t.slMode=stop loss mode or pips
- t.slPips=stop loss in pips
- t.slPrice=price stop loss is set to
- t.slPriceNoMinMaxOpp=price stop loss without min/max applied in opposite direction
- t.slPriceOpp=price of stop loss in opposite direction
- t.spread=current spread in pips
- t.symbol=current chart symbol
- t.timestamp=current timestamp in chart/server time as seconds since EPOC
- t.timestampStr=current timestamp formatted for display
- t.totalLots=total lots of trade including scale-in
- t.totalProfit=total profit on account for magic numbers EA in managing
- t.totalProfitPips=as t.totalProfit but in pips
- t.tpLevel=current TP level/target being evaluated, e.g. for line text
- t.tpPrice=price of TP level/target being evaluation, e.g. for line text
- t.tradeAnyFree=1 if free trade index, i.e. not open or pending set, else 0
- t.tradeID=trade index being evaluated, from 0 upwards
- t.tradeIdx=trade index being evaluated, from 0 upwards
- t.tradeIdxEven=1 if current trade index is even number, else 0
- t.tradeIdxMinus1=current trade index minus 1
- t.tradeIdxPlus2=current trade index plus 1
- t.tradeInUse=1 if currently evaluating trade index is use (open or pending), else 0
- t.tradeInUseDir=as t.tradeInUse but just for currently evaluated direction
- t.tradeMaxIdx=maximum value of trade index
- t.tradeNumInUse=number of trade indexes in use (both directions)
- t.tradeNumInUseDir=number of trade indexes in use for currently evaluated direction
- t.tradeOpen=1 if trade currently open, else 0
- t.tradeOpen=1 if trade open in opposite direction, else 0
- t.tradeOpenAny=1 if any trade index has trade open, else 0
- t.tradeOpenAnyDir=1 if any trade index open for currently evaluated direction, else 0
- t.tradeOpenAnyDirOpp=as t.tradeOpenAnyDir but for opposite direction
- t.tradeOpenBoth=1 if trade open in both directions, else 0
- t.tradeOpenEither=1 if trade open in either direction, else 0
- t.tradeOtherOpenDir=1 if any other trade index open for currently evaluated direction, else 0
- t.tradeSelIdx=currently selected trade index via 'Selected Trade' on panel
- t.trail=1 if trail of SL is turned on, else 0
