Announcement

Collapse
No announcement yet.

MA of ECO

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

  • MA of ECO

    Hi

    How can I add a MA as qualifier (cossing points) on the ECO (Blau`s Ergodic Candlestick Oscillator)? I found this study at



    Markus

  • #2
    Hi Markus,

    Please try the following code and let me know if you have any further questions or require additional assistance.

    Regards,
    Andy

    Code:
    /************************************************
    Provided By	: TS Support, LLC for eSignal. (c) Copyright 2002  
    *************************************************/
    
    function preMain()
    {
        setStudyTitle("Blau's Candlestick Indicator"); 
        setCursorLabelName("Blau's Candlestick Indicator",0);
        setCursorLabelName("Signal Line",0);
        setDefaultBarFgColor(Color.red,0);
        setDefaultBarFgColor(Color.blue,1);
        addBand(0, PS_SOLID, 1, Color.black);
    
    }
    var EMA_1 = 0;
    var EMA1_1 = 0;
    var vEMA_1 = 0;
    var vEMA1_1 = 0;
    var sgn_1 = 0;
    
    function main(r,s,signal)
    {
    	if (r == null)
    		r = 32;
    	if(s == null)
    		s = 12;
    	if(signal == null)
    		signal = 9;
    		
       
    	var K = 2 / (r + 1); 
    	var K1 = 2 / (s + 1); 
    	var K2 = 2 / (signal + 1)
       
    	EMA = K * (close() - open()) + (1 - K) * EMA_1;
        	EMA1 = K1 * EMA + (1 - K1) * EMA1_1;
    	vEMA = K * (high() - low()) + (1 - K) * vEMA_1;
        	vEMA1 = K1 * vEMA + (1 - K1) * vEMA1_1;
        	if (getBarState() == BARSTATE_NEWBAR){
    		EMA_1 = EMA;
    		EMA1_1 = EMA1;
    		vEMA_1 = vEMA;
    		vEMA1_1 = vEMA1;
    	}		
    	if(vEMA1 != 0){
    		sgn = K2 * EMA1 / vEMA1 + (1 - K2) * sgn_1;
    		if (getBarState() == BARSTATE_NEWBAR)
    			sgn_1 = sgn;
    		return new Array(EMA1 / vEMA1,sgn);
    	}
    	else
    		return;
    }

    Comment


    • #3
      Color of ECO's Signal line

      I'd like to see turns in the Signal line much easier.

      Can you add some code in there to color the Signal line green if higher than the previous bar, and red if lower than the previous bar?

      OR

      Can you draw a green circle around the Signal line when it is higher than the previous bar; red circle if lower?

      Any of these two options will help to easily identify the turning of the Signal line.

      Thanks.

      Comment


      • #4
        wavetrader
        First of all the code posted in the prior message for Blau's ECO needed to be revised as it was working correctly only when first loaded on a chart.
        In the following image the lower indicator window shows what would eventually happen to the plot when running the efs in real time. The upper indicator window shows the plot of the efs after the necessary revisions



        You may want to open the efs with the Editor to see what changes were implemented.
        Also added to the attached efs is the condition to paint the signal line in green when it is rising
        Hope this helps
        Alex

        Attached Files

        Comment


        • #5
          Thanks Alexis.

          And I'll take a look at the efs too. I guess it will be time well spent learning how to apply any fixes to efs "drifts" in the future.

          It would be nice if there was any documentation for this in an EFS development guide.

          Comment


          • #6
            I have downloaded the .efs but am getting errors when i try to use it. As i'm a newbie at this i'm not sure where to even start. Does the code need to be converted to the new format or should the old code still work.

            thanks.

            Comment


            • #7
              brightstar
              I just downloaded the efs and as far as I can see it is working fine.
              Can you provide some more details as to what you did to download it, where you saved it what symbol and interval you are using, what version of the software (including build), etc.
              Alex

              Comment

              Working...
              X