Announcement

Collapse
No announcement yet.

Function invalid

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

  • Function invalid

    If anyone could please help!



    For the attached "Current Price.efs", I'm receiving the "formula error" each time I load the program stating "line 15: Parameter Number 3 of Function drawTextRelative is invalid".

    When I reload the efs, the error message disappears and my current price appears on the chart.

    I believe it is a simple solution but I'm not sure what to add or change, I appreciate any help you can offer, thanks.
    zeller4
    Last edited by zeller4; 06-23-2007, 05:37 PM.

  • #2
    attached file
    Attached Files

    Comment


    • #3
      zeller4,

      There may be several issues here.

      The main function is receiving a parameter named Price, then you are setting a new variable Price. While not illegal, it is unecessary and it may be problematic later on.

      I believe the error is likely due to your Price variable being undefined, likely due to getMostRecentTrade() being undefined, ultimately resulting in the error.

      undefined , evaluates as false, so you may want to place a conditional prior to the step you are getting an error with. You should also consider using several debugPrintln statements to output these variables. They will provide indication as to whey you are receiving the error.

      PHP Code:
      function preMain() {

          
      setPriceStudy(true);
          
      setStudyTitle("Current Price");
          
          
      }

      function 
      main(Price) {

          var 
      Price formatPriceNumber(getMostRecentTrade());

          
      drawTextRelative(2,getMostRecentTrade(),"t",Color.blue,null,Text.VCENTER,"Wingdings 3",8,1);
          
      drawTextRelative(4,getMostRecentTrade(), PriceColor.blue,null,Text.VCENTER,"Arial",14,2);

          return;

      Comment


      • #4
        Steve,

        thanks for the suggestions, I'll try them out. Currently going through the tutorials (again!)

        kz

        Comment


        • #5
          You are most welcome.

          Comment

          Working...
          X