Announcement

Collapse
No announcement yet.

need help building these statements from menu items

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

  • need help building these statements from menu items

    I'm trying to write a template that allows me to menu pretty much everything...

    I'm stuck trying to build the following drawshape and strategy statements. I would think the resolution is the same for both.

    Do I need to build the two lines as strings, then turn them into objects? Or do something else?

    Thanks,
    -function THEO( Foggy );

    PHP Code:
    // TEST

    function preMain() {

        
    setStudyTitle("Test");
        
    setPriceStudy(true);

        var 
    fp1 = new FunctionParameter("vSource"FunctionParameter.STRING);
        
    fp1.setName("Source");
        
    fp1.addOption("Close");
        
    fp1.addOption("High");
        
    fp1.addOption("Low");
        
    fp1.addOption("Open");
        
    fp1.setDefault("Close");

        var 
    fp2 = new FunctionParameter("vOffset"FunctionParameter.NUMBER);
        
    fp2.setDefault(-1);

        var 
    fp3 = new FunctionParameter("vSource2"FunctionParameter.STRING);
        
    fp3.setName("Short Source");
        
    fp3.addOption("Strategy.MARKET");
        
    fp3.addOption("Strategy.CLOSE");
        
    fp3.addOption("Strategy.LIMIT");
        
    fp3.addOption("Strategy.STOP");
        
    fp3.setDefault("Strategy.CLOSE");
    }

    function 
    main(vSourcevOffsetvSource2) {

        
    drawShapeRelative(0vSource(vOffset), Shape.DIAMONDnullColor.brownShape.BOTTOM);

        
    Strategy.doShort("SHORTopen"vSource2Strategy.THISBAR);
        
        return;



  • #2
    tedsmith
    This is how you would need to write the examples you provided.
    For an explanation of eval() click here
    Alex

    PHP Code:
    function preMain() {

        
    setStudyTitle("Test");
        
    setPriceStudy(true);

        var 
    fp1 = new FunctionParameter("vSource"FunctionParameter.STRING);
        
    fp1.setName("Source");
        
    fp1.addOption("close");
        
    fp1.addOption("high");
        
    fp1.addOption("low");
        
    fp1.addOption("open");
        
    fp1.setDefault("close");

        var 
    fp2 = new FunctionParameter("vOffset"FunctionParameter.NUMBER);
        
    fp2.setDefault(-1);

        var 
    fp3 = new FunctionParameter("vSource2"FunctionParameter.STRING);
        
    fp3.setName("Short Source");
        
    fp3.addOption("Strategy.MARKET");
        
    fp3.addOption("Strategy.CLOSE");
        
    fp3.addOption("Strategy.LIMIT");
        
    fp3.addOption("Strategy.STOP");
        
    fp3.setDefault("Strategy.CLOSE");
    }

    function 
    main(vSourcevOffsetvSource2) {

        
    drawShapeRelative(0, eval(vSource)(vOffset), Shape.DIAMONDnullColor.brownShape.BOTTOM);
        
        
    Strategy.doShort("SHORTopen", eval(vSource2), Strategy.THISBAR);
        
        return;


    Comment


    • #3
      That's all there is to it?
      (How embarassing)

      Thank-you kindly,
      -function THEO( SlappingForehead );

      Comment

      Working...
      X