Announcement

Collapse
No announcement yet.

SmoothMACD - Help a rookie change a code plz

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

  • SmoothMACD - Help a rookie change a code plz

    Hello all.

    Im trying to change 1 formula i already have and turning it into a Smoothed MACD.

    But now i found myself with some problems i cant fix that are:

    Chance the color of the MACD line to green if the value is going up and to red is the value is going down (not above or below zero line). I cant figure out how to do that.

    Make a clone of the plot, to turn it into a historigram to make it more MACD alike.

    Is out there any expert that could help me here.

    Im sure it is a simple thing but im going arround and arround and arround and it dont work.

    I tried for color change

    IF (dThisMA > dThisMA(-1)) but it dont work either


    Help would be extremly apreciated

    Best Regards
    Gil
    Attached Files

  • #2
    Gil

    Make a clone of the plot, to turn it into a historigram to make it more MACD alike.
    To plot it as a histogram you would need to add a setPlotType(PLOTTYPE_HISTOGRAM) statement in the preMain function (see the link for the description and syntax required by the function)

    IF (dThisMA > dThisMA(-1)) but it dont work either
    The syntax you used in dThisMA(-1) is not valid even if the variable were a series in which case you would need to retrieve its value using the .getValue() method eg myVar.getValue(0) (see the link for more information on the series object)
    In your case however dThisMA is not a series but a single value. In the script though the value at the prior bar of dThsMA is already stored in the variable dLastMA so to accomplish what you are trying to do you would use
    if(dThisMA > dLastMA)
    Then to color the plot you would use the setBarFgColor() function (see the link for the syntax)
    If - as you indicate - you are unfamiliar with programming in efs then you may find it to your benefit to learn to do that as it will enable you to take full advantage of the resources offered by the eSignal application. The best way to do this is to start by reviewing the JavaScript for EFS video series and the Core JavaScript Reference Guide. Those 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.
    Alex


    Originally posted by garaujo
    Hello all.

    Im trying to change 1 formula i already have and turning it into a Smoothed MACD.

    But now i found myself with some problems i cant fix that are:

    Chance the color of the MACD line to green if the value is going up and to red is the value is going down (not above or below zero line). I cant figure out how to do that.

    Make a clone of the plot, to turn it into a historigram to make it more MACD alike.

    Is out there any expert that could help me here.

    Im sure it is a simple thing but im going arround and arround and arround and it dont work.

    I tried for color change

    IF (dThisMA > dThisMA(-1)) but it dont work either


    Help would be extremly apreciated

    Best Regards
    Gil

    Comment

    Working...
    X