Announcement

Collapse
No announcement yet.

DDE Export of study values

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

  • DDE Export of study values

    I would like to export real-time values of 2 moving averages into Excel from a 3 minute T-bond chart. I've attached the EFS file I am using. In Excel, I type in =eSignal|EFS!5MAZB_H5
    Nothing happens, I get an error message for the formula. What am I doing wrong? I have the formula script running on the chart.
    Attached Files

  • #2
    Hello jebersole,

    There were just a couple things that needed to be changed. The error in excel was generated because you can't start the name of a dde link field with a number. The other thing you need to do is correct the return statement in main(). When returning a single value, you can just do return myValue;. When you are returning multiple values you need to return an array, return new Array(myValue1, myValue2, etc..);. I made a few other minor changes, but these two are the one that really mattered. Try the code below and let me know if you have any questions.

    PHP Code:
    var study1 = new MAStudy(50"Close"MAStudy.SIMPLE);
    var 
    study2 = new MAStudy(130"Close"MAStudy.EXPONENTIAL);

    var 
    dde1 null;  //new DDEOutput("5MA" + getSymbol());
    var dde2 null;  //new DDEOutput("13MA" + getSymbol());

    function preMain() {
        
    setPriceStudy(true);
        
    setCursorLabelName("5MA",0);
        
    setCursorLabelName("13MA",1);
    }

    var 
    bEdit true;
     
    function 
    main() {
    if (
    bEdit == true) {
            var 
    sym getSymbol();
            
    sym sym.replace(" #F""");
            
    sym sym.replace(" ""_");
            
    debugPrintln("Example DDE link: '=eSignal|EFS!MA5_" sym);
            
    debugPrintln("Example DDE link: '=eSignal|EFS!MA13_" sym);
            
    dde1 = new DDEOutput("MA5_" sym);
            
    dde2 = new DDEOutput("MA13_" sym);
            
            
    bEdit false;
        }
        var 
    vRet1 study1.getValue(MAStudy.MA);
        var 
    vRet2 study2.getValue(MAStudy.MA);
        if(
    vRet1 != nulldde1.set(vRet1);
        if(
    vRet2 != nulldde2.set(vRet2);
        return new Array(
    vRet1,vRet2);

    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
      Thanks Jason. It works!

      Comment

      Working...
      X