[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [amibroker] Blau: TSI & Ergodic Oscillator



PureBytes Links

Trading Reference Links

This is "FOR WHAT IT'S WORTH.

I compared this code with the website, and thought I
spotted a couple of discrepancies.  So I tried to make
code changes to see if I could match things up.  This
is what I came up with.

First, I wanted to plot the various panes, so I
created an <include> file containing the main engine.

Here is the include file
_SECTION_BEGIN("RMO Code");

SwingTrd1 = 100 * (Close - ((MA(C,2)+
MA(MA(C,2),2) +
MA(MA(MA(C,2) ,2),2) +
MA(MA(MA(MA( C,2),2),2) ,2) +
MA(MA(MA(MA( MA(C,2),2) ,2),2),2) +
MA(MA(MA(MA( MA(MA(C,2) ,2),2),2) ,2),2) +
MA(MA(MA(MA( MA(MA(MA( C,2),2),2) ,2),2),2) ,2)+
MA(MA(MA(MA( MA(MA(MA( MA(C,2),2) ,2),2),2) ,2),2),2)
+
MA(MA(MA(MA( MA(MA(MA( MA(MA(C,2) ,2),2),2) ,2),2),2)
, 2),2)+
MA(MA(MA(MA( MA(MA(MA( MA(MA(MA( C,2),2),2) ,2),2),2)
, 2),2),2),2))
/10))/(HHV(C, 10)-LLV(C, 10));

SwingTrd2 = EMA(SwingTrd1, 30);
SwingTrd3 = EMA(SwingTrd2, 30);
RMO= EMA(SwingTrd1, 81);

BuyAlert = Cross(SwingTrd2 ,SwingTrd3) ; // Start of
blue bars
SellAlert = Cross(SwingTrd3,SwingTrd2) ; // start of
red bars

Bull_Trend = RMO > 0;
Bear_Trend = RMO < 0;
Medium_Up_Trend = SwingTrd2 >= 0;
Medium_Down_Trend = SwingTrd2 < 0;

bar_color=IIf(Medium_Up_Trend , colorLightBlue,
colorRed);
Ribbon_color=IIf( Bull_Trend, colorGreen,
IIf(Bear_Trend, colorRed,
colorBlack)) ;

shape = BuyAlert * shapeUpArrow + SellAlert *
shapeDownArrow;

_SECTION_END();

Then the top indicator, would be:

_SECTION_BEGIN("RMO Sentiment 1 Indicator");
#include <RMO Code.afl>;
Plot(RMO,"SwTr1",colorBrightGreen,styleHistogram|styleThick);
_SECTION_END();

The next indicator, the pink and purple one, is

_SECTION_BEGIN("RMO Sentiment 2&3 Indicator");

#include <RMO Code.afl>;

Plot(SwingTrd3,"SwTr3 -
Long",ColorRGB(153,51,153),styleHistogram);
Plot(SwingTrd2,"SwTr2 -
Mid",colorPink,styleHistogram|styleThick);

_SECTION_END();

and finally, the price screen would be...

_SECTION_BEGIN( "RMO Plots");

#include <RMO Code.afl>;

Plot(4, "", Ribbon_color, styleOwnScale| styleArea|
styleNoLabel,
-0.5,100);
Plot(C,"",bar_color,1|styleBar| styleThick);
PlotShapes( shape, IIf( BuyAlert ,
ColorRGB(210,0,210), colorPink ),0, IIf( BuyAlert ,
Low,
High ) );
GraphXSpace = 15;
Buy = BuyAlert AND (Medium_Up_Trend + Bull_Trend) >=1;
Sell = SellAlert AND (Medium_Down_Trend + Bear_Trend)
>=1;
Filter = Buy OR Sell;
AddColumn(IIf( Buy,66,IIf( Sell,83,32) ),"Hits",
formatChar,
colorWhite, bkcolor =IIf(Buy, colorGreen,IIf(
Sell,colorRed, colorDefault) ));

WriteIf(Medium_Up_Trend> 0,"Medium Trend is
UP","Medium Trend is DOWN");
WriteIf(BuyAlert,"Buy Alert - " +
WriteIf(Bull_Trend,"and RMO is positive",
   "BUT RMO is negative"),"");
WriteIf(BuyAlert,"Best with Blue bar","");
WriteIf(SellAlert,"Sell Alert - " +
WriteIf(Bull_Trend,"and RMO is negative",
   "BUT RMO is positive"),"");
WriteIf(SellAlert,"Best with Red bar","");
_SECTION_END();

I added some commentary things to help me remember
what I am looking at.

There is a swing pane too - but there is no
explanation of what this is.

I would appreciate any comments.

Rick
--- Larry <rayman@xxxxxxxxxxxxxx> wrote:

> Hi there, 
> 
> I came across the above indicator at
> www.amibrokerfan.com (forum).
> 
> I found it useful as an indicator but I was
> wondering if it can be turned into a scanner also 
> with the inclusion of buy and sell signals. I am not
> sure but I think a buy signal is when 
> the signal line crosses above the Ergodic
> Oscillator. Could someone please help with the 
> necessary codes.
> 
> I reproduce the original code below for your easy
> reference.
> 
> Thank you.
> Larry
> 
> //  Blau: TSI & Ergodic Oscillator
> 
> Len_r = Param( "TSI period 'r':", 32 , 1 , 100 );
> Len_s = Param( "TSI period 's':", 5 , 1 , 100 );
> Len_5 =  5 ;
> 
> Mtm = C - Ref ( C, -1 );
> AbsMtm = abs ( Mtm );
> //===============================
> Num_T = EMA ( EMA ( Mtm, Len_r ), Len_s );
> Den_T = EMA ( EMA ( AbsMtm, Len_r ), Len_s );
> 
> TSI = 100 * Nz ( Num_T / Den_T );
> //===============================
> Num_E = EMA ( EMA ( Mtm, Len_r ), Len_5 );
> Den_E = EMA ( EMA ( AbsMtm, Len_r ), Len_5 );
> 
> Ergodic = 100 * Nz ( Num_E / Den_E );
> SigLin = EMA ( Ergodic, Len_5 );
> //===============================
> GraphXSpace = 2 ;
> //Plot( TSI, "TSI",  colorGreen,    styleLine );
> ErgCol = colorBlue ;
> Plot( Ergodic, "Ergodic Osc.",  ErgCol,    styleLine
> );
> Plot( SigLin, "",  colorDarkYellow,  styleLine );
> //===============================
> Hist = Ergodic - SigLin;
> HistCol = IIf ( Hist>= 0, colorGreen, colorRed );
> Plot(Hist, "Histogram", HistCol, styleHistogram |
> styleThick | 
> styleNoLabel );
> //===============================
> Title = EncodeColor( colorDarkBlue ) + FullName() +
> "   [" + Name() + "]    
> " + 
> EncodeColor( colorDarkGrey ) + WriteVal( DateTime(),
> formatDateTime ) + 
> "\n" + 
> EncodeColor( colorBrown ) + "Blau: The Ergodic
> Oscillator, EO(" + 
> EncodeColor( ErgCol ) + "r" + EncodeColor(
> colorBrown ) + ",5,5 )   " + 
> EncodeColor( ErgCol ) + "r_Pds: " + Len_r + 
> EncodeColor( colorGrey40 ) + "  (Adjustable).";
> //===============================
>  
> 


Rick Osborn & Associates
885 Sorrento Ave.
Oshawa, Ontario L1J 6V6
(905) 728-8543  fax 728-0815



Please note that this group is for discussion between users only.

To get support from AmiBroker please send an e-mail directly to 
SUPPORT {at} amibroker.com

For NEW RELEASE ANNOUNCEMENTS and other news always check DEVLOG:
http://www.amibroker.com/devlog/

For other support material please check also:
http://www.amibroker.com/support.html
 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/amibroker/

<*> Your email settings:
    Individual Email | Traditional

<*> To change settings online go to:
    http://groups.yahoo.com/group/amibroker/join
    (Yahoo! ID required)

<*> To change settings via email:
    mailto:amibroker-digest@xxxxxxxxxxxxxxx 
    mailto:amibroker-fullfeatured@xxxxxxxxxxxxxxx

<*> To unsubscribe from this group, send an email to:
    amibroker-unsubscribe@xxxxxxxxxxxxxxx

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/