AFL required

mmca2006

Active Member
#1
Can any body provide an AFL for the following metastock expert , found it from website of E q u I s based on Trix ( MetaStock Tips & Tricks > 2004 > When and When not to Trade) --

Code:
Gold Cross(GC)=

tx:=TRIX(5);
sig:=Mov(tx,3,E);
Cross(tx,sig)


Dead Cross(DC)=

tx:=TRIX(5);
sig:=Mov(tx,3,E);
Cross(sig,tx)

Bounce(B)=

tx:=TRIX(5);
Cross(ROC(tx,1,$),0)


Fall(F)=

tx:=TRIX(5);
Cross(0,ROC(tx,1,$))
Want an AFL with Buy(GC), Sell ( DC), bounce (B) , Fall (F) signal , if possible with exploration also. Please...
 

mmca2006

Active Member
#3
HTML:
tx = Trix(5);
sig = EMA(tx,3);

gc = Cross(tx,sig);
dc = Cross(sig, tx);
bounce = Cross(ROC(tx, 1), 0);
fall = Cross(0, ROC(tx,1));

PlotShapes(IIf(gc==True, shapeSmallUpTriangle, shapeNone), IIf(gc==True, colorBlue, colorDefault), 0, Low, -20);
PlotShapes(IIf(dC==True, shapeSmallDownTriangle, shapeNone), IIf(dC==True, colorRed, colorDefault), 0, High, -20);
PlotShapes(IIf(bounce==True, shapeSmallUpTriangle, shapeNone), IIf(bounce==True, colorSeaGreen, colorDefault), 0, Low, -40);
PlotShapes(IIf(fall==True, shapeSmallDownTriangle, shapeNone), IIf(fall==True, colorOrange, colorDefault), 0, High, -40);
Sir

Requesting to recheck the above AFL of
Code:
bounce=tx:=TRIX(5);
Cross(ROC(tx,1,[B]$[/B]),0)
and
Code:
fall=tx:=TRIX(5);
Cross(0,ROC(tx,1,[B]$[/B]))
because I am getting different result, moreover have seen GC and fall on same bar .
Effect of $ is also not found in above AFL.
I do not know anything about language/ programming.
 
#4
can any body provide AFL for RSI n EMA crosover i mean it should show buy arrow when rsi is abv ema n sell arrow when ema is below rsi.
thanks in advance
 
#5
Hello, reenu10:

I am not an expert, but I created this afl.

I put this afl together with the EMA crossing the RSI.

Note: In the parameter window you can adjust the RSI setting and the moving average.

After you put this indicator on your chart, you will have to left-click on your indicator pane and select "Parameters."

There, you can select the settings for your RSI (the default is 15), and then you will need to choose "RSI" in the "Fields" section of the moving average so the moving average will be on the RSI.

You can also select the colors of your moving average as well as the type of moving average.

There are also green arrows for buy and red for sell.

I am sure someone can make this better, but for now I hope this helps.

brevco

SetChartOptions(0,0,chartGrid30|chartGrid70);
periods = Param( "Periods", 15, 1, 200, 1 );

Plot( RSI( periods), "RSI", ParamColor( "RSI Color", colorBlack ), ParamStyle("Style", styleThick) );

Plot(70,"",colorBlack,styleLine|styleNoLabel);//OS
Plot(30,"",colorDarkGrey,styleLine | styleNoLabel);//OB
Plot(50,"",colorYellow,styleDashed|styleNoLabel);//50 line


_SECTION_BEGIN("Weighted MA Color");

SetChartBkColor( ColorHSB( 86, 36, 126 ) );
P = ParamField("Field");
Type = ParamList("Type", "Weighted,Lagless-21,Hull-26,Linear Regression-45,Exponential,Double Exponential,Tripple Exponential,Wilders,Simple");
Periods = Param("Periods", 9, 2, 100 );
Displacement = Param("Displacement", 1, -50, 50 );
m = 0;

if( Type == "Weighted" ) m= WMA( P, Periods );
if( Type == "Lagless-21" ) m= 2*EMA(P, Periods)-EMA(EMA(P, Periods), Periods);
if( Type == "Hull-26" ) m= WMA(2*(WMA(P, Periods/2))-WMA(P, Periods) ,4 );
if( Type == "Linear Regression-45" ) m= LinearReg( P, Periods );
if( Type == "Exponential" ) m = EMA( P, Periods );
if( Type == "Double Exponential" ) m = DEMA( P, Periods );
if( Type == "Tripple Exponential" ) m = TEMA( P, Periods );
if( Type == "Wilders" ) m = Wilders( P, Periods );
if( Type == "Simple" ) m = MA( P, Periods );


Linecolor = IIf( m > Ref( m, -1), ParamColor("UPColor", colorWhite), ParamColor("DOWNColor", colorBlack) );

Plot( m, _DEFAULT_NAME(),Linecolor , styleThick, 0, 0, Displacement );
_SECTION_END();

Buy = RSI ()> m;
Sell = RSI ()< m;


Buy = ExRem(Buy, Sell);
Sell = ExRem(Sell, Buy);


PlotShapes(IIf(Buy,shapeUpArrow,0) ,colorBrightGreen );
PlotShapes(IIf(Sell,shapeDownArrow,0) ,colorRed);

AlertIf(Buy,"SOUND C:\\Windows\\Media\\tada.wav","Long ");
AlertIf(Sell,"sound C:\\Windows\\media\\tada.wav","sell");
 
#6
thanks brecov for the efforts you put in ,but it is showing an error it says
variable`m' being used without having being initialized......so kindly look into it.
Regards
 
#9
@brevco
hi, could u please make an afl which gives two lines one by joining all highs n another by joining all lows of price.
Regards
 

Similar threads