Rank: Advanced Member
Groups: Registered, Registered Users Joined: 1/1/2006(UTC) Posts: 39
|
This is the code from Equis' Metastock's Traders' Tips from TASC Magazine for the Laguerre Filter:
g:=0.8;
L0:=((1-g)*MP()) + (g*PREV);
L1:=(-g*L0) + Ref(L0,-1) + (g*PREV);
L2:=(-g*L1) + Ref(L1,-1) + (g*PREV);
L3:=(-g*L2) + Ref(L2,-1) + (g*PREV);
(L0 + (2*L1) + (2*L2) + L3)/6
This will basically move above or below the price, and in addition, it has a problem in term of its visual location and its true value.
However, if you look at the Laguerre indicator that I have included in the chart (this chart is not Metastock -- for those curious enough), you will notice that it behaves quite differently. In this chart you can see that movements below 0.75 are good to sell and movements above 0.15 are good to buy.
Now, the one that works real nice is itrend. Whenever, the green line is above the zero line, then you go in, and when the red line is above the zero line, you get out.
Both of them together confirm the move, but itrend is usually first.
These are two of the indicators that I have been trying to find here at the forum, but so far no luck.
Here is the code for itrend, in case anyone wants to try to give it a go with Metastock:
/+------------------------------------------------------------------+
//| iTrend.mq4 |
//| Copyright © 2004, MetaQuotes Software Corp. |
//| http://www.metaquotes.net |
//+------------------------------------------------------------------+
#property copyright "Copyright © 2004, MetaQuotes Software Corp."
#property link "http://www.metaquotes.net"
#property indicator_separate_window
#property indicator_buffers 2
#property indicator_color1 LimeGreen
#property indicator_color2 Red
//---- input parameters
extern int Bands_Mode_0_2=0; // =0-2 MODE_MAIN, MODE_LOW, MODE_HIGH
extern int Power_Price_0_6=0; // =0-6 PRICE_CLOSE,PRICE_OPEN,PRICE_HIGH,PRICE_LOW,PRICE_MEDIAN,PRICE_TYPICAL,PRICE_WEIGHTED
extern int Price_Type_0_3=0; // =0-3 PRICE_CLOSE,PRICE_OPEN,PRICE_HIGH,PRICE_LOW
extern int Bands_Period=20;
extern int Bands_Deviation=2;
extern int Power_Period=13;
extern int CountBars=300;
//---- buffers
double value[];
double value2[];
//+------------------------------------------------------------------+
//| Custom indicator initialization function |
//+------------------------------------------------------------------+
int init()
{
// string short_name;
//---- indicator line
IndicatorBuffers(2);
SetIndexStyle(0,DRAW_LINE);
SetIndexStyle(1,DRAW_LINE);
SetIndexBuffer(0,value);
SetIndexBuffer(1,value2);
//----
//----
return(0);
}
//+------------------------------------------------------------------+
//| Trend |
//+------------------------------------------------------------------+
int start()
{
SetIndexDrawBegin(0,Bars-CountBars+Bands_Period+1);
SetIndexDrawBegin(1,Bars-CountBars+Bands_Period+1);
int i,CurrentBar,Bands_Mode,counted_bars=IndicatorCounted();
double Power_Price,CurrentPrice;
//----
if(Bars<=Bands_Period) return(0);
//---- initial zero
if(counted_bars<Bands_Period)
{
for(i=1;i<=Bands_Period;i++) value[Bars-i]=0.0;
for(i=1;i<=Bands_Period;i++) value2[Bars-i]=0.0;
}
//----
i=CountBars-Bands_Period-1;
// if(counted_bars>=Bands_Period) i=Bars-counted_bars-1;
if (Bands_Mode_0_2==1) Bands_Mode=MODE_LOW;
if (Bands_Mode_0_2==2) Bands_Mode=MODE_HIGH;
if (Bands_Mode_0_2==0) Bands_Mode=MODE_MAIN;
if (Power_Price_0_6==1) Power_Price=PRICE_OPEN;
if (Power_Price_0_6==2) Power_Price=PRICE_HIGH;
if (Power_Price_0_6==3) Power_Price=PRICE_LOW;
if (Power_Price_0_6==4) Power_Price=PRICE_MEDIAN;
if (Power_Price_0_6==5) Power_Price=PRICE_TYPICAL;
if (Power_Price_0_6==6) Power_Price=PRICE_WEIGHTED;
if (Power_Price_0_6==6) Power_Price=PRICE_CLOSE;
for (i=CountBars-1; i>=0; i--)
{
if (Price_Type_0_3==1) CurrentPrice=Open ;
if (Price_Type_0_3==2) CurrentPrice=High;
if (Price_Type_0_3==3) CurrentPrice=Low;
if (Price_Type_0_3==0) CurrentPrice=Close;
value=CurrentPrice-iBands(NULL,0,Bands_Period,Bands_Deviation,0,Bands_Mode,Power_Price,i);
value2=-(iBearsPower(NULL,0,Power_Period,Power_Price,i)+iBullsPower(NULL,0,Power_Period,Power_Price,i));
}
return(0);
}
//+------------------------------------------------------------------+
|