Converting MQL4 code to Seerscript

Tagged: 

This topic contains 0 replies, has 1 voice, and was last updated by Seer Seer 6 years, 2 months ago.

Viewing 1 post (of 1 total)
  • Author
    Posts
  • #3957
    Seer
    Seer
    Keymaster

    Here we’ll focus on the key concepts that you’ll need to understand when converting from MQL4 into Seerscript. We will also cover building and backtesting trading systems with Seer. You’ll be introduced to important concepts such as events, columns, barsback and heartbeats. Once you’ve understood these concepts, you’ll find Seer easy to use and more powerful than other environments

    The real world is event driven

    Seer uses event-driven programming model. When you write logic for your trading system you are writing logic and rules that responds to an event.

    But what actually is an Event?

    Traditional programming logic follows it’s own control flow, while event-driven programmes respond to some external action. For example, in a graphical user interface, an event is generated when the user clicks the mouse button or presses a key on the keyboard. It’s the job of the running application to respond to these events.

    Event programming is a better way to model the real world as it simplifies the logic that is needed to respond to actual action in real-time. Trading can be broken down into events such as the close of a bar or the filing of an order.

    The traditional backtesting approach will iterate (loop through) all the bars in the backtesting period. While in an event driven environment an event is generated for each bar in the backtesting period. As your logic is written to respond to an event, rather than in a loop, your trading system is easily deployable in real-time operation as it models the real-world.

    Each event allows you to attach some Seerscript that is executed when the event is triggered. To see a diagram of how the events are triggered, see event execution order in the Seerscript Reference.

    Time Series Data and the Column

    Time series data in the context of trading is the price data of the underlying instrument collected over time. The processing of this time series data enables all technical analysis. Other common terms for describing time series data include vector and array processing.

    The diagram below shows time series data for a stock displayed in a spreadsheet.

    Trading data shown in a spreadsheet

    As you can see in this diagram, each row shows all the price points (Open, High, Low, Close and Volume) for a specific date time. Each column shows a single price point, as it changes over time.

    At first glance it might seem that interacting with a row would be more logical than interacting with a column, but this is not the case. For example, if you wanted to calculate and plot a simple moving average of the Close price point, you would use all the price points of the Close column.

    Within Seer, the Column is used to encompass the whole series of data for a single price point such as Close or Volume. Conceptually, the view presented in a spreadsheet of time series data is a good representation of how Seer handles the data internally. The column headings, DateTime, Open, High, Low, Close and Volume are all Seer columns which you then use with indicators, charts and trading systems. For example, to create an 8 bar simple moving average of the close you would use:

     

    SMA(Close,8);

    And to plot a 8 bar simple moving average of the close you would use:

    PlotColumn(SMA(Close,8),Red);

    In the above Seerscript example we are calling the SMA indicator, and passing the Close column and the number of bars we want the simple moving average to be based upon. The SMA indicator returns a new column with, with all cells populated with the correct values.

    What if you want to access a single value in time series data rather than a whole column? For example, if you wanted to access the data for the close on the 3rd of July, you would use cell D3 in the spreadsheet.

    Before we explain how we do this in Seer, consider one important point. If you add the time series data for the 6th of July to the spreadsheet, would D3 be still the value you want? As all the data would be shifted down by one row, D3 now holds a different value. In reality, D3 may or may not contain the value you want, as it depends on the context of what you want. In Seer, this context is always based upon the latest bar, and all accesses of a column are relative to this bar.

    Events and Columns working together

    The concept of an event and the column working together are integral to how Seer works.

    For example, lets take a simple five bar backtest from the 10th of October to the 14th of October, with 3 simple statements:

    Now(Close);
    Ago(Close,1);
    Ago(Close,2);

    As you can probably guess, Now(Close) returns the value of the close of the current bar, while Ago returns the value of the bar X bars ago. Both Now and Ago work on a relative basis to the last bar.

    showing the extraction of values from columns

     

    In the diagram above, you can see the values change as a new event is generated (the close of each new bar).

    As logic is run in the context of the event, it can be run in a backtesting or live context with equal validity, at any time frame. Although the above logic is running on daily bars, it can be run on weekly bars, 5-minute bars or 89 tick bars by simply changing the time when the events are generated.

    As the bar event can effectively be triggered at any time frame you have to tell what time frame you want Seer to beat at. This setting is called the heartbeat and is set in the trading system object. The heartbeat beats at a set timeframe, such as Day, Hour, TenMinutes or even a time frame that you’ve defined yourself.

    In the above example you’ll also notice that for bar 1, there are two previous bars – the 6th and 7th of October. These bars are included as they are needed by the backtest – specifically by Ago(Close,2). This requirement for including bars before the first event is acted upon is called barsback. In this example, the barsback requirement is 2 bars, with the default being 45 bars. This value is set manually via the Time Frame object that’s associated with the system heartbeat.

    Predefined Functions

    MQL4 Predefined

    Seer Equivalent

    Seer Description

    Ask

    LatestPrice

    LatestPrice
    This function returns the latest price from the real-time data vendor.  This function returns the following information in a list. All values are a snapshot of prices at the time the function was called:
    last price
    last volume
    last datetime
    bid price
    bid volume
    ask price
    ask volume
    Example:
    my ($last,$lastVol,$lastDate,$bid,$bidVol,$ask,$askVol) = LatestPrice;
    Output “$last,$lastVol,$lastDate,$bid,$bidVol,$ask,$askVol”;

    Bars

    NumberOfBars

    NumberOfBars
    This function returns the number of bars for the current symbol. This function is used to iterate though the bars of a column. When iterating, the first item is zero while the last item is NumberOfBars-1.
    This function is typically used when creating your own indicators or charts. It should not be used in the Bar event.
    Examples:
    #Loop round all the “cells” in the column
    for my $bar (0..NumberOfBars-1) {
    #workout the average of the open and close
    $answer=(Value(Open,$bar)+Value(Close,$bar))/2;
    #set the answer for the new column
    SetValue($col,$bar,$answer);
    }

    Bid

    LatestPrice

    See above

    Close[]

    Close

    Close
    This function returns the close column for the current symbol. You can use ClosePrice to return the close of the current bar.
    Examples:
    Output(Ago(Close,10)); # The Close Price 10 bars ago
    Output(Today(EMA(Close,13))); #The 13

    Digits

    DecimalPoints

    DecimalPoints
    This function returns the number of decimal points for the symbol.
    This function can be used in the chart and indicator objects.

    High[]

    High

    High
    This function returns the high column for the current symbol. You can use HighPrice to return the high for the current bar.
    Examples:
    Output(Ago(High,10));
    Output(Today(EMA(High,13)));

    Low[]

    Low

    Low
    This function returns the low column for the current symbol. You can use LowPrice to return the low for the current bar.
    Examples:
    Output(Ago(Low,10));
    Output(Today(EMA(Low,13)));

    Open[]

    Open

    Open
    This function returns the open column for the current symbol. You can use OpenPrice to return the open for the current bar.
    Examples:
    Output(Ago(Open,10)); #The open price 10 bars ago
    Output(Today(EMA(Open,13)));#The value today of the 13 bar ema of the open

    Point

    PipValue

    PipValue()
    PipValue([symbol])
    Usable in an seer event object
    This function returns the value of a single pip for this current symbol. When passed a string, the function will return the value of the pip for that instrument.

    Time[]

    DateTime

    DateTime
    Returns the DateTime column.
    Each value from the date time column is in YYYYMMDDHHMMSS format. For example, 3.45pm on 15th of July 2004 would be 20040715154500. Typically you would convert this value to be more useful, by using any of the following functions Date , Time , Second , Minute , Hour , Month , Year , DayOfWeek , DayOfMonth , DayOfYear and WeekOfYear.
    Examples:
    Now(DateTime); #returns the datetime for the current bar
    Ago(DateTime,15); #returns the datetime for 15 bars ago
    Hour(Ago(DateTime,15)); #returns the hour of the bar 15 bars ago

    Volume[]

    Volume

    Volume
    This function returns the volume column of the current symbol.
    Examples:
    Today(Volume); #The volume today
    Output(Ago(Volume,10)); #The volume 10 bars ago
    Output(Today(EMA(Volume,13)));#value of an ema of the volumn for 13 bars

    Common Functions

    MQL4 Common Functions

    Seer Equivalent

    Seer Description

    Alert(…)

    Warning

    Warning ([string])
    Usable in an seer event object
    This function outputs a warning that is displayed in the output tab. This function has a similar use to Output. The symbol, bar and date will be shown with the string passed in.
    Examples:
    Warning(‘Equity less than 5000′);

    Comment(…)

    Output(…)

    Output ([string])
    Usable in an seer event object, Usable in an seer indicator object, Usable in an seer chart object
    This function is used to output information from your account, chart or indicator. This function is typically used for the debugging.
    If this function is called within an event, data is displayed in the output tab with the symbol, bar and date.
    Examples:
    Output(‘Some text’);
    Output((55-43));

    MarketInfo(string symbol, int type)

    In process of being built in Seer

    MessageBox(string text=NULL, string caption=NULL, int flags=EMPTY)

    Warning

    Warning ([string])
    Usable in an seer event object
    This function outputs a warning that is displayed in the output tab. This function has a similar use to Output. The symbol, bar and date will be shown with the string passed in.
    Examples:
    Warning(‘Equity less than 5000′);

    PlaySound(string filename)

    PlaySound([path to sound file])

    PlaySound([path to wav file])
    Usable in an seer event object
    This function plays a .wav sound file.
    During backtesting this function will output the path.
    During live (connected to a brokerage account and real-time datafeed)Â this function will play the sound.
    This function is not available under Linux.

    Print(…)

    Output(…)

    Output ([string])
    Usable in an seer event object, Usable in an seer indicator object, Usable in an seer chart object
    This function is used to output information from your account, chart or indicator. This function is typically used for the debugging.
    If this function is called within an event, data is displayed in the output tab with the symbol, bar and date.
    Examples:
    Output(‘Some text’);
    Output((55-43));

    SendFTP(string filename, string ftp_path=NULL)

    library function

    SendMail(string subject, string some_text)

    SendEmail(to, subject, message)

    SendEmail(to,subject,message)
    Usable in an seer event object
    This function sends an email message.
    During backtesting this function just outputs the subject which can then be displayed in the output tab.
    When an account is live this function will send an actual email. This function is asynchronous and will return straight away. You will need to configure the SMTP server that Seer will connect to (see preferences).

    SendNotification(string message)

    N/A

     See other functions such as Output and Warning

    Sleep(int milliseconds)

    sleep

    Day()

    DayOfMonth

    DayOfMonth ([Optional Datetime])
    Usable in an seer event object, Usable in an seer indicator object, Usable in an seer chart object
    This function returns the number representing the day of the month for the current bar, or from the passed in datetime.
    Examples:
    DayOfMonth; #returns the day of the month for the current bar
    DayOfMonth(Ago(DateTime,15)); #returns the day of the month for the bar 15 bars ago
    Because this function has an optional parameter, it is sometimes necessary to specify the parenthesis on the function when passing no parameters, for example use DayOfMonth() instead of DayOfMonth.

    DayOfWeek()

    DayOfWeek

    DayOfWeek
    DayOfWeek([DateTime])
    Usable in an seer event object, Usable in an seer indicator object, Usable in an seer chart object
    This function returns the number representing the day of the week for the current bar, or from the passed in datetime. The returned number is between 1 (Monday) and 7 (Sunday).
    Examples:
    DayOfWeek; #returns the day of the week for the current bar
    DayOfWeek (Ago(DateTime,15)); #returns the day of the week for the bar 15 bars ago
    Note:    Because this function has an optional parameter, it is sometimes necessary to specify the parenthesis on the function when passing no parameters, for example use DayOfWeek() instead of DayOfWeek.

    DayOfYear()

    DayOfYear

    DayOfYear ([Optional Datetime])
    Usable in an seer event object, Usable in an seer indicator object, Usable in an seer chart object
    This function returns the number representing the day of the year for the current bar, or from the passed in datetime.
    Examples:
    DayOfYear; #returns the day of the year for the current bar
    DayOfYear(Ago(DateTime,15)); #returns the day of the year for the bar 15 bars ago
    Note:    Because this function has an optional parameter, it is sometimes necessary to specify the parenthesis on the function when passing no parameters, for example use DayOfYear() instead of DayOfYear.

    Hour()

    Hour

    Hour([Optional Datetime])
    Usable in an seer event object, Usable in an seer indicator object, Usable in an seer chart object
    This function returns the number of hours of the current bar, or from the passed in datetime. The returned number is in 24 hour clock.
    This function can be used in chart and indicator objects.
    Examples:
    Hour; #returns the hour of the current bar
    Hour(Ago(DateTime,15)); #returns hour of the bar 15 bars ago
    Note:    Because this function has an optional parameter, it is sometimes necessary to specify the parenthesis on the function when passing no parameters, for example use Hour() instead of Hour.

    Minute() Returns the current minute (0,1,2,..59) of the last known server time by the moment of the program start (this value will not change within the time of the program execution).

    Minute

    Minute([Optional Datetime])
    Usable in an seer event object
    This function returns the number of minutes of the current bar, or from the passed in datetime.
    This function can be used in chart and indicator objects.
    Examples:
    Minute; #returns the minute of the current bar
    Minute(Ago(DateTime,15)); #returns minute of the bar 15 bars ago
    Note:     Because this function has an optional parameter, it is sometimes necessary to specify the parenthesis on the function when passing no parameters, for example use Minute() instead of Minute.

    Month()

    Month

    Month([Optional Datetime])
    Usable in an seer event object, Usable in an seer indicator object, Usable in an seer chart object
    This function returns the month number of the current bar, or from the passed in datetime.
    Examples:
    Month; #returns the month of the current bar
    Month(Ago(DateTime,15)); #returns month of the bar 15 bars ago
    Note:    Because this function has an optional parameter, it is sometimes necessary to specify the parenthesis on the function when passing no parameters, for example use Month() instead of Month.

    Seconds()

    Second

    Second([Optional Datetime])
    Usable in an seer event object, Usable in an seer indicator object, Usable in an seer chart object
    This function returns the number of seconds of the current bar, or from the passed in datetime.
    This function can be used in chart and indicator objects.
    Examples:
    Second; #returns the seconds of the current bar
    Second(Ago(DateTime,15)); #returns seconds of the bar 15 bars ago
    Note:    Because this function has an optional parameter, it is sometimes necessary to specify the parenthesis on the function when passing no parameters, for example use Second() instead of Second.

    TimeCurrent()

    DateTime

    Second([Optional Datetime])
    Usable in an seer event object, Usable in an seer indicator object, Usable in an seer chart object
    This function returns the number of seconds of the current bar, or from the passed in datetime.
    This function can be used in chart and indicator objects.
    Examples:
    Second; #returns the seconds of the current bar
    Second(Ago(DateTime,15)); #returns seconds of the bar 15 bars ago
    Note:      Because this function has an optional parameter, it is sometimes necessary to specify the parenthesis on the function when passing no parameters, for example use Second() instead of Second.

    TimeDay(datetime date)

    DayOfMonth

    DayOfMonth ([Optional Datetime])
    Usable in an seer event object, Usable in an seer indicator object, Usable in an seer chart object
    This function returns the number representing the day of the month for the current bar, or from the passed in datetime.
    Examples:
    DayOfMonth; #returns the day of the month for the current bar
    DayOfMonth(Ago(DateTime,15)); #returns the day of the month for the bar 15 bars ago
    Note:   Because this function has an optional parameter, it is sometimes necessary to specify the parenthesis on the function when passing no parameters, for example use DayOfMonth() instead of DayOfMonth.

    TimeDayOfWeek(datetime date)

    DayOfWeek

    DayOfWeek
    DayOfWeek([DateTime])
    Usable in an seer event object, Usable in an seer indicator object, Usable in an seer chart object
    This function returns the number representing the day of the week for the current bar, or from the passed in datetime. The returned number is between 1 (Monday) and 7 (Sunday).
    Examples:
    DayOfWeek; #returns the day of the week for the current bar
    DayOfWeek (Ago(DateTime,15)); #returns the day of the week for the bar 15 bars ago
    Note:     Because this function has an optional parameter, it is sometimes necessary to specify the parenthesis on the function when passing no parameters, for example use DayOfWeek() instead of DayOfWeek.

    TimeDayOfYear(datetime date)

    DayOfYear

    DayOfYear ([Optional Datetime])
    Usable in an seer event object, Usable in an seer indicator object, Usable in an seer chart object
    This function returns the number representing the day of the year for the current bar, or from the passed in datetime.
    Examples:
    DayOfYear; #returns the day of the year for the current bar
    DayOfYear(Ago(DateTime,15)); #returns the day of the year for the bar 15 bars ago
    Note:    Because this function has an optional parameter, it is sometimes necessary to specify the parenthesis on the function when passing no parameters, for example use DayOfYear() instead of DayOfYear.

    TimeHour(datetime time)

    Hour

    Hour([Optional Datetime])
    Usable in an seer event object, Usable in an seer indicator object, Usable in an seer chart object
    This function returns the number of hours of the current bar, or from the passed in datetime. The returned number is in 24 hour clock.
    This function can be used in chart and indicator objects.
    Examples:
    Hour; #returns the hour of the current bar
    Hour(Ago(DateTime,15)); #returns hour of the bar 15 bars ago
    Note:    Because this function has an optional parameter, it is sometimes necessary to specify the parenthesis on the function when passing no parameters, for example use Hour() instead of Hour.

    TimeLocal()

    localtime

    TimeMinute(datetime time)

    Minute

    Minute([Optional Datetime])
    Usable in an seer event object
    This function returns the number of minutes of the current bar, or from the passed in datetime.
    This function can be used in chart and indicator objects.
    Examples:
    Minute; #returns the minute of the current bar
    Minute(Ago(DateTime,15)); #returns minute of the bar 15 bars ago
    Note:     Because this function has an optional parameter, it is sometimes necessary to specify the parenthesis on the function when passing no parameters, for example use Minute() instead of Minute.

    TimeMonth(datetime time)

    Month

    Month([Optional Datetime])
    Usable in an seer event object, Usable in an seer indicator object, Usable in an seer chart object
    This function returns the month number of the current bar, or from the passed in datetime.
    Examples:
    Month; #returns the month of the current bar
    Month(Ago(DateTime,15)); #returns month of the bar 15 bars ago
    Note:    Because this function has an optional parameter, it is sometimes necessary to specify the parenthesis on the function when passing no parameters, for example use Month() instead of Month.

    TimeSeconds(datetime time)

    Second

    Second([Optional Datetime])
    Usable in an seer event object, Usable in an seer indicator object, Usable in an seer chart object
    This function returns the number of seconds of the current bar, or from the passed in datetime.
    This function can be used in chart and indicator objects.
    Examples:
    Second; #returns the seconds of the current bar
    Second(Ago(DateTime,15)); #returns seconds of the bar 15 bars ago
    Note:    Because this function has an optional parameter, it is sometimes necessary to specify the parenthesis on the function when passing no parameters, for example use Second() instead of Second.

    TimeYear(datetime time)

    Year

    Year([Optional Datetime])
    Usable in an seer event object
    This function returns the year of the current bar, or from the passed in datetime. The returned number is 4 digits, for example 1992, 2004.
    This function can be used in chart and indicator objects.
    Examples:
    Year; #returns the year of the current bar
    Year(Ago(DateTime,15)); #returns year of the bar 15 bars ago
    Note:    Because this function has an optional parameter, it is sometimes necessary to specify the parenthesis on the function when passing no parameters, for example use Year() instead of Year.

    Year()

    Year

    Year([Optional Datetime])
    Usable in an seer event object
    This function returns the year of the current bar, or from the passed in datetime. The returned number is 4 digits, for example 1992, 2004.
    This function can be used in chart and indicator objects.
    Examples:
    Year; #returns the year of the current bar
    Year(Ago(DateTime,15)); #returns year of the bar 15 bars ago
    Note:    Because this function has an optional parameter, it is sometimes necessary to specify the parenthesis on the function when passing no parameters, for example use Year() instead of Year.

     Technical Analysis Indicators

    MQL4 Technical Indicators

    Seer Equivalent

    Seer Description

    iADX(string symbol, int timeframe, int period, int applied_price, int mode, int shift)

    ADX

    ADX ([period])
    Examples:
    Today(ADX(14)); #scalar context – returns the value of the 14 bar ADX line
    my ($adx,$plus,$minus)=ADX(22);#list context – returns the columns ADX line, DI+ and DI-

    iATR(string symbol, int timeframe, int period, int shift)

    ATR

    ATR ([period])
    Usable in an seer event object, Usable in an seer indicator object, Usable in an seer chart object
    Average True Range (Welles Wilder Version), returns the ATR column.
    Examples:
    my $atr=ATR(13);
    Today(ATR(50));

    iBands(string symbol, int timeframe, int period, int deviation, int bands_shift, int applied_price, int mode, int shift)

    BB

    BB ([Period], [Deviation])
    Usable in an seer event object, Usable in an seer indicator object, Usable in an seer chart object
    Bollinger Bands. Returns the upper band in scalar context and in list context returns the upper and lower bands.
    Examples:
    my ($upper,$lower)=BB(20,2); #list context
    Today(BB(20,3)); #scalar context

    iCCI(string symbol, int timeframe, int period, int applied_price, int shift)

    CCI

    CCI ([Period])
    Usable in an seer event object, Usable in an seer indicator object, Usable in an seer chart object
    Commodity Channel Index created by Donald Lambert. Returns the CCI column.
    Examples:
    my $cci=CCI(14);
    Today(CCI(20));

    iEnvelopes(string symbol, int timeframe, int ma_period, int ma_method, int ma_shift, int applied_price, double deviation, int mode, int shift)

    Now(Enverlope(…))

    Envelope ([Column], [Period], [Percent], [MA])
    Usable in an seer event object, Usable in an seer indicator object, Usable in an seer chart object
    Creates two envelopes around the column. The parameter MA is optional (the moving average used in the calculation), defaults to EMA, and can be any moving average (EMA, SMA, WWS). The parameter Percent is the percentage of the bands above and below the passed in column. In scalar context returns the upper column, in list context returns the upper and lower columns.
    Examples:
    my ($upper,$lower)=Envelope(Close,25,5);
    #Returns the upper and lower columns of an envelope around
    #the close column for 25 bars, with a 5% shift
    Today(Envelope(Open,13,10,’WWS’));
    #Returns the value for todays upper column of an envelope around
    #the open column for 13 bars, with a 10% shift, using the WWS moving average.

    iMomentum(string symbol, int timeframe, int period, int applied_price, int shift)

    Momentum

    Momentum ([Column], [Period])
    Usable in an seer event object, Usable in an seer indicator object, Usable in an seer chart object
    Similar to ROC. Returns the Momentum column.
    Examples:
    my $closemom=Momentum (Close,20);
    my $volmom=Momentum (Volume,45);
    Now(Momentum(Volume,45));

    iMFI(string symbol, int timeframe, int period, int shift)

    MoneyFlow

    MoneyFlow([Period])
    Usable in an seer event object, Usable in an seer indicator object, Usable in an seer chart object
    Chaikin Money Flow.
    Example:
    Now(MoneyFlow(21)); #Returns the 21 bar Money Flow for the current bar.

    iMA(string symbol, int timeframe, int period, int ma_shift, int ma_method, int applied_price, int shift)

    SMA, EMA

    SMA ([column], [period])
    Usable in an seer event object, Usable in an seer indicator object, Usable in an seer chart object
    Simple Moving Average, returns the simple average of the passed in column and period.
    Examples:
    my $sma=SMA(Open,15);
    Today(SMA(RSI(14),12));

    EMA ([column], [period])
    Usable in an seer event object, Usable in an seer indicator object, Usable in an seer chart object
    Exponential Moving Average returns the EMA column.
    Examples:
    #Returns a column of the 13 bar ema of the close
    my $ema=EMA(Close,13);
    #Returns the value of today’s 13 bar ema of the true range
    Today(EMA(TrueRange,13));
    #Returns the value of 5 bars ago of the 13 bar ema of the 14 bar RSI
    Ago(EMA(RSI(14),13),5);

    iMACD(string symbol, int timeframe, int fast_ema_period, int slow_ema_period, int signal_period, int applied_price, int mode, int shift)

    MACD

    MACD ([period], [period], [period])
    Usable in an seer event object, Usable in an seer indicator object, Usable in an seer chart object
    The MACD – Moving Average Convergence/Divergence is an indicator developed by Gerald Appel. The MACD uses three moving averages in it’s construction (EMA). The fast line (the MACD line) is the difference between two EMA of the closing prices. The slow line (sometimes called the signal line) is a EMA of the MACD line. The defaults for this indictor are 12,26 and 9.   In scalar context returns the histogram, in list context returns the columns MACD line, MACD signal and the MACD histogram.
    Examples:
    my $macd=MACD(12,26,9); #$macd contains the histogram column
    Today(MACD(12,26,9));   #returns the value of today’s histogram
    my ($line,$signal)=MACD(12,26,9);
    my ($line,$signal,$hist)=MACD(12,26,9);

    iOBV(string symbol, int timeframe, int applied_price, int shift)

    OBV

    OBV
    Usable in an seer event object, Usable in an seer indicator object, Usable in an seer chart object
    On Balance Volume, returns the OBV column.
    Examples:
    my $obv=OBV;
    Today(OBV);

    iRSI(string symbol, int timeframe, int period, int applied_price, int shift)

    Now(RSI(…))

    RSI ([period])
    Usable in an seer event object, Usable in an seer indicator object, Usable in an seer chart object
    Welles Wilder’s Relative Strength Index (RSI) is a popular oscillator that ranges between zero and 100. Reading’s above 70 indicate the stock is overbought, while readings below 30 indicate the stock is oversold. Popular values for the RSI include 9 and 25 with the default being 14.
    Example:
    my $rsi=RSI(14);
    Today(RSI(4));

    iStdDev(string symbol, int timeframe, int ma_period, int ma_shift, int ma_method, int applied_price, int shift)

    StaDev(…)

     StaDev ([column], [period])
    Usable in an seer event object, Usable in an seer indicator object, Usable in an seer chart object
    Standard Deviation is a statistical calculation and can be applied to any column. Returns the standard deviation of the column.
    Examples:
    my $st=StaDev(Close,13); #returns a column of the stadev of the close of 13 bars
    Today(StaDev(EMA(RSI(14),13),22));
    #returns the value of the 22 bar standard deviation, of a 13 bar ema, of the 14 bar RSI

    iStochastic(string symbol, int timeframe, int %Kperiod, int %Dperiod, int slowing, int method, int price_field, int mode, int shift)

    Now(SS(…))

    SS ([period], [period], [period], [MA] )
    Usable in an seer event object, Usable in an seer indicator object, Usable in an seer chart object
    Stochastic is an Oscillator popularised by George Lane. This indicator produces two lines, the %D and the %K. The %K line is a moving average of the %D line.
    The Stochastic Oscillator has 3 main input variables:
    %K periods – the number of bars used in the calculation
    %K Slowing Periods – used to define the initial smoothing of the %K line. A value of 1 is a fast Stochastic, while a value of 3 is a slow Stochastic
    %D periods – the number of bars used when performing the smoothing of the %K line
    The parameter MA is optional and can be one of the following moving averages, SMA, EMA or WWS. This is passed to the indicator as a string. If no moving average is passed to the indicator, a SMA will be used.
    Popular values for this indicator are 5,3,3. Returns the %K line in scalar context. In list context returns %K line and %D line.
    Examples:
    #returns the %K and %D lines into the $k and $d variables
    my ($k,$d)=SS(5,3,3);
    #returns the %K and %D lines into the $k and $d variables, using
    #an EMA moving average in the Stochastic calculation
    my ($k,$d)=SS(5,3,3,’EMA’);

    Time Series Access

    MQL4 Time Series

    Seer Equivalent

    Seer Description

    iClose(string symbol, int timeframe, int shift)

    Now(Close)

    iHigh(string symbol, int timeframe, int shift)

    High

    High
    This function returns the high column for the current symbol. You can use HighPrice to return the high for the current bar.
    Examples:
    Output(Ago(High,10));
    Output(Today(EMA(High,13)));

    iHighest(string symbol, int timeframe, int type, int count=WHOLE_ARRAY, int start=0)

    Now(Highest(…))

    Highest ([column], [period])
    Usable in an seer event object, Usable in an seer indicator object, Usable in an seer chart object
    The highest value within the period for the column. Returns the Highest column.
    Examples:
    my $highesthigh = Highest(High,12); #returns the column for the highest high for 12 bars
    Today(Highest(Close,2)); #returns the value for the highest close for the last 2 bars

    iLow(string symbol, int timeframe, int shift)

    Low

    Low
    Usable in an seer event object, Usable in an seer indicator object, Usable in an seer chart object
    This function returns the low column for the current symbol. You can use LowPrice to return the low for the current bar.
    Examples:
    Output(Ago(Low,10));
    Output(Today(EMA(Low,13)));

    iLowest(string symbol, int timeframe, int type, int count=WHOLE_ARRAY, int start=0)

    Now(Lowest(…))

    Lowest ([column], [period])
    Usable in an seer event object, Usable in an seer indicator object, Usable in an seer chart object
    The lowest value within the period for the column. Returns the Lowest column.
    Examples:
    my $lowestlow = Lowest(Low,12); #returns the column for the lowest low of 12 bars
    Today(Lowest(EMA(Close,5),5));
    #returns the value for the lowest low of 5 bars for an ema
    #of the close for 5 bars

    iOpen(string symbol, int timeframe, int shift)

    Now(Open)

    Open
    Usable in an seer event object, Usable in an seer indicator object, Usable in an seer chart object
    This function returns the open column for the current symbol. You can use OpenPrice to return the open for the current bar.
    Examples:
    Output(Ago(Open,10)); #The open price 10 bars ago
    Output(Today(EMA(Open,13)));#The value today of the 13 bar ema of the open

    iTime(string symbol, int timeframe, int shift)

    DateTime

    DateTime
    Usable in an seer event object, Usable in an seer indicator object, Usable in an seer chart object
    Returns the DateTime column. Each value from the date time column is in YYYYMMDDHHMMSS format. For example, 3.45pm on 15th of July 2004 would be 20040715154500. Typically you would convert this value to be more useful, by using any of the following functions Date , Time , Second , Minute , Hour , Month , Year , DayOfWeek , DayOfMonth , DayOfYear and WeekOfYear.
    Examples:
    Now(DateTime); #returns the datetime for the current bar
    Ago(DateTime,15); #returns the datetime for 15 bars ago
    Hour(Ago(DateTime,15)); #returns the hour of the bar 15 bars ago

    iVolume(string symbol, int timeframe, int shift)

    Volume

    Volume
    Usable in an seer event object, Usable in an seer indicator object, Usable in an seer chart object
    This function returns the volume column of the current symbol.
    Examples:
    Today(Volume); #The volume today
    Output(Ago(Volume,10)); #The volume 10 bars ago
    Output(Today(EMA(Volume,13)));#value of an ema of the volumn for 13 bars

    Trading Functions

    MQL4 Trading Functions

    Seer Equivalent

    Seer Description

    OrderClose(int ticket, double lots, double price, int slippage, color Color=CLR_NONE)

    method call ->Cancel

    OrderCloseBy(int ticket, int opposite, color Color=CLR_NONE)

    method call ->Cancel

    OrderClosePrice()

    method call ->StopPrice or ->LimitPrice depending the direction of the position (long/short)

    OrderClosePrice()

    method call ->StopPrice or ->LimitPrice depending the direction of the position (long/short)

    OrderComment()

    In process of being built in Seer

    OrderCommission()

    In process of being built in Seer

    OrderDelete(int ticket, color Color=CLR_NONE)

    method call ->Cancel

    OrderExpiration()

    In process of being built in Seer

    OrderLots()

    Method call ->quantity

    OrderMagicNumber()

    In process of being built in Seer

    OrderModify(int ticket, double price, double stoploss, double takeprofit, datetime expiration, color arrow_color=CLR_NONE)

    Method call ->change

     However, seer can’t change the expiration datetime

    OrderOpenPrice()

    In process of being built in Seer

    OrderOpenTime()

    In process of being built in Seer

     OrderPrint()

    Output $orderobject

     Outputting the order object will print basic details of the order.

    OrderProfit()

    OpenProfit

    OpenProfit
    Usable in an seer event object
    This function returns the open profit for the current symbol or undef if no position.

    OrderSelect(int index, int select, int pool=MODE_TRADES)

    Orders

     Orders are objects in Seer so no need to ‘select’ an order to operate on it.

    OrderSend(string symbol, int cmd, double volume, double price, int slippage, double stoploss, double takeprofit, string comment=NULL, int magic=0, datetime expiration=0, color arrow_color=CLR_NONE)

    BuyOpen, BuyMarket, SellOpen, SellMarket, SellStop, BuyStop, BuyLimit, SellLimit, BuyStopLimit, SellStopLimit, StopLoss, PlaceBuyOpen, PlaceSellOpen, PlaceBuyStop, PlaceSellStop, PlaceBuyLimit, PlaceSellLimit, PlaceBuyStopLimit, PlaceSellStopLimit, PlaceStopLoss, NextBarOpen, PlaceSellMarketClose, PlaceBuyMarketClose, PlaceBuyAtPrice, PlaceSellAtPrice, OnFill, PlaceSellMarket, PlaceBuyMarket, PlaceOrder

    OrdersHistoryTotal()

    TradeHistory

    Tradehistory([number])
    Usable in an seer event object
    Returns a list of all trades in the current system. If a number is passed in, returns a list of the last X trades.

    OrderStopLoss()

    method call ->StopPrice

    OrdersTotal()

    Orders

    Orders
    Usable in an seer event object
    Returns a list of all the Orders for the current symbol.

    OrderSwap()

    In process of being built in Seer

    OrderSymbol()

    method call->Symbol

    OrderTakeProfit()

    method call ->StopPrice or ->LimitPrice depending the direction of the position (long/short)

    OrderTicket()

    In process of being built in Seer

    OrderType()

    method call ->OrderTypeID

Viewing 1 post (of 1 total)

You must be logged in to reply to this topic.