Announcement

Collapse
No announcement yet.

Plot results of EFS from Study

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

  • Plot results of EFS from Study

    Hello, need a little help please. TIA

    Basically need to plot a new efs that takes the results of an EFS (i've developed) which uses a Study (i.e. cci) as the data source.

    var cciStudy = new CCIStudy(6, "H+L+C/3");

    >>>>'("H+L+C/3")', is incorrect, what is correct syntax?


    var emaOfCCI = new MAStudy(13, 0, cciStudy, CCIStudy.CCI, MAStudy.EXPONENTIAL);

    function main() {
    return emaOfCCI.getValue(MAStudy.MA);
    }

    >>>>Instead of 'MAStudy' above i'd like to use an EFS that i've developed, how would that look?

    var XXX.EFSStudyOfCCI = new XXX.EFSStudy(13, 0, cciStudy, CCIStudy.CCI, XXX.EFSStudy);

    >>>TIA!

  • #2
    rayl542921

    ("H+L+C/3") is incorrect, what is correct syntax?

    var cciStudy = new CCIStudy(6, "HLC/3");

    As to your second question that depends on the study and the information you give is insufficient to provide an example. Irrespective unless it is a builtin study it is unlikely that it will be using that syntax (or a similar one). If instead it is a builtin study you can see if it is possible to do it with the Formula Wizard
    Alex

    Comment


    • #3
      EFS study to utilize

      A,

      Thanks for your help, very much apprecaited.

      below is the code i generated w/ wizard for the CCI, i just need to figure out how to get the LSMA (attached file) of CCI, never used a EFS in this fashion previously.

      //{{EFSWizard_Description
      //
      // This formula was generated by the Alert Wizard
      //
      //}}EFSWizard_Description 7532


      //{{EFSWizard_Declarations

      var vCCI14_of_HLC3 = new CCIStudy(14, "HLC/3");
      var vLastAlert = -1;

      //}}EFSWizard_Declarations 8943


      function preMain() {
      /**
      * This function is called only once, before any of the bars are loaded.
      * Place any study or EFS configuration commands here.
      */
      //{{EFSWizard_PreMain
      setPriceStudy(true);
      setStudyTitle("CCI_LSMA");
      setCursorLabelName("CCI_LSMA", 0);
      setDefaultBarStyle(PS_SOLID, 0);
      setDefaultBarFgColor(Color.green, 0);
      setDefaultBarThickness(1, 0);
      setPlotType(PLOTTYPE_HISTOGRAM, 0);
      //}}EFSWizard_PreMain 31086

      }

      function main() {
      /**
      * The main() function is called once per bar on all previous bars, once per
      * each incoming completed bar, and if you don't have 'setComputeOnClose(true)'
      * in your preMain(), it is also called on every tick.
      */

      //{{EFSWizard_Expressions
      //{{EFSWizard_Expression_1
      //}}EFSWizard_Expression_1 0

      //}}EFSWizard_Expressions 9063


      //{{EFSWizard_Return
      return vCCI14_of_HLC3.getValue(CCIStudy.CCI);
      //}}EFSWizard_Return 6486

      }

      function postMain() {
      /**
      * The postMain() function is called only once, when the EFS is no longer used for
      * the current symbol (ie, symbol change, chart closing, or application shutdown).
      */
      }

      //{{EFSWizard_Actions
      //{{EFSWizard_Action_1
      function onAction1() {
      vLastAlert = 1;
      }
      //}}EFSWizard_Action_1 5589

      //}}EFSWizard_Actions 15622

      Comment


      • #4
        rayl542921
        FYI there was no attachment with your message
        Alex

        Comment


        • #5
          Yikes! here it is...

          A,

          Thxs. oops on my part, could not get that attached...TIA!

          Basically looking to take the LSAM of the CCI, thanks again!

          R

          function preMain() {
          setPriceStudy(false);
          setStudyTitle("LSMA");
          setCursorLabelName("LSMA");
          }

          function main(inputLength, inputOffset, UpBarThickness, DnBarThickness, ColorUp, ColorDn) {
          if(inputLength == null)
          inputLength = 25;

          if(inputOffset == null)
          inputOffset = 0;

          if(UpBarThickness == null)
          UpBarThickness = 3;

          if(DnBarThickness == null)
          DnBarThickness = 3;

          /*** Valid Colors ***
          aqua, black, blue, brown, cyan, darkgreen,
          darkgrey, fushcia, green, grey, khaki,
          lightgrey, lightyellow, lime, magenta,
          maroon, navy, olive, paleyellow, purple,
          red, teal, white, yellow
          ************************/

          if (ColorUp == null) {
          vColorUp = Color.lime;
          } else {
          vColorUp = eval("Color."+ColorUp);
          }
          if (ColorDn == null) {
          vColorDn = Color.red;
          } else {
          vColorDn = eval("Color."+ColorDn);
          }
          var vNew, vOld;

          vNew = call("/downloads/LSMA_woodie.efs", inputLength, inputOffset, 0);
          vOld = call("/downloads/LSMA_woodie.efs", inputLength, inputOffset, -1);

          if(vNew > vOld) {
          setBarFgColor(vColorUp, 0);
          setBarThickness(UpBarThickness);
          } else if(vNew < vOld) {
          setBarFgColor(vColorDn, 0);
          setBarThickness(DnBarThickness);
          }
          return vNew;
          }

          Comment


          • #6
            rayl542921
            The script you enclosed only calls the efs that actually performs the LSMA calculations.
            Anyhow I found a copy and have attached the modified version that I think will do what you asked.
            At this time the CCI study is set for a fixed Length of 20 which can only be modified using the Editor. You can however add your own functionParameter(s) if you want to be able change the parameters through Edit Studies.
            Save the efs to the Downloads subfolder folder of Formulas.
            Alex
            Attached Files

            Comment


            • #7
              rayl542921
              You will also need to change the "calling" efs (ie the one you posted).
              Here enclosed is the revised script that is now for a non-price study and that calls the modified LSMA_woodie-cci.efs
              Alex

              PHP Code:
              function preMain() {
              setPriceStudy(false);
              setStudyTitle("LSMA"); 
              setCursorLabelName("LSMA"); 


              function 
              main(inputLengthinputOffsetUpBarThicknessDnBarThicknessColorUpColorDn) {
              if(
              inputLength == null)
              inputLength 25;

              if(
              inputOffset == null)
              inputOffset 0;

              if(
              UpBarThickness == null
              UpBarThickness 3;

              if(
              DnBarThickness == null
              DnBarThickness 3;

              /*** Valid Colors *** 
              aqua, black, blue, brown, cyan, darkgreen, 
              darkgrey, fushcia, green, grey, khaki, 
              lightgrey, lightyellow, lime, magenta, 
              maroon, navy, olive, paleyellow, purple, 
              red, teal, white, yellow 
              ************************/ 

              if (ColorUp == null) { 
              vColorUp Color.lime
              } else { 
              vColorUp = eval("Color."+ColorUp); 

              if (
              ColorDn == null) { 
              vColorDn Color.red
              } else { 
              vColorDn = eval("Color."+ColorDn); 

              var 
              vNewvOld;

              vNew call("/downloads/LSMA_woodie-cci.efs"inputLengthinputOffset0);
              vOld call("/downloads/LSMA_woodie-cci.efs"inputLengthinputOffset, -1);

              if(
              vNew vOld) {
              setBarFgColor(vColorUp0);
              setBarThickness(UpBarThickness);
              } else if(
              vNew vOld) {
              setBarFgColor(vColorDn0);
              setBarThickness(DnBarThickness);
              }
              return 
              vNew;

              Comment

              Working...
              X