runwiseFX

groundbreaking functionality for MetaTrader & TradingView

Rule Scripting - (f.*) Functions

Available functions and their parameters are shown. Functions can be used both in operands and for the parameters of commands and other functions, i.e. can be nested. Functions should be specified with any parameters in brackets and multiple parameters should be separated by a semi-colon.


  • f.acctLosers: Account Losing Trades
    Returns the number of losing trades closed since the supplied reference point, e.g. start of the day. Only trades with magic numbers managed by the EA are checked if EA input Gen_accountManagedTradesOnly is set to true. Returns 0 if no reference point is supplied.
    • reference: Reference point to count closed trades from. Can be D1, W1 or MN for start of day, week or month, with optional hours offset, e.g. D1+2 or D1-2.
    • flags: If contains S then only chart symbol is checked. If contains O then trade open time must also be after the reference point.

  • f.acctLots: Account Lots
    Returns total lots of tickets currently open on the account for the chart symbol. Only trades with magic numbers managed by the EA are checked if EA input Gen_accountManagedTradesOnly is set to true.

  • f.acctProfit: Account Profit
    Returns profit of trades open on the account, optionally including trades closed since a reference point, e.g. start of the day. Can return amount, percentage or pips. Returns blank if no trades are open.
    • context: If contains % then returns percentage of account, if contains p then returns pips, else returns amount in account currency.
    • reference: Reference point to include closed trades from. Can be D1, W1 or MN for start of day, week or month, with optional hours offset, e.g. D1+2 or D1-2. If blank then just open trades.
    • flags: S for chart symbol only, D for direction being evaluated only, P to only count profitable trades, A for all trades must be in profit (else returns -1).
    • tradeIdx: Trade index to check, or MTO for managed trades only, ALL for all trades on account, or TRADE for trade index being evaluated. Ignored if magicNum supplied.
    • magicNum: If supplied then only trades with this magic number are checked.
    • magicNumEnd: If supplied then checks range of magic numbers from magicNum up to this value.

  • f.anyGUIOpen: Returns 1 if any trade index with a trade open in the direction being evaluated has the supplied GUI control set to the supplied value, else 0
    • refID: Reference ID of GUI control
    • value: Value GUI control must be set to

  • f.arPips: Average Range or Pips to Pips
    Accepts either daily range percentage or pips and returns just the pips. The daily range percentage is the percentage of pips that the associated symbol normally moves per day.
    • value: Specify daily range percentage using % sign, e.g. 20%, or will just be treated as pips

  • f.baseIdx: Returns the index of the base currency of the chart symbol within the supplied list of currencies
    • currencies: List of currencies to search

  • f.bodySize: Returns the size of the candle body in pips, i.e. the difference between the open and close prices
    • timeframe: Timeframe of chart, e.g. M15 or H1. If blank then the period set for the trade is used.
    • shift: Shift back relative to current bar/candle, where 0 is the current candle. Default is 0.

  • f.candleAvg: Returns the average candle size in pips, i.e. high minus low, over the supplied number of candles
    • numCandles: Number of candles to average over
    • timeframe: Timeframe of chart, e.g. M15 or H1. If blank then the period set for the trade is used.
    • shift: Shift back relative to current bar/candle of the first candle to include. Default is 1 (most recently closed candle).

  • f.candleMid: Returns the price halfway between the candle's high and low
    • timeframe: Timeframe of chart, e.g. M15 or H1. If blank then the period set for the trade is used.
    • shift: Shift back relative to current bar/candle, where 0 is the current candle. Default is 0.
    • count: Number of candles to take the high/low range from. Default is -1, i.e. just the one candle.

  • f.candlePrctAuto: Price as Percentage of Candle Auto
    Returns where the supplied price is within the candle's high/low range as a percentage. For a buy 0% is the low and 100% the high, and for a sell this is reversed.
    • price: Price to be converted
    • timeframe: Timeframe of chart, e.g. M15 or H1. If blank then the period set for the trade is used.
    • shift: Shift back relative to current bar/candle, where 0 is the current candle. Default is 0.
    • count: Number of candles to take the high/low range from. Default is -1, i.e. just the one candle.

  • f.candlesConsec: Returns the number of consecutive bullish candles, or bearish candles if inverted, going back from the supplied shift
    • timeframe: Timeframe of chart, e.g. M15 or H1. If blank then the period set for the trade is used.
    • shift: Shift back relative to current bar/candle to start counting from. Default is 1 (most recently closed candle).
    • inverted: Set to 1 to count bearish candles instead of bullish

  • f.candleSize: Returns the size of the candle in pips, i.e. the difference between the high and low prices
    • timeframe: Timeframe of chart, e.g. M15 or H1. If blank then the period set for the trade is used.
    • shift: Shift back relative to current bar/candle, where 0 is the current candle. Default is 0.

  • f.candleTime: Returns the time remaining before the current candle closes, in mins:secs format
    • timeframe: Timeframe of chart, e.g. M15 or H1. If blank then the chart period is used.

  • f.char: Returns the character for the supplied character code, e.g. 65 returns A
    • code: Character code

  • f.charCount: Returns the number of times the supplied character appears in the supplied text
    • text: Text to be searched
    • char: Character to count

  • f.counterIdx: Returns the index of the counter currency of the chart symbol within the supplied list of currencies
    • currencies: List of currencies to search

  • f.diffAsPrct: Returns the percentage change from the old value to the new value, e.g. old value 100 and new value 110 returns 10
    • newVal: New value
    • oldVal: Old value
    • digits: Number of decimal places to return. Default is 8.

  • f.engulfPips: If the candle is an engulfing candle in the direction being evaluated, returns the number of pips by which its body is bigger than the previous candle's body, else 0
    • timeframe: Timeframe of chart, e.g. M15 or H1. If blank then the period set for the trade is used.
    • shift: Shift back relative to current bar/candle. Default is 1 (most recently closed candle).

  • f.extractNum: Extracts a number from the supplied text
    • text: Text to extract number from
    • option: Extraction option

  • f.extrapPrice: Returns the price of a chart object, such as a trend line, at the supplied bar/candle, extending the line if necessary
    • name: Object name
    • shift: Shift back relative to current bar/candle, where 0 is the current candle. Default is 0.

  • f.findVar: Returns the name of a MetaTrader global variable whose name contains the supplied text, or blank if none found
    • nameContains: Text the variable name must contain
    • mode: If set to HV then returns the matching variable with the highest value, else the first match found.

  • f.format: Formats the supplied number to the supplied number of decimal places
    • value: Value to be formatted
    • digits: Number of decimal places

  • f.formatDateTime: Formats the supplied timestamp using the supplied format
    • format: Format to use for date/time
    • timestamp: Time in seconds since EPOC

  • f.formatFixed: Formats the supplied number to exactly the supplied number of decimal places
    • value: Value to be formatted
    • digits: Number of decimal places

  • f.formatPrct: Formats the supplied number as a percentage value
    • value: Value to be formatted
    • digits: Number of decimal places. Default is 1.

  • f.formatPrice: Formats the supplied number to the number of decimal places used for the chart symbol's price
    • value: Value to be formatted

  • f.globalGet: Returns the value of a MetaTrader global variable, such as one set with the SET_VAR command
    • name: Variable name. The rwfx marker and symbol will be added to the name.
    • symbol: Symbol of variable, if blank then chart symbol. If set to .. then will use chart symbol concatenated with the chart period, e.g. EURUSDM30.

  • f.iADX: Returns the Average Directional Index (ADX) indicator value
    • timeframe: Timeframe of chart, e.g. M15 or H1. If blank then the period set for the trade is used.
    • shift: Shift back relative to current bar/candle, where 0 is the current candle. Default is 0.
    • period: Averaging period. Default is 14.
    • appliedPrice: Price to base calculation on, e.g. close, open, high. Default is close.
    • mode: Line to return, e.g. main, plusdi or minusdi. Default is main.

  • f.iATR: Returns the Average True Range indicator value, either as a price difference or in pips
    • timeframe: Timeframe of chart, e.g. M15 or H1. If blank then the period set for the trade is used.
    • shift: Shift back relative to current bar/candle, where 0 is the current candle. Default is 0.
    • period: Averaging period. Default is 14.
    • asPips: Set to 1 to return value in pips

  • f.iBarShift: Returns the shift of the bar/candle that contains the supplied time
    • timeframe: Timeframe of chart, e.g. M15 or H1
    • time: Time in seconds since EPOC

  • f.iBodyAuto: Returns the body high price if evaluating for a buy, or the body low price if evaluating for a sell
    • timeframe: Timeframe of chart, e.g. M15 or H1. If blank then the period set for the trade is used.
    • shift: Shift back relative to current bar/candle, where 0 is the current candle. Default is 0.

  • f.iBodyHigh: Returns the high price of the candle body, i.e. the higher of the open and close prices
    • timeframe: Timeframe of chart, e.g. M15 or H1. If blank then the period set for the trade is used.
    • shift: Shift back relative to current bar/candle, where 0 is the current candle. Default is 0.

  • f.iBodyLow: Returns the low price of the candle body, i.e. the lower of the open and close prices
    • timeframe: Timeframe of chart, e.g. M15 or H1. If blank then the period set for the trade is used.
    • shift: Shift back relative to current bar/candle, where 0 is the current candle. Default is 0.

  • f.iCCI: Returns the Commodity Channel Index (CCI) indicator value
    • timeframe: Timeframe of chart, e.g. M15 or H1. If blank then the period set for the trade is used.
    • shift: Shift back relative to current bar/candle, where 0 is the current candle. Default is 0.
    • period: Averaging period. Default is 14.
    • appliedPrice: Price to base calculation on, e.g. close, open, high. Default is close.

  • f.iClose: Returns the close price of the candle
    • timeframe: Timeframe of chart, e.g. M15 or H1. If blank then the period set for the trade is used.
    • shift: Shift back relative to current bar/candle, where 0 is the current candle. Default is 0.

  • f.iCustom: Custom Indicator Value
    Returns the buffer value of a custom indicator. If two buffer indexes are supplied separated by a comma, then the second buffer is returned when the first is empty.
    • indiName: Name of the custom indicator
    • colorIdx: Buffer (color) index to read, or two comma separated indexes
    • inputs: Inputs for the indicator
    • timeframe: Timeframe of chart, e.g. M15 or H1. If blank then the chart period is used.
    • shift: Shift back relative to current bar/candle, where 0 is the current candle. Default is 0.

  • f.iHigh: Returns the high price of the candle
    • timeframe: Timeframe of chart, e.g. M15 or H1. If blank then the period set for the trade is used.
    • shift: Shift back relative to current bar/candle, where 0 is the current candle. Default is 0.

  • f.iHighest: Returns the shift of the candle with the highest high over the supplied number of candles
    • timeframe: Timeframe of chart, e.g. M15 or H1. If blank then the period set for the trade is used.
    • shift: Shift back relative to current bar/candle to start from. Default is 0.
    • count: Number of candles to check. Default is all candles.

  • f.iHighestBearish: Returns the highest high price of the supplied number of bearish candles, ignoring bullish candles
    • timeframe: Timeframe of chart, e.g. M15 or H1. If blank then the period set for the trade is used.
    • shift: Shift back relative to current bar/candle to start from. Default is 0.
    • count: Number of bearish candles to check

  • f.iHighestClose: Returns the highest close price over the supplied number of candles
    • timeframe: Timeframe of chart, e.g. M15 or H1. If blank then the period set for the trade is used.
    • shift: Shift back relative to current bar/candle to start from. Default is 0.
    • count: Number of candles to check. Default is all candles.

  • f.iHighestPrice: Returns the highest high price over the supplied number of candles
    • timeframe: Timeframe of chart, e.g. M15 or H1. If blank then the period set for the trade is used.
    • shift: Shift back relative to current bar/candle to start from. Default is 0.
    • count: Number of candles to check. Default is all candles.

  • f.iLow: Returns the low price of the candle
    • timeframe: Timeframe of chart, e.g. M15 or H1. If blank then the period set for the trade is used.
    • shift: Shift back relative to current bar/candle, where 0 is the current candle. Default is 0.

  • f.iLowest: Returns the shift of the candle with the lowest low over the supplied number of candles
    • timeframe: Timeframe of chart, e.g. M15 or H1. If blank then the period set for the trade is used.
    • shift: Shift back relative to current bar/candle to start from. Default is 0.
    • count: Number of candles to check. Default is all candles.

  • f.iLowestBullish: Returns the lowest low price of the supplied number of bullish candles, ignoring bearish candles
    • timeframe: Timeframe of chart, e.g. M15 or H1. If blank then the period set for the trade is used.
    • shift: Shift back relative to current bar/candle to start from. Default is 0.
    • count: Number of bullish candles to check

  • f.iLowestClose: Returns the lowest close price over the supplied number of candles
    • timeframe: Timeframe of chart, e.g. M15 or H1. If blank then the period set for the trade is used.
    • shift: Shift back relative to current bar/candle to start from. Default is 0.
    • count: Number of candles to check. Default is all candles.

  • f.iLowestPrice: Returns the lowest low price over the supplied number of candles
    • timeframe: Timeframe of chart, e.g. M15 or H1. If blank then the period set for the trade is used.
    • shift: Shift back relative to current bar/candle to start from. Default is 0.
    • count: Number of candles to check. Default is all candles.

  • f.iMA: Moving Average
    Calculates moving average from the runwiseFX built-in chart data. The configuration value chartBars needs to be a least twice the specified period.
    • timeframe: Timeframe of chart to calculate moving average over. Default is -1 (timeframe set in Central Control tab).
    • shift: Shift back relative to current bar/candle, where 0 is the current candle. Default is 0.
    • period: Averaging period for the calculation. Must be no more than half of the value set for the chartBars configuration value.
    • maShift: Moving average shift, i.e. offset of the line. Default is 0.
    • method: Method of calculating, e.g. exponential, plus price to base on, e.g. close, high, etc.
    • appliedPrice: Price to base calculation on, e.g. close, open, high. Default is close.

  • f.iMACD: Returns the Moving Average Convergence/Divergence (MACD) indicator value
    • timeframe: Timeframe of chart, e.g. M15 or H1. If blank then the period set for the trade is used.
    • shift: Shift back relative to current bar/candle, where 0 is the current candle. Default is 0.
    • fastPeriod: Fast EMA period. Default is 12.
    • slowPeriod: Slow EMA period. Default is 26.
    • signalPeriod: Signal line period. Default is 9.
    • appliedPrice: Price to base calculation on, e.g. close, open, high. Default is close.
    • mode: Line to return, either main or signal. Default is main.

  • f.iMom: Returns the Momentum indicator value
    • timeframe: Timeframe of chart, e.g. M15 or H1. If blank then the period set for the trade is used.
    • shift: Shift back relative to current bar/candle, where 0 is the current candle. Default is 0.
    • period: Averaging period. Default is 14.
    • appliedPrice: Price to base calculation on, e.g. close, open, high. Default is close.

  • f.indiDisplay: Returns display text for the supplied configured indicator, made up of its reference ID and current state, e.g. Buy, Sell or disabled
    • indiIdx: Index of configured indicator, from 0 upwards
    • mode: Set to 1 to include indicator inputs, or 2 to include inputs plus mid-point

  • f.indiFN: Returns the file name of the supplied runwiseFX indicator, depending on whether it was purchased directly or from the MetaTrader Market
    • indicator: MT for Market Trending, TS for Trend Strength, or CMS for Currency Map and Strength

  • f.inTradeTime: In Trading Time
    Returns 1 if the current time is within the supplied trading times, else 0. Start or end of a range can be left out to mean start or end of day.
    • times: Trading times in hh:mm-hh:mm format, with multiple ranges separated by ;. If blank then always returns 1, and if ! then always returns 0.

  • f.invert: Will multiply supplied value by -1
    • value: Value to be inverted. Can be floating point number.
    • digits: Number of decimal places to return. If blank then not adjusted.

  • f.invertAuto: Returns the supplied value if evaluating for a buy, or the value multiplied by -1 if evaluating for a sell
    • value: Value to be inverted. Can be floating point number.

  • f.invertAutoInv: Returns the value multiplied by -1 if evaluating for a buy, or the supplied value if evaluating for a sell
    • value: Value to be inverted. Can be floating point number.

  • f.iOpen: Returns the open price of the candle
    • timeframe: Timeframe of chart, e.g. M15 or H1. If blank then the period set for the trade is used.
    • shift: Shift back relative to current bar/candle, where 0 is the current candle. Default is 0.

  • f.iOsMA: Returns the Moving Average of Oscillator (OsMA) indicator value, i.e. the MACD histogram
    • timeframe: Timeframe of chart, e.g. M15 or H1. If blank then the period set for the trade is used.
    • shift: Shift back relative to current bar/candle, where 0 is the current candle. Default is 0.
    • fastPeriod: Fast EMA period. Default is 12.
    • slowPeriod: Slow EMA period. Default is 26.
    • signalPeriod: Signal line period. Default is 9.
    • appliedPrice: Price to base calculation on, e.g. close, open, high. Default is close.

  • f.iRSI: Returns the Relative Strength Index (RSI) indicator value
    • timeframe: Timeframe of chart, e.g. M15 or H1. If blank then the period set for the trade is used.
    • shift: Shift back relative to current bar/candle, where 0 is the current candle. Default is 0.
    • period: Averaging period. Default is 14.
    • appliedPrice: Price to base calculation on, e.g. close, open, high. Default is close.

  • f.iSAR: Returns the Parabolic Stop and Reverse (SAR) indicator price
    • timeframe: Timeframe of chart, e.g. M15 or H1. If blank then the period set for the trade is used.
    • shift: Shift back relative to current bar/candle, where 0 is the current candle. Default is 0.
    • step: Price increment step. Default is 0.02.
    • maximum: Maximum step. Default is 0.2.

  • f.isEven: Returns 1 if the supplied value is an even number, else 0
    • value: Value to be checked

  • f.isPriceInRect: Returns 1 if a rectangle object on the chart contains the supplied price at the supplied bar/candle, else 0
    • price: Price to check
    • shift: Shift of bar/candle the rectangle must cover
    • nameContains: If supplied then rectangle name must contain this text
    • color: If supplied then rectangle must be this color

  • f.iTime: Returns the open time of the candle in seconds since EPOC
    • timeframe: Timeframe of chart, e.g. M15 or H1. If blank then the period set for the trade is used.
    • shift: Shift back relative to current bar/candle, where 0 is the current candle. Default is 0.

  • f.iVol: Returns the tick volume of the candle
    • timeframe: Timeframe of chart, e.g. M15 or H1. If blank then the period set for the trade is used.
    • shift: Shift back relative to current bar/candle, where 0 is the current candle. Default is 0.

  • f.iWPR: Returns the Williams Percent Range indicator value
    • timeframe: Timeframe of chart, e.g. M15 or H1. If blank then the period set for the trade is used.
    • shift: Shift back relative to current bar/candle, where 0 is the current candle. Default is 0.
    • period: Averaging period. Default is 14.

  • f.lastOpenPrice: Returns the open price of the most recently opened trade for the chart symbol, including trades that have since closed
    • scope: MTO or blank for managed trades only, TRADE for trade index being evaluated, or ALL for all trades on the account.

  • f.mathAbs: Returns the absolute value of the supplied number, i.e. without any minus sign
    • value: Value

  • f.mathAdd: Adds two floating point numbers and returns value, i.e. val1 + val2
    • val1: Value 1
    • val2: Value 2

  • f.mathAddInt: Adds two integer values and returns value, i.e. val1 + val2
    • val1: Value 1. 64 bit values are supported, e.g. timestamps.
    • val2: Value 2. 64 bit values are supported, e.g. timestamps.

  • f.mathCeil: Rounds the supplied number up to the nearest integer
    • value: Value

  • f.mathDiv: Divides two floating point numbers and returns value, i.e. val1 / val2
    • val1: Value 1
    • val2: Value 2
    • digits: Number of decimal places to return. If supplied then blank is returned when dividing by zero.

  • f.mathDivFloor: Divides two numbers and rounds the result down to the nearest integer, i.e. floor(val1 / val2)
    • val1: Value 1
    • val2: Value 2

  • f.mathFloor: Rounds the supplied number down to the nearest integer
    • value: Value

  • f.mathInc: Adds 1 to the supplied integer value
    • value: Value

  • f.mathMax: Returns the larger of the two supplied numbers
    • val1: Value 1
    • val2: Value 2

  • f.mathMin: Returns the smaller of the two supplied numbers
    • val1: Value 1
    • val2: Value 2

  • f.mathMod: Returns the remainder after dividing val1 by val2
    • val1: Value 1
    • val2: Value 2

  • f.mathMulti: Multiplies two floating point numbers and returns value, i.e. val1 * val2
    • val1: Value 1
    • val2: Value 2
    • digits: Number of decimal places to return. If blank then not adjusted.

  • f.mathPow: Raises the base to the supplied power, i.e. base ^ exponent
    • base: Base value
    • exponent: Exponent (power) to raise base to

  • f.mathPrct: Returns the supplied percentage of a value, e.g. value 200 and percentage 10 returns 20
    • value: Value
    • prct: Percentage to apply
    • digits: Number of decimal places to return. Default is 8.

  • f.mathRound: Rounds the supplied number to the nearest integer
    • value: Value

  • f.mathSub: Subtracts two floating point numbers and returns value, i.e. val1 - val2
    • val1: Value 1
    • val2: Value 2

  • f.mathSubInt: Subtracts two integer values and returns value, i.e. val1 - val2
    • val1: Value 1. 64 bit values are supported, e.g. timestamps.
    • val2: Value 2. 64 bit values are supported, e.g. timestamps.

  • f.mathToPrct: Returns val1 as a percentage of val2, i.e. (val1 / val2) * 100
    • val1: Value 1
    • val2: Value 2
    • digits: Number of decimal places to return. Default is 8.

  • f.mt4: Returns the first value if running on MetaTrader 4, or the second value if running on MetaTrader 5
    • mt4Val: Value to return if MetaTrader 4
    • mt5Val: Value to return if MetaTrader 5

  • f.mt5: Returns the supplied value if running on MetaTrader 5, else blank
    • value: Value to return if MetaTrader 5

  • f.nearestOpenEntry: Returns the entry price nearest to the current price of trades open on the account for the chart symbol, or blank if none
    • flags: If set to D then only trades in direction being evaluated are checked

  • f.newBar: Returns 1 if a new candle/bar has just formed on the supplied timeframe, else 0
    • timeframe: Timeframe of chart, e.g. M15 or H1

  • f.normaliseNum: Rounds the supplied value down to a multiple of the supplied step, e.g. value 27 with step 5 returns 25
    • value: Value to be normalised
    • step: Step to round down to. If blank or 0 then value returned unchanged.

  • f.normalisePrice: Normalises the supplied price to the chart symbol's tick size
    • price: Price to be normalised

  • f.normaliseTimestamp: Rounds the supplied time down to the start of the candle on the supplied timeframe
    • timeframe: Timeframe of chart, e.g. M15 or H1. If blank then the chart period is used.
    • time: Time to normalise in seconds since EPOC
    • shift: If supplied then uses the open time of the candle at this shift instead of time

  • f.numSelect: Select Non-Zero Number
    Returns the first supplied value that is not zero, or 0 if all are zero. Further values can be supplied as additional parameters.
    • val1: Value 1
    • val2: Value 2

  • f.objCol: Returns the color of the chart object, e.g. clrLime
    • name: Object name

  • f.objLatest: Searches the chart for the most recent object matching the supplied criteria
    • type: Object type, e.g. TREND
    • property: Property of object to match or return
    • timeModifier: Time modifier for search
    • nameContains: Text the object name must contain
    • minTime: Minimum time of object in seconds since EPOC
    • maxTime: Maximum time of object in seconds since EPOC, or if negative then number of bars/candles back.
    • extra: Additional search option

  • f.objLatest2: Searches the chart for the most recent object of the supplied type and color
    • type: Object type, e.g. TREND
    • color: Color object must have
    • timeModifier: Time modifier for search
    • nameContains: Text the object name must contain
    • returnTime: Set to 1 to return the object time instead of the price
    • fillValue: Set to 1 to fill value

  • f.objText: Returns the text (description) of the chart object
    • name: Object name, or part of name if mode is FIND
    • mode: If set to FIND then will search for object whose name contains the supplied name

  • f.objValue: Returns the numeric value of the supplied property of the chart object, e.g. price
    • name: Object name
    • property: Property to return, e.g. OBJPROP_PRICE1
    • modifier: Property modifier, e.g. level number, if required by the property

  • f.periodIdx: Returns the period index for the supplied timeframe, where 0 is the smallest timeframe
    • timeframe: Timeframe, e.g. M15 or H1. If blank then the chart period is used.

  • f.periodIdxStr: Returns the timeframe, e.g. H1, for the supplied period index, or ? if the index is invalid
    • idx: Period index, where 0 is the smallest timeframe

  • f.periodIdxToMins: Returns the number of minutes for the supplied period index, or 0 if the index is invalid
    • idx: Period index, where 0 is the smallest timeframe

  • f.periodOffset: Returns the timeframe that is the supplied number of steps away from the supplied timeframe, e.g. H1 offset by 1 would return H4
    • timeframe: Timeframe, e.g. M15 or H1. If 0 then the chart period is used.
    • offset: Number of timeframe steps to offset by, which can be negative

  • f.pipDiff: Returns the difference between two supplied prices, i.e. price1 - price2, in the form of pips
    • price1: Price 1
    • price2: Price 2

  • f.pipDiffAuto: Pip Difference Auto
    Returns the difference between two supplied prices, i.e. price1 - price2, in the form of pips. Auto means that it will do price2 - price1 if evaluating for a sell.
    • price1: Price 1
    • price2: Price 2

  • f.prctAuto: If the second parameter ends with % then returns that percentage of the first parameter, else returns the second parameter unchanged
    • value: Value to take percentage of
    • prctOrValue: Percentage using % sign, e.g. 20%, or value to return as is

  • f.priceAddPips: Adds the supplied number of pips to the supplied price
    • price: Price to be adjusted
    • pips: Number of pips to be adjusted by

  • f.priceAddPipsAuto: Will add the supplied number of pips from the supplied price if evaluating for a buy, and subtract pips if evaluating for a sell
    • price: Price to be adjusted
    • pips: Number of pips to be adjusted by

  • f.priceSel: Select Nearest Price
    From the supplied prices, returns the one nearest to the current price that is at least the minimum pips away, above for a buy and below for a sell. Returns 0 if none found. Further prices can be supplied as additional parameters.
    • minPips: Minimum pips price must be from current bid price
    • price1: Price 1
    • price2: Price 2

  • f.priceSelInv: Select Nearest Price Inverse
    As priceSel but direction reversed, i.e. selects prices below the current price for a buy and above for a sell. Further prices can be supplied as additional parameters.
    • minPips: Minimum pips price must be from current bid price
    • price1: Price 1
    • price2: Price 2

  • f.priceSubPips: Subtracts the supplied number of pips from the supplied price
    • price: Price to be adjusted
    • pips: Number of pips to be adjusted by

  • f.priceSubPipsAuto: Will subtract the supplied number of pips from the supplied price if evaluating for a buy, and add pips if evaluating for a sell
    • price: Price to be adjusted
    • pips: Number of pips to be adjusted by

  • f.robustStrToInt: Converts the supplied text to an integer, tolerating extra characters
    • text: Text to be converted

  • f.robustStrToNum: Converts the supplied text to a floating point number, tolerating extra characters
    • text: Text to be converted

  • f.scaleX: Scales the supplied horizontal pixel value to allow for the screen resolution/DPI
    • pixels: Number of pixels to be scaled
    • multiplier: If supplied then scaled value is multiplied by this

  • f.scaleY: Scales the supplied vertical pixel value to allow for the screen resolution/DPI
    • pixels: Number of pixels to be scaled
    • multiplier: If supplied then scaled value is multiplied by this

  • f.select: Returns the first value if evaluating for a sell, or the second value if evaluating for a buy
    • sellVal: Value to return for sell
    • buyVal: Value to return for buy

  • f.strDel: Returns the element at the supplied index from text delimited by the | character
    • text: Delimited text
    • idx: Index of element, from 0 upwards

  • f.strDel2: Returns the element at the supplied index from text delimited by the _ character
    • text: Delimited text
    • idx: Index of element, from 0 upwards

  • f.strElement: Returns the element at the supplied index from text delimited by the supplied delimiter
    • text: Delimited text
    • delimiter: Delimiter between elements
    • idx: Index of element, from 0 upwards

  • f.strFind: Returns the position of the supplied search text within the text, from 0 upwards, or -1 if not found
    • text: Text to be searched
    • find: Text to search for
    • start: Position to start search from. Default is 0.

  • f.strFindLast: Returns the position of the last occurrence of the supplied search text within the text, or -1 if not found
    • text: Text to be searched
    • find: Text to search for

  • f.strLower: Converts the supplied text to lowercase
    • text: Text to be converted

  • f.strReplace: Replaces all occurrences of the search text with the replacement text
    • text: Text to be updated
    • find: Text to be replaced
    • replace: Replacement text

  • f.strSelect: Select Non-Blank Text
    Returns the first supplied value that is not blank. Further values can be supplied as additional parameters.
    • val1: Value 1
    • val2: Value 2

  • f.strSub: Returns part of the supplied text, starting at the supplied position
    • text: Text to extract from
    • start: Start position, from 0 upwards
    • length: Number of characters to return. If blank then rest of text.

  • f.strToColor: Converts the supplied color text, e.g. clrBlue or 0,0,255, to its numeric color value
    • color: Color as text

  • f.strToTimestamp: Converts the supplied time of day to a timestamp for today, in seconds since EPOC
    • time: Time in hh:mm:ss format

  • f.strUpper: Converts the supplied text to uppercase
    • text: Text to be converted

  • f.suppRes: Returns pivot point support and resistance prices calculated from the previous candle, in the format R1|R2|R3|S1|S2|S3
    • timeframe: Timeframe of chart, e.g. D1

  • f.swingHH: Swing Higher High
    Returns 1 if the most recent swing high is higher than the previous one, -1 if lower, or 0 if undetermined. Extra details may be appended depending on configuration of Func_extendedOutput.
    • timeframe: Timeframe of chart, e.g. M15 or H1. If blank then the period set for the trade is used.
    • shift: Shift back relative to current bar/candle to start searching from. Default is 1.

  • f.swingHHFunc: As swingHH but compares swing highs in an indicator's values rather than price
    • func: Indicator to use. Currently only rsi is supported.
    • timeframe: Timeframe of chart, e.g. M15 or H1. If blank then the period set for the trade is used.
    • shift: Shift back relative to current bar/candle to start searching from. Default is 1.
    • funcParam1: First parameter for the indicator
    • funcParam2: Second parameter for the indicator

  • f.swingHHLLAuto: Swing Higher High/Lower Low Auto
    For a buy returns 1 if the most recent swing high is higher than the previous one, or -1 if lower. For a sell does the same for swing lows, returning 1 for a lower low. Returns 0 if undetermined.
    • timeframe: Timeframe of chart, e.g. M15 or H1. If blank then the period set for the trade is used.
    • shift: Shift back relative to current bar/candle to start searching from. Default is 1.

  • f.swingHHLLFuncAuto: As swingHHLLAuto but compares swings in an indicator's values rather than price
    • func: Indicator to use. Currently only rsi is supported.
    • timeframe: Timeframe of chart, e.g. M15 or H1. If blank then the period set for the trade is used.
    • shift: Shift back relative to current bar/candle to start searching from. Default is 1.
    • funcParam1: First parameter for the indicator
    • funcParam2: Second parameter for the indicator

  • f.swingLL: Swing Lower Low
    Returns 1 if the most recent swing low is lower than the previous one, -1 if higher, or 0 if undetermined. Extra details may be appended depending on configuration of Func_extendedOutput.
    • timeframe: Timeframe of chart, e.g. M15 or H1. If blank then the period set for the trade is used.
    • shift: Shift back relative to current bar/candle to start searching from. Default is 1.

  • f.swingLLFunc: As swingLL but compares swing lows in an indicator's values rather than price
    • func: Indicator to use. Currently only rsi is supported.
    • timeframe: Timeframe of chart, e.g. M15 or H1. If blank then the period set for the trade is used.
    • shift: Shift back relative to current bar/candle to start searching from. Default is 1.
    • funcParam1: First parameter for the indicator
    • funcParam2: Second parameter for the indicator

  • f.swingShiftAuto: Returns the shift of the most recent swing high if evaluating for a buy, or swing low if evaluating for a sell
    • timeframe: Timeframe of chart, e.g. M15 or H1. If blank then the period set for the trade is used.
    • shift: Shift back relative to current bar/candle to start searching from. Default is 1.

  • f.swingShiftFuncAuto: Swing Shift of Indicator Auto
    As swingShiftAuto but finds swings in an indicator's values rather than price. Returns -1 if unsuccessful.
    • func: Indicator to use. Currently only rsi is supported.
    • timeframe: Timeframe of chart, e.g. M15 or H1. If blank then the period set for the trade is used.
    • shift: Shift back relative to current bar/candle to start searching from. Default is 1.
    • funcParam1: First parameter for the indicator
    • funcParam2: Second parameter for the indicator

  • f.swingSL: Swing Stop Loss Price
    Returns the most recent swing low price if evaluating for a buy, or swing high price if evaluating for a sell. Intended for setting a stop loss price.
    • timeframe: Timeframe of chart, e.g. M15 or H1. If blank then the period set for the trade is used.
    • shift: Shift back relative to current bar/candle to start searching from. Default is 1.

  • f.symbols: Returns a comma separated list of symbols in Market Watch that match the supplied criteria
    • currencies: Currencies symbol must contain, separated by |
    • exclCurrencies: Currencies symbol must not contain, separated by |
    • extension: Text symbol must contain, e.g. broker suffix
    • exclExtension: Text symbol must not contain

  • f.timeSinceNews: Returns the number of seconds since the most recent news event that affects the symbol
    • impacts: Impacts of news interested in. If not supplied then the configured news settings are used.

  • f.timeToNews: Returns the number of seconds until the next news event that affects the symbol
    • impacts: Impacts of news interested in. If not supplied then the configured news settings are used.

  • f.tpAutoSet: Returns 1 if the supplied take profit level is set automatically, else 0
    • level: Take profit level, from 1 upwards

  • f.tpExit: Returns 1 if the supplied take profit level is enabled to exit a percentage of the trade, else 0
    • level: Take profit level, from 1 upwards

  • f.tpExitPrct: Returns the percentage of the trade to exit when the supplied take profit level is reached
    • level: Take profit level, from 1 upwards

  • f.tpPrice: Returns the price of the supplied take profit level
    • level: Take profit level, from 1 upwards

  • f.tpTaken: Returns 1 if the supplied take profit level has been actioned or has no action outstanding, else 0
    • level: Take profit level, from 1 upwards

  • f.tradeIdxOpen: Returns 1 if a trade is open for the supplied trade index, else 0
    • tradeIdx: Trade index to check, from 0 upwards
    • opposite: Set to 1 to check the opposite direction to the one being evaluated

  • f.tradeIdxPeakPips: Returns the peak pips achieved since trade opened for the supplied trade index, or 0 if no trade is open
    • tradeIdx: Trade index to check, from 0 upwards
    • opposite: Set to 1 to check the opposite direction to the one being evaluated

  • f.tradeIdxProfitPips: Returns the profit in pips of the trade for the supplied trade index
    • tradeIdx: Trade index to check, from 0 upwards
    • opposite: Set to 1 to check the opposite direction to the one being evaluated

  • f.tradesNum: Returns number of open trades plus trades since the supplied start time, for the chart symbol and managed magic numbers
    • startTime: Time of day to include trades from, in hh:mm:ss format. Default is start of day.
    • dirOnly: Set to 1 to only include trades in direction being evaluated

  • f.tradesProfit: Returns profit amount of open trades plus trades since the supplied start time, for the chart symbol and managed magic numbers
    • startTime: Time of day to include trades from, in hh:mm:ss format. Default is start of day.
    • dirOnly: Set to 1 to only include trades in direction being evaluated

  • f.tradesProfitPrct: Returns profit of open trades plus trades since the supplied start time, for the chart symbol and managed magic numbers, as a percentage of the account balance
    • startTime: Time of day to include trades from, in hh:mm:ss format. Default is start of day.
    • dirOnly: Set to 1 to only include trades in direction being evaluated

  • f.trendLines: Auto Trend Lines
    Calculates parallel trend lines that encompass all the candles between the two most recent swing highs or swing lows, whichever comes first. Returns timestamp1|timestamp2|lowPrice1|lowPrice2|highPrice1|highPrice2|maxShift, or blank if insufficient data.
    • timeframe: Timeframe of chart, e.g. M15 or H1. If blank then the period set for the trade is used.
    • shift: Shift back to start searching from. Default and minimum is 3, as two candles either side are checked.

  • f.triToDir: Converts -1, 0 or 1 to S, X or B respectively
    • value: Value of -1, 0 or 1

  • f.ts: Trade Select
    Returns the parameter that matches the trade index being evaluated, i.e. first parameter for trade index 0, second for trade index 1, etc. Further values can be supplied as additional parameters.
    • val1: Value for trade index 0
    • val2: Value for trade index 1

  • f.valsAbove: Values Above
    Returns how many of the supplied values are above the first parameter. Further values can be supplied as additional parameters.
    • value: Value to compare against
    • val1: Value 1
    • val2: Value 2

  • f.valsBelow: Values Below
    Returns how many of the supplied values are below the first parameter. Further values can be supplied as additional parameters.
    • value: Value to compare against
    • val1: Value 1
    • val2: Value 2

  • f.wickBottom: Returns the size of the candle's bottom wick in pips
    • timeframe: Timeframe of chart, e.g. M15 or H1. If blank then the period set for the trade is used.
    • shift: Shift back relative to current bar/candle, where 0 is the current candle. Default is 0.

  • f.wickTop: Returns the size of the candle's top wick in pips
    • timeframe: Timeframe of chart, e.g. M15 or H1. If blank then the period set for the trade is used.
    • shift: Shift back relative to current bar/candle, where 0 is the current candle. Default is 0.