Announcement

Collapse
No announcement yet.

How to change "function main()" parameters in menu

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

  • How to change "function main()" parameters in menu

    Hi,

    How would I add or remove menu options in the "Edit Studies" window?

    The intent is to only display "ColorBars,PriceUpColor, PriceDnColor" in the "Edit Menu" when "ColorBars" is true. So when "ColorBars" is false the Menu options in "Edit Menu" change to only "ColorBars"

    I have tried several things without success. For example:
    (just the code needed for this example)

    function preMain() {
    var x=0;
    aFPArray[x] = new FunctionParameter("ColorBars", FunctionParameter.BOOLEAN);
    with(aFPArray[x++]){
    setName( "Color Bars?" );
    setDefault(false);
    }
    aFPArray[x] = new FunctionParameter( "PriceUpColor", FunctionParameter.COLOR);
    with( aFPArray[x++] ) {
    setName( "Stoch1 Slow PriceBar Up" );
    setDefault( Color.lime );
    }
    aFPArray[x] = new FunctionParameter( "PriceDnColor", FunctionParameter.COLOR);
    with( aFPArray[x++] ) {
    setName( "Stoch1 Slow PriceBar Dn" );
    setDefault( Color.red );
    }
    }
    if (ColorBars==true){
    function main( ColorBars, PriceUpColor, PriceDnColor ) {
    }else if(ColorBars==false){
    function main( ColorBars) {
    }
    ....rest of code

    Thanks in advance for any help.

    Wayne
    Last edited by waynecd; 05-19-2008, 11:16 AM.

  • #2
    When you add a function parameter, you will need to remove, and then add the efs study. A simple reload will not reflect the change correctly.

    Garth
    Garth

    Comment


    • #3
      Thanks for the reply Garth,

      Of course you are correct. But I am trying to control the # of menu options displayed in "Edit Menu" via the "Edit Menu" itself.

      What I'd like to do is to not display the color parameters in the "Edit Menu" when the Boolean parameter "ColorBars" is set to false. Then when it is set to true the "Edit Menu" would now show the Color parameters.

      In, other words when "ColorBars" is set to false there are no Color menu items in "Edit Menu". They re-appear once "ColorBars" is set to true.

      Maybe this can't be done via efs since a change in the "function Main(x,y,...)" parameters i.e. (x,y,...)" might not be allowed while the efs is running. If so, as you stated, to do so you need to edit the efs, delete it from the chart and re-load the revised version into the chart.

      If anyone knows of a way to do this I would appreciate a tip.

      Thanks
      Last edited by waynecd; 05-19-2008, 03:47 PM.

      Comment


      • #4
        OK, I got it. I tried to do this once and couldn't figure out how. The best idea I had was to use the eval() stament to provide the main function statement...but even that didn't work.

        Sorry there isn't better news.

        Garth
        Garth

        Comment

        Working...
        X