Announcement

Collapse
No announcement yet.

Wow the Add bar works, One more question

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

  • Wow the Add bar works, One more question

    Thanks Alex for the help. The only thing left is I can't seem to figure out where to put the bar thickness and colors for the 4 new bars that stay on top of background bars. Any answer on this?
    Below is the fixed EFS with correct bar on top formula.

    var study = new StochStudy(14, 3, 3);

    function preMain()
    {
    setStudyTitle("Test Stoch 14,3,3 75,85,25,35");

    setCursorLabelName("% K",0);
    setCursorLabelName("% D",1);

    setDefaultBarFgColor(Color.lime, 0); // %K
    setDefaultBarFgColor(Color.red, 1); // %D

    setDefaultBarThickness(3,0)
    setDefaultBarThickness(3,1)


    setPlotType(PLOTTYPE_INSTANTCOLORLINE);
    setStudyMin(10);
    setStudyMax(85);
    }

    function main()
    {
    var vFAST = study.getValue(StochStudy.FAST);
    var vSLOW = study.getValue(StochStudy.SLOW);
    var UpBand1 = 80;
    var UpBand2 = 70;
    var DnBand1 = 20;
    var DnBand2 = 30;

    if((vFAST > vSLOW) && (vFAST > 70 )) //Entry to a long
    {
    setBarBgColor(Color.green);
    }
    else if((vSLOW > vFAST) && (vSLOW > 80)) //Exit from a long
    {
    setBarBgColor(Color.green);
    }
    else if((vFAST > vSLOW) && (vSLOW < 20 )) //Exit from short level
    {
    setBarBgColor(Color.maroon);
    }
    else if((vSLOW > vFAST) && (vSLOW < 30))//Entry to short level
    {
    setBarBgColor(Color.maroon);
    }



    return new Array (vFAST, vSLOW, UpBand1, UpBand2, DnBand1, DnBand2);

    }

  • #2
    Earl
    Here is your formula with the necessary addition. Default color and thickness are yellow and 1 respectively.
    Alex

    PHP Code:
    var study = new StochStudy(1433);

    function 
    preMain() 
    {
    setStudyTitle("Test Stoch 14,3,3 75,85,25,35");

    setCursorLabelName("% K",0);
    setCursorLabelName("% D",1);

    setDefaultBarFgColor(Color.lime0); // %K
    setDefaultBarFgColor(Color.red1); // %D

    setDefaultBarThickness(3,0)
    setDefaultBarThickness(3,1)

    setDefaultBarFgColor(Color.yellow2);
    setDefaultBarFgColor(Color.yellow3);
    setDefaultBarFgColor(Color.yellow4);
    setDefaultBarFgColor(Color.yellow5);
    setDefaultBarThickness(1,2);
    setDefaultBarThickness(1,3);
    setDefaultBarThickness(1,4);
    setDefaultBarThickness(1,5);

    setPlotType(PLOTTYPE_INSTANTCOLORLINE);
    setStudyMin(10);
    setStudyMax(85);
    }

    function 
    main() 
    {
    var 
    vFAST study.getValue(StochStudy.FAST);
    var 
    vSLOW study.getValue(StochStudy.SLOW);
    var 
    UpBand1 80;
    var 
    UpBand2 70;
    var 
    DnBand1 20;
    var 
    DnBand2 30;

    if((
    vFAST vSLOW) && (vFAST 70 )) //Entry to a long
    {
    setBarBgColor(Color.green);

    else if((
    vSLOW vFAST) && (vSLOW 80)) //Exit from a long
    {
    setBarBgColor(Color.green);

    else if((
    vFAST vSLOW) && (vSLOW 20 )) //Exit from short level
    {
    setBarBgColor(Color.maroon);

    else if((
    vSLOW vFAST) && (vSLOW 30))//Entry to short level

    setBarBgColor(Color.maroon);
    }



    return new Array (
    vFASTvSLOWUpBand1UpBand2DnBand1DnBand2);


    Comment

    Working...
    X