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

Re: Trendline, in over my head



PureBytes Links

Trading Reference Links

Ara,
I checked the filter, it is ok, the problem is the barssince()
When I replace barssince() with an actual value it works fine, but I 
need the value to vary, thats why I was trying to use the barssince 
so that it would give me varying counts to divide by. Here is an 
example of what did work, maybe someone knows of a different function 
to use other than barssince or a different way to use it.
Below you can see that I removed the (BarsSince(s)-BarsSince(t)) and 
placed a 10 there. Same with the one below it. Trying to calculate 
the slope as it changes.

Thanks
wdbaker
Example that worked:
Filter=TimeNum()>080000 AND TimeNum()<=150000;
PositionSize=2500;
s=Peak(Close,.01,3);
t=Peak(Close,.01,2);

slope=(t-s)/10;//(BarsSince(s)-BarsSince(t));//
slope2=(C-s)/16;//BarsSince(s);
test1=slope2<slope and s>t;
Buy=Filter AND test1;
Sell=TimeNum()>150000;


Short=0;//Filter AND test2;
Cover=0;//test4 OR TimeNum()>150000;

--- In amibroker@xxxx, "akaloustian" <ara1@xxxx> wrote:
> Not sure, but the word "Filter" may be used improperly because it's 
a 
> reserved word, so Buy = Filter and ... may be a problem. Just pick 
> any other word.
> 
> Ara
> 
> --- In amibroker@xxxx, "wdbaker8" <wdbaker8@xxxx> wrote:
> > Ara,
> > thanks, you are correct, I have changed this below.
> > It still doesn't produce any results on a backtest though,
> > so still looking for more ideas. If I can get it to produce any 
> > results, then I can look at that and work from there.
> > 
> > thanks
> > wdbaker
> > Filter=TimeNum()>=080000 AND TimeNum()<=150000; 
> > PositionSize=2500;
> > s=Peak(Close,.01,3);
> > t=Peak(Close,.01,2);
> > slope=(t-s)/(BarsSince(s)-BarsSince(t));
> > slope2=(C-s)/BarsSince(s);
> > test1=slope2<slope AND s>t; 
> > Buy=Filter AND test1;
> > Sell=TimeNum()>150000;
> > 
> > Short=0;
> > Cover=0;
> > --- In amibroker@xxxx, "akaloustian" <ara1@xxxx> wrote:
> > > Seems like C is generally less than s or t, since s and t are 
> > defined 
> > > as peaks, so slope2 will generally be less than slope.
> > > 
> > > You may find some otherwise if you use a sizable data set. 
> > > 
> > > Suggest you plot the zig-zag function to see where the peaks 
are 
> to 
> > > get a feel for what is going on...
> > > 
> > > Ara
> > > 
> > > --- In amibroker@xxxx, "wdbaker8" <wdbaker8@xxxx> wrote:
> > > > All,
> > > > Attempting to figure out how to use the slope between two 
past 
> > > points 
> > > > and then buy when the slope between the farthest point and 
the 
> > > > current close becomes less than the slope between the 
original 
> > two 
> > > > points, I'm not getting any errors, just not getting anything 
> at 
> > > > all. Thought maybe there was an obvious problem.
> > > > 
> > > > Thanks for reviewing this and before you ask,
> > > > I never finished high school so the slope equations etc... 
> could 
> > be 
> > > > wrong.
> > > > 
> > > > Thanks
> > > > Bill Baker
> > > > Filter=TimeNum()>=080000 AND TimeNum()<=150000; 
> > > > PositionSize=2500;
> > > > s=Peak(Close,.01,3);
> > > > t=Peak(Close,.01,2);
> > > > 
> > > > slope=(t-s)/(BarsSince(s)-BarsSince(t));
> > > > slope2=(C-s)/BarsSince(s);
> > > > test1=slope2>slope AND s>t; 
> > > > Buy=Filter AND test1;
> > > > Sell=TimeNum()>150000;
> > > > 
> > > > 
> > > > Short=0;
> > > > Cover=0;