Announcement

Collapse
No announcement yet.

Donchian color bars

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

  • Donchian color bars

    I'm trying to eliminate the changing colors of the candlesticks in the following efs. Does anyone know how? I know you should put in a // in front of the input but I keep getting an error when I do. Thanks for your time. Here is the EFS.


    //{{EFSWizard_Description
    //
    // This formula was generated by the Alert Wizard
    //
    //}}EFSWizard_Description 7532


    //{{EFSWizard_Declarations

    var vDonchian = new DonchianStudy(2, 1);
    var vLastAlert = -1;

    //}}EFSWizard_Declarations 7225


    function preMain() {
    //{{EFSWizard_Code_PreMain_setPriceBarColor
    setColorPriceBars(true);
    //}}EFSWizard_Code_PreMain_setPriceBarColor 3448
    /**
    * This function is called only once, before any of the bars are loaded.
    * Place any study or EFS configuration commands here.
    */
    //{{EFSWizard_PreMain
    setPriceStudy(true);
    setStudyTitle("donchian test");
    setCursorLabelName("UP", 0);
    setCursorLabelName("DN", 1);
    setDefaultBarStyle(PS_SOLID, 0);
    setDefaultBarStyle(PS_SOLID, 1);
    setDefaultBarFgColor(Color.lightgrey, 0);
    setDefaultBarFgColor(Color.lightgrey, 1);
    setDefaultBarThickness(1, 0);
    setDefaultBarThickness(1, 1);
    setPlotType(PLOTTYPE_LINE, 0);
    setPlotType(PLOTTYPE_LINE, 1);
    //}}EFSWizard_PreMain 53624

    }

    function main() {
    /**
    * The main() function is called once per bar on all previous bars, once per
    * each incoming completed bar, and if you don't have 'setComputeOnClose(true)'
    * in your preMain(), it is also called on every tick.
    */

    //{{EFSWizard_Expressions
    //{{EFSWizard_Expression_1
    if (
    high() > vDonchian.getValue(DonchianStudy.UPPER)
    ) onAction1()
    //}}EFSWizard_Expression_1 10577

    //{{EFSWizard_Expression_2
    else if (
    low() < vDonchian.getValue(DonchianStudy.LOWER)
    ) onAction2()
    //}}EFSWizard_Expression_2 12043

    //{{EFSWizard_Expression_3
    else if (
    1 == 1
    ) onAction3();
    //}}EFSWizard_Expression_3 6846

    //}}EFSWizard_Expressions 58387


    //{{EFSWizard_Return
    return new Array(
    vDonchian.getValue(DonchianStudy.UPPER),
    vDonchian.getValue(DonchianStudy.LOWER)
    );
    //}}EFSWizard_Return 15590

    }

    function postMain() {
    /**
    * The postMain() function is called only once, when the EFS is no longer used for
    * the current symbol (ie, symbol change, chart closing, or application shutdown).
    */
    }

    //{{EFSWizard_Actions
    //{{EFSWizard_Action_1
    function onAction1() {
    if (vLastAlert != 1) Alert.playSound("C:\\Program Files\\eSignal\\Sounds\\Ding.wav");
    setPriceBarColor(Color.RGB(0,255,0));
    if (vLastAlert != 1) Alert.addToList(getSymbol(), "Highest High", Color.black, Color.green);
    vLastAlert = 1;
    }
    //}}EFSWizard_Action_1 36685

    //{{EFSWizard_Action_2
    function onAction2() {
    if (vLastAlert != 2) Alert.playSound("C:\\PROGRAM FILES\\ESIGNAL\\Sounds\\Ding.wav");
    setPriceBarColor(Color.RGB(255,0,0));
    if (vLastAlert != 2) Alert.addToList(getSymbol(), "Lowest Low", Color.blue, Color.red);
    vLastAlert = 2;
    }
    //}}EFSWizard_Action_2 35124

    //{{EFSWizard_Action_3
    function onAction3() {
    setPriceBarColor(Color.RGB(0,0,0));
    vLastAlert = 3;
    }
    //}}EFSWizard_Action_3 10592

    //}}EFSWizard_Actions 113066

  • #2
    Re: Donchian color bars

    gwika
    Just delete or comment out lines 90 and 99. To comment out a line you place a double forward slash at the beginning of the line eg
    //setPriceBarColor(Color.RGB(0,255,0));
    Alex


    Originally posted by gwika
    I'm trying to eliminate the changing colors of the candlesticks in the following efs. Does anyone know how? I know you should put in a // in front of the input but I keep getting an error when I do. Thanks for your time. Here is the EFS.


    //{{EFSWizard_Description
    //
    // This formula was generated by the Alert Wizard
    //
    //}}EFSWizard_Description 7532


    //{{EFSWizard_Declarations

    var vDonchian = new DonchianStudy(2, 1);
    var vLastAlert = -1;

    //}}EFSWizard_Declarations 7225


    function preMain() {
    //{{EFSWizard_Code_PreMain_setPriceBarColor
    setColorPriceBars(true);
    //}}EFSWizard_Code_PreMain_setPriceBarColor 3448
    /**
    * This function is called only once, before any of the bars are loaded.
    * Place any study or EFS configuration commands here.
    */
    //{{EFSWizard_PreMain
    setPriceStudy(true);
    setStudyTitle("donchian test");
    setCursorLabelName("UP", 0);
    setCursorLabelName("DN", 1);
    setDefaultBarStyle(PS_SOLID, 0);
    setDefaultBarStyle(PS_SOLID, 1);
    setDefaultBarFgColor(Color.lightgrey, 0);
    setDefaultBarFgColor(Color.lightgrey, 1);
    setDefaultBarThickness(1, 0);
    setDefaultBarThickness(1, 1);
    setPlotType(PLOTTYPE_LINE, 0);
    setPlotType(PLOTTYPE_LINE, 1);
    //}}EFSWizard_PreMain 53624

    }

    function main() {
    /**
    * The main() function is called once per bar on all previous bars, once per
    * each incoming completed bar, and if you don't have 'setComputeOnClose(true)'
    * in your preMain(), it is also called on every tick.
    */

    //{{EFSWizard_Expressions
    //{{EFSWizard_Expression_1
    if (
    high() > vDonchian.getValue(DonchianStudy.UPPER)
    ) onAction1()
    //}}EFSWizard_Expression_1 10577

    //{{EFSWizard_Expression_2
    else if (
    low() < vDonchian.getValue(DonchianStudy.LOWER)
    ) onAction2()
    //}}EFSWizard_Expression_2 12043

    //{{EFSWizard_Expression_3
    else if (
    1 == 1
    ) onAction3();
    //}}EFSWizard_Expression_3 6846

    //}}EFSWizard_Expressions 58387


    //{{EFSWizard_Return
    return new Array(
    vDonchian.getValue(DonchianStudy.UPPER),
    vDonchian.getValue(DonchianStudy.LOWER)
    );
    //}}EFSWizard_Return 15590

    }

    function postMain() {
    /**
    * The postMain() function is called only once, when the EFS is no longer used for
    * the current symbol (ie, symbol change, chart closing, or application shutdown).
    */
    }

    //{{EFSWizard_Actions
    //{{EFSWizard_Action_1
    function onAction1() {
    if (vLastAlert != 1) Alert.playSound("C:\\Program Files\\eSignal\\Sounds\\Ding.wav");
    setPriceBarColor(Color.RGB(0,255,0));
    if (vLastAlert != 1) Alert.addToList(getSymbol(), "Highest High", Color.black, Color.green);
    vLastAlert = 1;
    }
    //}}EFSWizard_Action_1 36685

    //{{EFSWizard_Action_2
    function onAction2() {
    if (vLastAlert != 2) Alert.playSound("C:\\PROGRAM FILES\\ESIGNAL\\Sounds\\Ding.wav");
    setPriceBarColor(Color.RGB(255,0,0));
    if (vLastAlert != 2) Alert.addToList(getSymbol(), "Lowest Low", Color.blue, Color.red);
    vLastAlert = 2;
    }
    //}}EFSWizard_Action_2 35124

    //{{EFSWizard_Action_3
    function onAction3() {
    setPriceBarColor(Color.RGB(0,0,0));
    vLastAlert = 3;
    }
    //}}EFSWizard_Action_3 10592

    //}}EFSWizard_Actions 113066

    Comment


    • #3
      Alex;
      I deleted lines 90 and 99 as you suggested but all my candlesticks are now black in color. Is there a way to change them back to green and red candlesticks? Also, I don't want 2,1 on the Donchian settings, I want 3,0 but when I change it, it doesn't work. Can that be changed also?
      Thanks Greg

      Comment


      • #4
        Greg

        I deleted lines 90 and 99 as you suggested but all my candlesticks are now black in color. Is there a way to change them back to green and red candlesticks?
        I am assuming that you are referring to the [red and green] candlesticks painted by the chart rather than the efs? In that case using the Fomula Wizard just remove Set3 which will also remove the setColorPriceBars(true) statement from preMain. Note that once you have made this modification [and saved the efs] you will probably need to remove and then reapply the formula to the chart for the change to take effect

        Also, I don't want 2,1 on the Donchian settings, I want 3,0 but when I change it, it doesn't work. Can that be changed also?
        I am assuming that by "it doesn't work" you mean that no alerts are triggered? If that is the case then the reason is that once you remove the offset [which displaces the study forward ie to the right] the study includes the most recent bar in its current values. By definition then the current High can never be higher than the current upper Donchian Channel and the current Low can never be lower than the current lower Donchian Channel hence the conditions never evaluate to true and do not trigger any alerts.
        You either need to displace the Donchian Channel forward by 1 bar ie (3,1) or change the conditions to evaluate the Donchian Channel at the prior bar ie vDonchian.getValue(DonchianStudy.UPPER,-1) etc which is in effect the same thing
        Alex


        Originally posted by gwika
        Alex;
        I deleted lines 90 and 99 as you suggested but all my candlesticks are now black in color. Is there a way to change them back to green and red candlesticks? Also, I don't want 2,1 on the Donchian settings, I want 3,0 but when I change it, it doesn't work. Can that be changed also?
        Thanks Greg

        Comment

        Working...
        X