Announcement

Collapse
No announcement yet.

Trouble with setPriceBarColor

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

  • Trouble with setPriceBarColor

    I am creating a trend indicator called Heikin-Ashi that operates by coloring price bars red and green.

    The following fragment of the program is producing an error at:
    setPriceBarColor(Color.lime);

    The error text is:
    "Heikin-Mod-A.efs Line 85 Parameter number 1 of function setPriceBarColor is invalid."

    I've used this function in other .efs and it works fine. Maybe another pair of eyes can see the error.

    Thank YOu,

    Ed Hoopes
    [email protected]

    START Heikin-Ashi code fragment here: - - -

    //Execute this on all subsequent passes ;
    if (v1st_pass == "false") {

    haClose_Prev = haClose_Curr ;
    haOpen_Prev = (haOpen_Curr + haClose_Prev) / 2.0;

    haOpen_Curr = (haOpen_Prev + haClose_Prev) / 2.0;
    haClose_Curr = (open() + close() + high() + low()) / 4.0;

    if ( haClose_Curr > haOpen_Curr)
    {
    setPriceBarColor(Color.lime);
    Color = "lim";
    }

    if ( haOpen_Curr > haClose_Curr)
    {
    setPriceBarColor(Color.red);
    Color = "red";
    }

  • #2
    Hi,

    I'm not sure if this addresses your specific question but here's a thread from last month discussing Heikin-Ashi.

    I hope that helps. If it doesn't, please reply to this post so others will know you need additional assistance.

    Thanks.

    Comment


    • #3
      ReefBreak:

      The problem lies in your use of a variable called "Color" in your code. Color is a reserved object in EFS. Change your variable name to something like xColor and your script will work.

      Chris

      Comment

      Working...
      X