Any kind soul out there that can help me with this?

Indicators coded by community members
Message
Author
leffe
Posts: 1
Joined: Wed Jul 25, 2007 4:13 pm

Any kind soul out there that can help me with this?

#1 Postby leffe » Wed Jul 25, 2007 4:34 pm

Hello guys and galls!

Couple months ago I came across the trendmanager indicator code from
traderstradingsystem, and because the indicator can not be backtested corectly when you only can se the closed candles and that it seems no one have backtested this indicator corectly I wonder if someone with a big heart could help me convert this indicator to forextester.

Very thankfull for any help you can provide.
Kind Regards
Leffe Karlsson


The Metatrader code is shown here under. :arrow:

// Trend Manager.mq4

#property indicator_chart_window
#property indicator_buffers 2
#property indicator_color1 Red
#property indicator_color2 Blue

extern int TM_Period = 7;
extern int TM_Shift = 2;

double SpanA_Buffer[];
double SpanB_Buffer[];
int a_begin;

int init()
{
a_begin=TM_Shift;
SetIndexStyle(0,DRAW_HISTOGRAM,STYLE_SOLID);
SetIndexBuffer(0,SpanB_Buffer);
SetIndexDrawBegin(0,TM_Period+a_begin-1);
SetIndexLabel(0,"TM_Period+");
SetIndexStyle(1,DRAW_HISTOGRAM,STYLE_SOLID);
SetIndexBuffer(1,SpanA_Buffer);
SetIndexDrawBegin(1,TM_Period+a_begin-1);
SetIndexLabel(1,"TM_Period");

return(0);
}

int start()
{
int i,k;
int counted_bars=IndicatorCounted();
double high,low,price;

if(Bars<=TM_Period) return(0);
if(counted_bars<1)
{
for(i=1;i<=TM_Period;i++)
{
SpanA_Buffer[Bars-i]=0;
SpanB_Buffer[Bars-i]=0;
}
}

i=Bars-TM_Period;
if(counted_bars>TM_Period) i=Bars-counted_bars-1;
while(i>=0)
{
high=High[i]; low=Low[i]; k=i-1+TM_Period;
while(k>=i)
{
price=High[k];
if(high<price) high=price;
price=Low[k];
if(low>price) low=price;
k--;
}
SpanA_Buffer[i] = (high+low)/2.0;
SpanB_Buffer[i] = SpanA_Buffer[i+TM_Shift];
i--;
}

return(0);
}

Rmax
Posts: 11
Joined: Sat Jul 28, 2007 4:21 pm

#2 Postby Rmax » Sun Jul 29, 2007 12:01 am

Indicator is attached. I cannot made it looking exactly as in the MetaTrader because of limitation of ForexTester API (I cannot remove lines between neighbor points of each line). But I think this version is usable and you can test it.
Attachments
TrendManager.zip
(38.43 KiB) Downloaded 872 times


Return to “Indicators”

Who is online

Users browsing this forum: No registered users and 14 guests