Announcement

Collapse
No announcement yet.

FunctionParameter question

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

  • FunctionParameter question

    Hello

    I am having difficulty understanding why my FunctionParameters are not coming up in the >Chart Options/Edit studies.

    Can someone perhaps explain please?

    Thanks

    PHP Code:
    function preMain() {
        
    setStudyTitle("IB Try");
        
    setPriceStudy(true);
        
    setShowCursorLabel(false);

        
    // default parameters
        
    var     fp0 = new FunctionParameter("Risk"FunctionParameter.NUMBER);
                
    fp0.setName("Risk");
                
    fp0.setDefault(150);


        var     
    fp1 = new FunctionParameter("PSL"FunctionParameter.NUMBER);
                
    fp1.setName("PSL");
                
    fp1.setLowerLimit(1);
                
    fp1.setDefault(20);



    var 
    Long
    var PSL
    var Size
    var Risk
    var Bid





    }
    function 
    main(){
    var 
    nState getBarState();

        
    Bid =   getMostRecentAsk()  
        
            
                
    debugPrintln(Bid);

        } 

  • #2
    Re: FunctionParameter question

    Patch227
    You need to add the FunctionParameter names in the arguments of the main() function eg
    function main(Risk, PSL){
    For more information and examples on the FunctionParameter Object see this article in the EFS KnowledgeBase and/or any one of the studies included in the EFS2 Custom folder in Formulas
    Alex


    Originally posted by Patch227
    Hello

    I am having difficulty understanding why my FunctionParameters are not coming up in the >Chart Options/Edit studies.

    Can someone perhaps explain please?

    Thanks

    PHP Code:
    function preMain() {
        
    setStudyTitle("IB Try");
        
    setPriceStudy(true);
        
    setShowCursorLabel(false);

        
    // default parameters
        
    var     fp0 = new FunctionParameter("Risk"FunctionParameter.NUMBER);
                
    fp0.setName("Risk");
                
    fp0.setDefault(150);


        var     
    fp1 = new FunctionParameter("PSL"FunctionParameter.NUMBER);
                
    fp1.setName("PSL");
                
    fp1.setLowerLimit(1);
                
    fp1.setDefault(20);



    var 
    Long
    var PSL
    var Size
    var Risk
    var Bid





    }
    function 
    main(){
    var 
    nState getBarState();

        
    Bid =   getMostRecentAsk()  
        
            
                
    debugPrintln(Bid);

        } 

    Comment


    • #3
      Thank you Alex. Nowhere in the EFS literature have I seen this mentioned.

      Comment


      • #4
        Patch227
        You are most welcome.
        As to this not being mentioned in the EFS literature I am not sure what you mean as it is explained in depth in the Tutorial 3: Introduction to preMain() and main() which is available in the EFS KnowledgeBase in the Help Guides and Tutorials-> Beginner Tutorials and it is mentioned in the examples shown in the article I pointed to in my previous reply and in the EFS Editor Help file (under FunctionParameter Object)
        Alex


        Originally posted by Patch227
        Thank you Alex. Nowhere in the EFS literature have I seen this mentioned.

        Comment

        Working...
        X