Announcement

Collapse
No announcement yet.

Multiple studies in one pane with space between each study

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

  • Multiple studies in one pane with space between each study

    Hello All...

    Is there any efs code which allows a space between studies in one pane?

    Like below code, add ADX and Stoch but have them separated in one pane.


    Below code joins the two studies together overlapped; not separated.
    Code:
    var study1 = new ADXDMStudy(14, 14);
    var study2 = new StochStudy(14, 3, 3);
    
    function preMain() {
    
    setStudyTitle("Joined ADX and Stochastic");
    
    setCursorLabelName("AMX",0);
    setCursorLabelName("AMX+",1);
    setCursorLabelName("AMX-",2);
    setCursorLabelName("K%",3);
    setCursorLabelName("D%",4);
    
    setStudyMin(0);
    setStudyMax(100);
    
    setDefaultBarFgColor(Color.yellow, 0); // ADX
    setDefaultBarFgColor(Color.blue, 1); // PDI
    setDefaultBarFgColor(Color.red, 2); // NDI
    setDefaultBarFgColor(Color.blue, 3); // %K
    setDefaultBarFgColor(Color.red, 4); // %D
    
    setDefaultBarThickness(3,0);
    setDefaultBarThickness(3,1);
    setDefaultBarThickness(3,2);
    setDefaultBarThickness(3,3);
    setDefaultBarThickness(3,4);
    }
    
    function main() {
    var vADX = study1.getValue(ADXDMStudy.ADX);
    var vPDI = study1.getValue(ADXDMStudy.PDI);
    var vNDI = study1.getValue(ADXDMStudy.NDI);
    var vFast = study2.getValue(StochStudy.FAST);
    var vSlow = study2.getValue(StochStudy.SLOW);
    
    return new Array(vADX, vPDI, vNDI,vFast, vSlow);
    //    return new Array(getSeries( study1 ), getSeries( study2 ) );
    }

  • #2
    VSAtrader
    There isn’t a function that will do that if that is what you are asking.
    That said with some studies it can easily be accomplished by displacing the study vertically using simple math in essence plotting them in a different range of the scale.
    In your specific example you could subtract 100 from the Stochastic %K and %D thereby forcing them to plot in the range between -100 [which would be the natural 0] and 0 [which would be the natural 100] which is essentially what the Williams' %R does. Since the ADX never goes below 0 the two would never encroach on each other (see image enclosed below). Note that in the study you posted you will also need to remove or revise the study max and min set in preMain.
    Alex




    Originally posted by VSAtrader View Post
    Hello All...

    Is there any efs code which allows a space between studies in one pane?

    Like below code, add ADX and Stoch but have them separated in one pane.


    Below code joins the two studies together overlapped; not separated.
    Code:
    var study1 = new ADXDMStudy(14, 14);
    var study2 = new StochStudy(14, 3, 3);
    
    function preMain() {
    
    setStudyTitle("Joined ADX and Stochastic");
    
    setCursorLabelName("AMX",0);
    setCursorLabelName("AMX+",1);
    setCursorLabelName("AMX-",2);
    setCursorLabelName("K%",3);
    setCursorLabelName("D%",4);
    
    setStudyMin(0);
    setStudyMax(100);
    
    setDefaultBarFgColor(Color.yellow, 0); // ADX
    setDefaultBarFgColor(Color.blue, 1); // PDI
    setDefaultBarFgColor(Color.red, 2); // NDI
    setDefaultBarFgColor(Color.blue, 3); // %K
    setDefaultBarFgColor(Color.red, 4); // %D
    
    setDefaultBarThickness(3,0);
    setDefaultBarThickness(3,1);
    setDefaultBarThickness(3,2);
    setDefaultBarThickness(3,3);
    setDefaultBarThickness(3,4);
    }
    
    function main() {
    var vADX = study1.getValue(ADXDMStudy.ADX);
    var vPDI = study1.getValue(ADXDMStudy.PDI);
    var vNDI = study1.getValue(ADXDMStudy.NDI);
    var vFast = study2.getValue(StochStudy.FAST);
    var vSlow = study2.getValue(StochStudy.SLOW);
    
    return new Array(vADX, vPDI, vNDI,vFast, vSlow);
    //    return new Array(getSeries( study1 ), getSeries( study2 ) );
    }

    Comment

    Working...
    X