Announcement

Collapse
No announcement yet.

Need help modifying Fisher.efs

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

  • Need help modifying Fisher.efs

    Need help again, because I simply do not understand the logic behind that language.

    Inthe following efs it is mentioned that:

    "you can create a nearly Gaussian probability density function by normalizing price
    (or an indicator such as RSI) and applying the Fisher Transform."


    So if I want to do that for example with the RSI, how would I need to modify the following original Fisher.efs?

    PHP Code:
    addBand(1.5PS_SOLID2Color.red"1.5");
    addBand(1.38PS_DASH1Color.white"1.38");
    addBand(1.25PS_DASH1Color.white"1.25");
    addBand(1PS_DASH1Color.black"1");
    addBand(.75PS_DASH1Color.yellow".75");
    addBand(.5PS_DASH1Color.white".5");
    addBand(0PS_SOLID2Color.green"0");
    addBand(-.5PS_DASH1Color.white"-.5");
    addBand(-.75PS_DASH1Color.yellow"-.75");
    addBand(-1PS_DASH1Color.black"-1");
    addBand(-1.25PS_DASH1Color.white"-1.25");
    addBand(-1.38PS_DASH1Color.white"-1.38");
    addBand(-1.5PS_SOLID2Color.red"-1.5");


    function 
    preMain(){
        
    setStudyTitle("Ehlers");
        
    setCursorLabelName("Fisher"0);
        
    setCursorLabelName("Trigger"1);
        
    setDefaultBarFgColor(Color.red0);
        
    setDefaultBarFgColor(Color.black1);
        
        var 
    fp01 = new FunctionParameter("Len"FunctionParameter.NUMBER);
        
    fp01.setName("Length");
        
    fp01.setLowerLimit(5);
        
    fp01.setDefault(9);
        
    }
    var 
    Fish 0;
    var 
    Fish_1 0;
    var 
    Value1 0;
    var 
    Value1_1 0;


    function 
    main(Len) {
        if (
    Len == null
            
    Len 9;

        if(
    getBarState() == BARSTATE_NEWBAR) {
            
            
    Fish_1 Fish;
            
    Value1_1 Value1;
        }

        var 
    Price = (high() + low()) / 2;
        var 
    Pricei= (high() + low()) / 2;//added this variable
        
    var MaxH 0;
        var 
    MinL 0;
        var 
    i;
        
    setBarThickness(2,0); 
        
    setBarThickness(2,1); 
        for(
    0Leni++) {
            
    Pricei = (high(-i) + low(-i)) / 2//added this line 
            
    if(== 0){
                
    MaxH Pricei;//changed from: MaxH = high()
                
    MinL Pricei;//changed from: MaxH = low()
            
    }
            else{
                
    MaxH Math.max(MaxHPricei);//changed from: MaxH = Math.max(MaxH, high(-i))
                
    MinL Math.min(MinLPricei);//changed from: MinL = Math.min(MinL, low(-i))
            
    }
        }

        var 
    num1 = (MaxH MinL);
        if (
    num1 <.001)
            
    num1 .001;
        
    Value1 .33 * ((Price MinL) / (num1) - .5) + .67 Value1_1;

        if(
    Value1 .99)
            
    Value1 .999;
        if(
    Value1 < -.99)
            
    Value1 = -.999;
        var 
    num2 = (Value1);
        if (
    num2 <.001)
            
    num2 .001;
        
    Fish .5 Math.log((Value1) / num2) + .5 Fish_1;
        
        
        return new Array(
    Fish,Fish_1);//removed the redundant temp variable, use Fish_1 instead


    Alexis, I know you will help me out, like so many other times.
    Think, it's about time for a bottle of champagne.............

    thank you

  • #2
    Hi muecke,

    I am not Alex, but I figured I could at least point you in the direction of an easier solution using efs2. Please check this fisher efs at the following link.

    FWIW, when posting code, you should post the headers associated with the original efs. That is a courtesy extended to the author of the efs, in addition to making it easier to determine changes made to the original.

    What you could do is pass the RSI to the efsInternal function. You can set that up using the EFS2 Toolbox in the EFS editor.

    As far as understanding the logic behind the language, the JavaScript references in the Knowledgebase are an excellent place to start. Another method that has been helpful to me is use of the EFS2 Toolbox.

    Comment

    Working...
    X