Announcement

Collapse
No announcement yet.

Spreads on OHLC

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Spreads on OHLC

    Hello

    Is it possible to make a spread based on the same symbol? Looking for this information I have looked in the knowledgbase and even the forums on spreads but none seem to talk about the same stock and spreads of that stock. Doing stock to stock spreads is easy but I have not found a way to do this below.

    e.g. any stock lets take IBM today.

    1. Can I make a spread based on Ibm (opening price) - (previous close=Yesterdays 4.00pm closing price) ???

    2. Can I make a spread based on IBM opening price versus IBM yesterdays High or Low.

    Basically I would like to make spreads based on DAILY OHLC of the same symbol. How do I make the spread to reference the (O) or the (H) or the (L) or the (C)?

    Is this possible? and if it is can you give an example please.

    Thanks in Advance.

    Pogman

  • #2
    Hello Pogman,

    This can be accomplished using EFS. To reference the price series for any symbol, see open(), high(), low(), close() Series functions. By default these series refer to the symbol and interval of the chart in which the formula is running. However, you can specify an external interval or symbol with the use of the sym() or inv() functions. Here are some basic examples.

    1) If the chart symbol is set to IBM try the following.
    PHP Code:
    function main() {
    //Ibm (opening price) - (previous close=Yesterdays 4.00pm closing price) 
        
    var myValue open(0inv("D")) - close(-1inv("D"));
        if (
    myValue == null || isNaN(myValue) == true) return;

        return 
    myValue;

    If the chart symbol is different than IBM, you can specify the symbol and interval using the sym() function.
    PHP Code:
    function main() {
        var 
    myValue open(0sym("IBM,D")) - close(-1sym("IBM,D"));
        if (
    myValue == null || isNaN(myValue) == true) return;

        return 
    myValue;

    2. Yes, just use the high() or low() series in place of the close() series like in the examples above.

    Also see the sym/inv parameter and the related code examples in the EFS KB articles for these functions at the link above. To learn more specifics about programming in EFS please see the resources listed below my signature.
    Jason K.
    Project Manager
    eSignal - an Interactive Data company

    EFS KnowledgeBase
    JavaScript for EFS Video Series
    EFS Beginner Tutorial Series
    EFS Glossary
    Custom EFS Development Policy

    New User Orientation

    Comment


    • #3
      HI Jason

      thanks for the reply. Your idea did work. However, I was trying to show a spread in a quote window. Your links though led to other efs ideas and I am working on those. thanks for the tips and if I have any issues I will ask for assisstance.

      Take care have a great night.

      Pogman

      Comment

      Working...
      X