Announcement

Collapse
No announcement yet.

Moving Average from eSignal into Excel

Collapse
This topic is closed.
X
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • #31
    Sort of adding on to this here. The below was an immense help to DDE use with the forex symbols. Would it be possible to get an efficient format for DDE returning more than one variable in a single EFS document while still using the below naming system?

    For Example, Returning Entry Date, Entry price, Stop Price, and ATR value from a strategy?

    Many thanks,

    Tim

    Posting an Example here - Need to Avoid getting Excelt to return [object series] from the ddelink - attaching the pertinent areas of the code

    PHP Code:
    function preMain(){
    setPriceStudy(true);
    }

    //lines 6-29 Omitted (declaring global vars

    var ddeATR  null;
    var 
    ddeEND  null;
    var 
    ddeENP  null;
    var 
    ddeSTP  null;
    var 
    ddeDIR  null;



    function 
    main() {

    if (
    ddeATR == null) {
    var 
    sName "ATR" getSymbol() +"_"getInterval();
    sName sName.replace("$"""); // remove $ from string
    sName sName.replace("#"""); // remove # from string
    sName sName.replace("-"""); // remove # from string
    sName sName.replace(" ""_"// replace space with underscore
    debugPrintln("DDE Link for Excel =eSignal|EFS!"+sName);
    ddeATR = new DDEOutput(sName);
    }
    if (
    ddeEND == null) {
    var 
    sName "END" getSymbol() +"_"getInterval();
    sName sName.replace("$"""); // remove $ from string
    sName sName.replace("#"""); // remove # from string
    sName sName.replace("-"""); // remove # from string
    sName sName.replace(" ""_"// replace space with underscore
    debugPrintln("DDE Link for Excel =eSignal|EFS!"+sName);
    ddeEND = new DDEOutput(sName);
    }
    if (
    ddeENP == null) {
    var 
    sName "ENP" getSymbol() +"_"getInterval();
    sName sName.replace("$"""); // remove $ from string
    sName sName.replace("#"""); // remove # from string
    sName sName.replace("-"""); // remove # from string
    sName sName.replace(" ""_"// replace space with underscore
    debugPrintln("DDE Link for Excel =eSignal|EFS!"+sName);
    ddeENP = new DDEOutput(sName);
    }
    if (
    ddeSTP == null) {
    var 
    sName "STP" getSymbol() +"_"getInterval();
    sName sName.replace("$"""); // remove $ from string
    sName sName.replace("#"""); // remove # from string
    sName sName.replace("-"""); // remove # from string
    sName sName.replace(" ""_"// replace space with underscore
    debugPrintln("DDE Link for Excel =eSignal|EFS!"+sName);
    ddeSTP = new DDEOutput(sName);
    }
    if (
    ddeDIR == null) {
    var 
    sName "DIR" getSymbol() +"_"getInterval();
    sName sName.replace("$"""); // remove $ from string
    sName sName.replace("#"""); // remove # from string
    sName sName.replace("-"""); // remove # from string
    sName sName.replace(" ""_"// replace space with underscore
    debugPrintln("DDE Link for Excel =eSignal|EFS!"+sName);
    ddeDIR = new DDEOutput(sName);
    }
    //lines 85 - 248 Omitted (these work and should not have effect on the dde portion that I need to get working

    if((value2 == 1) && (value1 != 0)) value2 0;
    if ((
    value2 == ) && (value1 == 0) && (v2p == 0) && (Strategy.isLong() == false)) {
        
    setBarBgColor(Color.RGB(0,255,0))
        
    //Long Position entry
        
    lgstp  ll3p;
        
    Strategy.doLong("Enter 03 Long",Strategy.CLOSE,Strategy.THISBAR,1)
        
    enthhl hhp;
        
    entlll LL;
        
    trigl  = (high() + (avgrg 7));
        
    eatrl  avgrg;
        
    lentp  close();
        
    lgms   ll3p;
        
    eday   1;
        
    entdl  day(0);
    }

    if((
    value2 == -1) && (value1 != 0)) value2 0;
    if ((
    value2 == -1) && (value1 == 0) && (v2p == 0)) {
        
    // Short Position Entry
        
    setBarBgColor(Color.RGB(255,0,0))
        
    ststp  hh3p;
        
    Strategy.doShort("Enter 03 Short",Strategy.CLOSE,Strategy.THISBAR,1);
        
    enthhs HH;
        
    entlls LL;
        
    trigs  dlow + (avgrg 7);
        
    eatrs  avgrg;
        
    sentp  tdcl;
        
    stms   hh3p;
        
    eday   1;
        
    entds  day(0);
    }
    if (
    Strategy.isLong() == true) {
        
    datr eatrl;
        
    dend entdl;
        
    denp lentp;
        
    dstp lgstp;
        
    ddir 1;
        
    ddeEND.set(dend);
        
    ddeENP.set(denp);
        
    ddeSTP.set(dstp);
        
    ddeDIR.set(ddir);
        
    ddeATR.set(datr);
    }
    if(
    Strategy.isShort() == true) {
        
    datr eatrs;
        
    dend entds;
        
    denp sentp;
        
    dstp ststp;
        
    ddir = -1;
        
    ddeEND.set(dend);
        
    ddeENP.set(denp);
        
    ddeSTP.set(dstp);
        
    ddeDIR.set(ddir);
        
    ddeATR.set(datr);
    }
    //lines 303 - 473 Omitted (exit portion of strategy)

    return new Array(datr,dend,denp,dstp,ddir); 
    Is there a simple answer to returning the dde values with something other than [object series]?

    Best Regards,

    Tim
    Last edited by arbor03; 09-01-2006, 08:32 AM.

    Comment


    • #32
      Hello Tim,

      DDE links will only return current values. To have a single EFS create multiple DDE links you just need to initialize a new DDEOutput() object for each one you want to create. Each DDE object will also need to have unique names.
      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


      • #33
        Jason,

        Many thanks for you quick response. I hope the attached image helps explain my problem. Do I need to use a getValue even though I am not using a MA study or the like? if so what would be a good way to approach it? I am rather new to eSignal and EFS.

        Again Many Thanks,

        Tim
        Attached Files

        Comment


        • #34
          Hello Tim,

          Yes, you need to assign the current value of the Series to the DDE object using the .getValue(0) method. When you pass the Series object itself, the string "[object series]" is what gets passed as you are observing.
          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


          • #35
            Jason,

            Thank you ! No more Object Series. Just one more small problem that I hope is oversight on my part. All the values when in the ddelink show up as 0 in excel. I confirmed with the debugPrintln and for example the ATR value shows 0.006447971399003872, still 0 in excel, also, I tried setting it to a constant 50, which worked for the debugPrintln in the formula output window, but not in excel, and I did make sure to refresh, and renenter DDE Link in excel as well as save, remove and reload the strategy.

            My apologies, I almost feel as if i am missing something right in front of my nose.

            Many Thanks,

            Tim

            PHP Code:
            if (Strategy.isLong() == true) {
                
            datr eatrl.getValue(0);
                
            dend entdl.getValue(0);
                
            denp lentp.getValue(0);
                
            dstp lgms.getValue(0);
                
            ddir 1;
                
            ddeEND.set(dend);
                
            ddeENP.set(denp);
                
            ddeSTP.set(dstp);
                
            ddeDIR.set(ddir);
                
            ddeATR.set(datr);
            }
            if(
            Strategy.isShort() == true) {
                
            datr eatrs.getValue(0);
                
            dend entds.getValue(0);
                
            denp sentp.getValue(0);
                
            dstp stms.getValue(0);
                
            ddir = -1;
                
            ddeEND.set(dend);
                
            ddeENP.set(denp);
                
            ddeSTP.set(dstp);
                
            ddeDIR.set(ddir);
                
            ddeATR.set(datr);
            }
            debugPrintln(datr);
            if(
            datr != null){
            return new Array(
            datr,dend,denp,dstp,ddir);
            }
            if (
            bInit == 1bInit 2;
            if (
            bInit == 0bInit 1

            Comment


            • #36
              Good Day,

              I simplified this a bit more and I apologize if I have missed something. Is there a connection I am not making here? This Bit still passes a 0 always to excel. Many thanks for your time.

              Tim

              PHP Code:
              function preMain(){
              setPriceStudy(false);
              }
              var 
              ddeATR  null;
              var 
              tt1tt2tt3tt4;
              function 
              main() {
              if(
              tt1 nulltt1 0;
              if(
              tt2 nulltt2 0;
              if(
              tt3 nulltt3 0;
              if(
              tt4 nulltt4 0;
              if (
              ddeATR == null) {
              var 
              sName "ATR" getSymbol() +"_"getInterval();
              sName sName.replace("$"""); // remove $ from string
              sName sName.replace("#"""); // remove # from string
              sName sName.replace("-"""); // remove # from string
              sName sName.replace(" ""_"// replace space with underscore
              debugPrintln("DDE Link for Excel =eSignal|EFS!"+sName);
              ddeATR = new DDEOutput(sName);
              }
              if(
              tt4 0tt4 1;
              if(
              tt3 1tt4 1;
              if(
              tt2 1tt3 1;
              if(
              tt1 1tt2 1;
              if(
              tt1 0tt1 1;
              if((
              >= -1)) {
                  
              datr tt4.getValue(0);
                  
              ddeATR.set(datr);
                  
              debugPrintln("1")
                  return 
              datr;
              }

              Comment


              • #37
                Hello Tim,

                The reason you are only getting a 0 is because the tt4 variable is set to a constant value of 0. There isn't any logic in your formula that is changing the value of tt4. The conditional statement that is supposed to increment the value of tt4 never evaluates to true because it is set to an initial value of 0. You could try changing the condition to a >= comparison. This will allow tt4 to increment. If you go this route, then datr can just be assigned to tt4 directly. In this case tt4 does not contain a Series, just a calculated number. The .getValue() method only needs to be used on a Series.

                Try the modified code below. Instead of assigning a 0 to tt4 I've assigned an atr() series.

                PHP Code:
                function preMain(){
                    
                setPriceStudy(false);
                }

                var 
                ddeATR null;
                var 
                tt4 null;  // new

                function main() {
                    
                //if(tt4 = null) tt4 = 0;
                    
                if(tt4 == nulltt4 atr(1);     // new
                    
                if (ddeATR == null) {
                        var 
                sName "ATR" getSymbol() +"_"getInterval();
                        
                sName sName.replace("$"""); // remove $ from string
                        
                sName sName.replace("#"""); // remove # from string
                        
                sName sName.replace("-"""); // remove # from string
                        
                sName sName.replace(" ""_"// replace space with underscore
                        
                debugPrintln("DDE Link for Excel =eSignal|EFS!"+sName);
                        
                ddeATR = new DDEOutput(sName);
                    }

                    var 
                datr tt4.getValue(0);
                    
                ddeATR.set(datr);

                    return 
                datr;

                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


                • #38
                  Thank you for your Paitence Jason I see my error now.

                  I guess the bottom line really is,
                  I have a strategy and what I need to accomplish is to be able to save the date of entry, atr on entry, and price on entry, and dde output those values into excel while in a trade. Is this possible?

                  Sorry for all the trouble,

                  Tim

                  Comment


                  • #39
                    Hello Tim,

                    Yes, this should be possible. What you need to keep in mind is that a dde link will only be showing you what the most recent value for the object was set to, or the last trade information. If you want to keep a log of all your trades then you would need to write a VBA routine in Excel that would copy and paste the values from the dde links to some other area in the worksheet when it detects a new set of values. Or you could alternatively use the File Object and write this information to a text file that you could then import into Excel.
                    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


                    • #40
                      MS Excel 2003 - eSignal 10.2

                      Hello Alexis,

                      Regarding your post ->
                      Posted: 09-25-2004 01:47 PM

                      Does that work also for MS Excel 2003 in conjuction with eSignal Version 10.2?
                      How the efs looks like to let run the CCI indicator in excel like described below?

                      Many thanks.

                      Best

                      Roland
                      Last edited by roland_p71; 01-13-2009, 05:16 PM.

                      Comment


                      • #41
                        Re: MS Excel 2003 - eSignal 10.2

                        Roland
                        As far as I know it does
                        Alex


                        Originally posted by roland_p71
                        Hello Alexis,

                        Regarding your post ->
                        Posted: 09-25-2004 01:47 PM

                        Does that work also for MS Excel 2003 in conjuction with eSignal Version 10.2?
                        How the efs looks like to let run the CCI indicator in excel like described below?

                        Many thanks.

                        Best

                        Roland

                        Comment

                        Working...
                        X