PureBytes Links
Trading Reference Links
|
Hi Nate,
Glad to see you always around new codes.
Let me please turn your antennas to the following:
There is the a danger in PEAK function use:
Suppose that Dow is ascending and at DAY 1 has a peak
at 9000. Suppose that the next days is as follows:
DAY 1, 9000
DAY 2, 8900
DAY 3, 8850
DAY 4, 8750
DAY 5, 8720
The function will see as peak the DAY 1, but will give you
the information after DAY 5 close.!!
The 3% of 9000 is 270 and close should loose more than
270 to trigger PEAK(CLOSE,3)
So, just after DAY 5 close, you get a signal that DAY 1 was
a peak.!!
If you read the chart ten days later, everything looks fine and
you think that a peak occurred at DAY 1 and you received the
signal at DAY 1. If you watch peak(close,3) everyday, you will
see that the signal is born after DAY 5 and it is attached to DAY 1.
Prices described above are not far from the reality, so you should
know in advance that any backtesting result has ONLY theoretical
value.
Hope this makes some details more clear.
Best Regards
Dimitris Tsokakis
--- In amibroker@xxxx, "Dr. S. Nathan Berger" <snberger@xxxx> wrote:
> Can someone help me write for the following:
>
> I want to run an Explore on my database of funds where only
the following
> are chosen:
>
> 1) The DagsPeaker.AFL is giving a green (buy) arrow; and
>
> 2) Using the ADX/DMI indicator, the +DMI is greater than the -
DMI
>
> I hope I have stated the problem correctly- and that one of you
will be
> able to assist me with the formula. I have included the
DAGSPeaker.AFL as
> an attachment. The ADX/DMI is found in the Insert/Standard Charts
section
> of AmiBroker.
>
> Thanks in advance.
>
> Nate Berger
>
> /* Dags Peaker v1.2
>
> v1.1: Changed peak val arg to 6 (from 10)
> v1.0: Initial version
> */
>
> pv = peak(close, 3);
>
> buy = isTrue (cross(close, pv + pv/500));
> sell = isTrue (cross( pv + pv/1000, close));
>
> inTrade = flip (buy, sell);
> maxgraph=5;
> graph0 = close;
> graph1 = pv;
> graph0barcolor = IIF (ref (inTrade, -1), 5, 1);
> graph1barcolor = IIF (buy, 5, IIF (sell, 4, 6));
|