Jump to content

meomel

Members
  • Posts

    6
  • Joined

  • Last visited

Posts posted by meomel

  1. Mov Avg 3 lines:

    inputs:

    UpColor(green),

    DwnColor(red),

    flatcolor(white),

    Price( Close ),

    FastLength( 4 ),

    MedLength( 9 ),

    SlowLength( 18 ),

    Displace( 0 ) ;

     

    variables:

    FastAvg( 0 ),

    MedAvg( 0 ),

    SlowAvg( 0 ) ;

     

    FastAvg = AverageFC( Price, FastLength ) ;

    MedAvg = AverageFC( Price, MedLength ) ;

    SlowAvg = AverageFC( Price, SlowLength ) ;

     

    if Displace >= 0 or CurrentBar > AbsValue( Displace ) then

    begin

     

     

    Plot1[Displace]( FastAvg, "FastAvg" ) ;

    Plot2[Displace]( MedAvg, "MedAvg" ) ;

    Plot3[Displace]( SlowAvg, "SlowAvg" ) ;

     

    If FastAvg>FastAvg[1] then begin

    plot1[1](FastAvg[1],"FastAvg",upcolor);

    plot1(FastAvg,"FastAvg",upcolor);

    end else begin

    If FastAvg=FastAvg[1] then begin

    plot1[1](FastAvg[1],"FastAvg",flatcolor);

    plot1(FastAvg,"FastAvg",flatcolor);

    end else begin

    plot1[1](FastAvg[1],"FastAvg",dwncolor);

    plot1(FastAvg,"FastAvg",dwncolor);

    end;

    end;

     

     

     

    { Alert criteria }

    if Displace <= 0 then

    begin

    Condition1 = Price > FastAvg and FastAvg > MedAvg and MedAvg > SlowAvg ;

    if Condition1 and Condition1[1] = false then

    Alert( "Bullish alert" )

    else

    begin

    Condition2 = Price < FastAvg and FastAvg < MedAvg and MedAvg < SlowAvg ;

    if Condition2 and Condition2[1] = false then

    Alert( "Bearish alert" ) ;

    end ;

    end ;

    end ;

  2. Stochastic slow code:

     

    inputs:

    PriceH( High ),

    PriceL( Low ),

    PriceC( Close ),

    UpColor(green),

    DwnColor(red),

    StochLength( 5 ),

    SmoothingLength1( 2 ), { used to slow FastK to FastD = SlowK }

    SmoothingLength2( 3 ), { used to slow FastD to SlowD }

    SmoothingType( 1 ), { pass in 1 for Original, 2 for Legacy }

    OverSold( 20 ),

    HorLine( 50 ),

    OverBought( 80 ) ;

     

    variables:

    oFastK( 0 ),

    oFastD( 0 ),

    oSlowK( 0 ),

    oSlowD( 0 ) ;

     

    Value1 = Stochastic( PriceH, PriceL, PriceC, StochLength, SmoothingLength1, SmoothingLength2,

    SmoothingType, oFastK, oFastD, oSlowK, oSlowD ) ;

     

     

    Plot1( oSlowK, "SlowK" ) ;

    Plot2( oSlowD, "SlowD" );

    Plot3( OverBought, "OverBot" ) ;

    Plot4( OverSold, "OverSld" ) ;

    Plot5( HorLine, "HorLne" ) ;

     

     

    If oSlowD>oSlowD[1] then begin

    plot2[1](oSlowD[1],"SlowD",upcolor);

    plot2(oSlowD,"SlowD",upcolor);

    end else begin

    plot2[1](oSlowD[1],"SlowD",dwncolor);

    plot2(oSlowD,"SlowD",dwncolor);

    end;

     

     

    { Alert criteria }

    if CurrentBar > 2 then

    begin

    if oSlowK crosses over oSlowD and oSlowK < OverSold then { CB > 2 check used to

    avoid spurious cross confirmation at CB = 2 (at CB = 1, MySlowK and MySlowD will

    be the same) }

    Alert( "SlowK crossing over SlowD" )

    else if oSlowK crosses under oSlowD and oSlowK > OverBought then

    Alert( "SlowK crossing under SlowD" ) ;

    end ;

  3. MACD code:

     

    inputs:

    FastLength( 5 ),

    SlowLength( 20 ),

    MACDLength( 30 ),

    UpColor(magenta),

    DwnColor(White),

    flColor(red),

    MomUpColor(green),

    MomDwnColor(red) ;

     

     

     

    variables:

    MyMACD( 0 ),

    MACDAvg( 0 ),

    MACDDiff( 0 ) ;

     

     

     

    MyMACD = MACD( Close, FastLength, SlowLength ) ;

    MACDAvg = XAverage( MyMACD, MACDLength ) ;

    MACDDiff = MyMACD - MACDAvg ;

     

     

     

     

    Plot1( MyMACD, "MACD" ) ;

    Plot2( MACDAvg, "MACDAvg" ) ;

    Plot3( MACDDiff, "MACDDiff" ) ;

    Plot4( 0, "ZeroLine" ) ;

     

     

     

    If MACDAvg>MACDAvg[1] then begin

    plot2[1](MACDAvg[1],"MACDAvg",upcolor);

    plot2(MACDAvg,"MACDAvg",upcolor);

    end else begin

    plot2[1](MACDAvg[1],"MACDAvg",dwncolor);

    plot2(MACDAvg,"MACDAvg",dwncolor);

    end;

     

    If MyMACD>MyMACD[1] then begin

    plot1[1](MyMACD[1],"MACD",MOMupcolor);

    plot1(MyMACD,"MACD",MOMupcolor);

    end else begin

    plot1[1](MyMACD[1],"MACD",MOMdwncolor);

    plot1(MyMACD,"MACD",MOMdwncolor);

    end;

     

    { Alert criteria }

    if MACDDiff crosses over 0 then

    Alert( "Bullish alert" )

    else if MACDDiff crosses under 0 then

    Alert( "Bearish alert" ) ;

×
×
  • Create New...