Announcement

Collapse
No announcement yet.

Editing a library efs into Wizard efs

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

  • Editing a library efs into Wizard efs

    Is there any way in which I can get a Library efs into a Wizard generated efs.

    I thought that maybe if I put together a simple wizard efs (see below) using ROC study that say go long ROC>0 and short if ROC<0 then I could open it in EFS Editor and edit the body of the formula text in some way to use the Library StochRSI instead of ROC. Is there a way to do this? I wouldn't know where to start trying to write it from scratch.

    The Wizard is such an excellent tool for those of us who aren't programmers but it always seems like it is the poor relation in terms of development. There are masses of standard efs studies which are provided for our use but the Wizard only allows the use of the few "builtin" studies although and even then it doesn't allow MAchannel off that list. But if I could edit

    var vROC20 = new ROCStudy(20, "Close");

    to say something like

    var vStochRSI = Library StochRSI.efs(20, "Close");

    that would be excellent.


    Anyway, thanks if someone can help.

    Regards
    Rob

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


    //{{EFSWizard_Declarations
    var vROC20 = new ROCStudy(20, "Close");
    var vLastAlert = -1;
    //}}EFSWizard_Declarations


    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("ROC Trader");
    //}}EFSWizard_PreMain

    }

    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
    if (
    vROC20.getValue(ROCStudy.ROC) > 0
    ) onAction1()
    //}}EFSWizard_Expression_1

    //{{EFSWizard_Expression_2
    else if (
    vROC20.getValue(ROCStudy.ROC) < 0
    ) onAction2();
    //}}EFSWizard_Expression_2

    //}}EFSWizard_Expressions


    //{{EFSWizard_Return
    return null;
    //}}EFSWizard_Return

    }

    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() {
    if (vLastAlert != 1) Strategy.doLong("", Strategy.CLOSE, Strategy.THISBAR, Strategy.DEFAULT, 0);
    if (vLastAlert != 1) drawShapeRelative(0, low()-0.5, Shape.CIRCLE, "", Color.RGB(0,0,255), Shape.LEFT);
    vLastAlert = 1;
    }
    //}}EFSWizard_Action_1

    //{{EFSWizard_Action_2
    function onAction2() {
    if (vLastAlert != 2) Strategy.doShort("", Strategy.CLOSE, Strategy.THISBAR, Strategy.DEFAULT, 0);
    if (vLastAlert != 2) drawShapeRelative(0, high()+0.5, Shape.CIRCLE, "", Color.RGB(255,0,0), Shape.LEFT);
    vLastAlert = 2;
    }
    //}}EFSWizard_Action_2

    //}}EFSWizard_Actions

  • #2
    Rob
    At this time the Formula Wizard can only read scripts that were written using the Formula Wizard.
    However if you familiarize yourself with the builtin EFS2 studies and their syntax you can create several relatively complex studies and use them in the Formula Wizard even if these studies are not actually available to the Formula Wizard. For example the current value of %D of the Stochastic of RSI can be written as follows
    stochD(14,1,3,rsi(14),0)
    This means that you could use the command line directly in the conditional statements of the Formula Wizard as in the image below



    which will return the following result



    It may not be the most efficient script but it works.
    Ultimately the better solution is to actually learn how to program in EFS without the need for the Formula Wizard as that will allow you to take full advantage of the richness of the language.
    Alex

    Comment


    • #3
      Alex

      Thanks for the reply.

      I take your point about learning the efs language but it is easier said than done from scratch. I know it would be to my advantage but not eveyone needs the full complexity. It is sooooo much work just to get to the point where I can circumvent a few shortcomings of the wizard which at this point is all I need. In the meantime I will investigate the workaround you have suggested.

      Where would be the best place to start including notes on all the brackets and // and what exactly premain is etc etc.

      As an aside, I didn't thank you for your reply to my email and subsequent writing of the efs2 MAchannel a few months ago. With the amount of help you give people you ought to be on the payroll and hence my incorrect assumption. Anyway, Big thank you!

      Best Regards
      Rob

      Comment


      • #4
        Rob
        First of all thank you for the compliments.
        With regards to having a better understanding of the basic structure of an efs (ie what are preMain(), main(), global variables, etc) I would suggest going through the Guide to Developing eSignal Indicators which should provide you with most of that information.
        As to the workaround I suggested that is applicable to all the EFS2 builtin studies and familiarizing yourself with their syntax will provide you IMHO with much of what you are trying to accomplish. As I said in my prior reply the resulting scripts will not necessarily be the most efficient (from the point of view of performance) but they will get the job done and more importantly will help you improve your efs programming skills.
        As you gain more understanding of the structure of these functions and of efs then you may find that the step to programming without the Formula Wizard is smaller than you may think at this time.
        If at any time you run into some difficulties with the code you are writing post it and someone may be available to help
        Alex

        Comment

        Working...
        X