Announcement

Collapse
No announcement yet.

Changing color according to direction

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

  • Changing color according to direction

    G'day,
    Rather than start a new tread I thought I'd ask here because of the similarity of my question. I’m very new to efs (or any programming for that matter) and I’m having a hard time getting my head around the format. As with Royce, I’d like to modify the color of the slow line (“Filt”) to change to green for ascending values and red for descending values. I greatly appreciate any efforts to increase my efs knowledge and understanding.

    Kindest regards,

    David
    Attached Files
    I've never had a losing trade, I just ran out of time.

  • #2
    David
    Insert the following lines of code
    PHP Code:
    var myRef ref(-1);//retrieve the values at the prior bar of the returned array and assign them to the variable myRef
        
    if(myRef!=null//if myRef is not null then 
            
    var Filt_1 myRef[0];//assign to the variable Filt_1 the value of Filt at the prior bar
        
    if(Filt>=Filt_1//if the current value of Filt is greater than or equal to the prior value of Filt (ie Filt_1)
            
    setBarFgColor(Color.lime,0);//color the line in lime
        
    else //else
            
    setBarFgColor(Color.red,0);//color the line in red 
    in between lines 111 and 112 of the script you posted. Comments explaining each step are included
    If - as you indicate - you are new to programming in efs and are interested in learning then you may want to start by reviewing the JavaScript for EFS video series and the Core JavaScript Reference Guide. These will provide you with a thorough introduction to programming in JavaScript which is at the foundation of EFS. Then go through the EFS KnowledgeBase and study the Help Guides and Tutorials which will provide you with the specifics of EFS.
    If at any time you have specific programming questions post them in this forum and someone will try to assist you
    Alex


    Originally posted by David Vels
    G'day,
    Rather than start a new tread I thought I'd ask here because of the similarity of my question. I’m very new to efs (or any programming for that matter) and I’m having a hard time getting my head around the format. As with Royce, I’d like to modify the color of the slow line (“Filt”) to change to green for ascending values and red for descending values. I greatly appreciate any efforts to increase my efs knowledge and understanding.

    Kindest regards,

    David

    Comment


    • #3
      Alex,
      You truly are "da man". Thanks for your reply. I had begun to go through the videos and help guides but became a little overwhelmed so I thought I’d ask for a solution and find understanding from implementing the solution.

      Yours thankfully
      David
      I've never had a losing trade, I just ran out of time.

      Comment


      • #4
        David
        You are most welcome and thank you for the compliment
        Alex


        Originally posted by David Vels
        Alex,
        You truly are "da man". Thanks for your reply. I had begun to go through the videos and help guides but became a little overwhelmed so I thought I’d ask for a solution and find understanding from implementing the solution.

        Yours thankfully
        David

        Comment


        • #5
          Hi Alex,
          I have implemented the code as instructed and it almost does what I’m after. As it is now, the line changes color at the crossover of the fast and slow lines as opposed to the turn of the slow (FIR) line. Oh, I gave you the wrong “line” earlier (“Filt”) but substituted one for the other in the code before implementing it. I’ve included an image of what’s happening.

          Thanks again

          David
          Attached Files
          I've never had a losing trade, I just ran out of time.

          Comment


          • #6
            Oops... I had the line right the first time... D'oh!!! It's now working as preferred
            Thanks so much Alex.

            Regards
            David
            Last edited by David Vels; 10-13-2008, 04:58 PM.
            I've never had a losing trade, I just ran out of time.

            Comment


            • #7
              David
              Just to confirm Filt is the slow line and FIR is the fast line and the code I provided should color the Filt line in lime when it is rising and in red when it is falling
              Alex

              Comment

              Working...
              X