Re: MT4 Indicator requests and ideas

18706
wugsie wrote: Fri Jun 09, 2023 5:56 am Please do you have VIX Volatility Extreme Indicator?
How are you, my friend? I guess it refers to the paid indicator of the same name. frankly, I imagine a Waddah Attrar Explosion could do the same job for bands and volume. but if you wanted something specific in VIX, you can get it here on the forum.
These users thanked the author RodrigoRT7 for the post:
wugsie
Rating: 0.6%

Re: MT4 Indicator requests and ideas

18708

Code: Select all

/*************************************** 
 Solar Wind Joy Translated from MT4 to Amibroker 
 heavily modified by trash to significantly improve speed of original code by KelvinHand
 origins from http://www.traderji.com/amibroker/98121-convert-solar-wind-joy-mt4-indicator-afl-2.html 
****************************************/
Version( 5.90 );

period = Param( "Period", 35, 1 );
smooth = Param( "Smoothing period", 10, 1 );

//---- mod by trash start
// using AMA2 -> huge speed up by using array instead of loop
function aFishFunc( period ) {
    MaxH = HHV( H, period );
    MinL = LLV( L, period );
    midbar = ( H + L ) / 2;
    
    array1  = 2 * ( ( midbar - MinL ) / ( MaxH - MinL + 1e-30 ) - 0.5 );
    Value = AMA2( array1, 0.33, 0.67 );
    Value = Min( Max( Value, -0.999 ), 0.999 );

    array2 = log( ( 1 + Value ) / ( 1 - Value ) );
    aFish = AMA2( array2, 0.5, 0.5 );
    return IIf( aFish > 0, 10, -10 );
}

function VarSum( per ) {
    result = per;
    for( i = 1; i < per; i++ )
        result += per - i;
    return result;
}

// two times used average calculation put to function
function cAverage( array, period ) {
    bi = BarIndex();
    if( Status( "action" ) == actionIndicator ) {
        startbar = Max( period, FirstVisibleValue( bi ) - period );
        endbar = LastVisibleValue( bi );
    } else {
        startbar = period;
        endbar = BarCount - 1;
    }
    //
    result = Null;
    for( i = startbar; i <= endbar; i++ ) {
        SumI = 0;
        for( k = 0; k < period; k++ ) {
            weight = period - k;
            SumI += weight * array[i - k];
        }
        result[i] = SumI;
    }
    return result / VarSum( period );
}

aFish = aFishFunc( period );
aLine = cAverage( cAverage( aFish, smooth ), smooth );
// --- mod by trash end


colorH = IIf( aLine > 0, colorBrightGreen, 
         IIf( aLine < 0, colorRed, colorGold ) );
Plot( aLine, "", colorH, stylenolabel | styleHistogram, Null, Null, 0, 0, -30 );

colorL = IIf( /*mod by trash*/Sum(aLine > 0, 2) == 2, colorBrightGreen, 
         IIf( /*mod by trash*/Sum(aLine < 0, 2) == 2, colorRed, colorGold ) );
Plot( aLine, "", colorL, stylenolabel | stylethick );

PlotGrid( 0, colorLightgrey, 6, 1, True );

Title = StrFormat( "{{NAME}} - {{INTERVAL}} - Solar Wind Joy: " +
                   EncodeColor( SelectedValue( ColorL ) ) + "%g", aline );
Please convert back to mt4 thus improved version of solar wind
0 + 0 = 0
Infinite / Infinite = 1
1 way to Heaven & it matters
people only serve God or money coincidence?