MetaStock™ Zone Forum & FAQ Artykuły Linki Elliott Waves EasyLanguage™ Zone

A B C D E F G H I J K L M N O P R S T U V W Y Z #

Bottom as the Middle Value of a Three Bar Pattern
Hi all -

I'm trying to code the following and would greatly appreciate any help you can offer:
I'm defining a bottom as the middle value of a three bar pattern where the low of the middle bar is lower than the other two.

Something like:

Bottom:=if( ref(L,-1)<ref(L,-2) and ref(L,-1)<L, ref(L,-1),???) {How
do I fill in the else?}

I now want to find the lowest value of Bottom since an event:

Some thing like:

Lowestsince(1,myevent,Bottom)

Lastly I want to compare that value to the most recent bottom.

TIA
Ron

Ron,

It sounds like you are trying to define a fractal. Bill Williams used this in his work. Also, Roy Larsen has used fractals in his Trade Equity indicator. Below are 2 of his indicators from LE that define fractals(F1 and F2):


Bottom as the Middle Value of a Three Bar Pattern

{PS Fractal Entry}
F1:=ValueWhen(1,H<Ref(H,-2) AND Ref(H,-1)<Ref(H,-2) AND Ref(H,-3)<Ref(H,-2) AND Ref(H,-4)<Ref(H,-2),Ref(H,-2));
a:=H>=F1;
If(a>0 AND Alert(a=0,2),Max(O,F1),0); {PS Fractal Exit}
F2:=ValueWhen(1,L>Ref(L,-2) AND Ref(L,-1)>Ref(L,-2) AND Ref(L,-3)>Ref(L,-2) AND Ref(L,-4)>Ref(L,-2),Ref(L,-2));
If(Cross(F2,L),Min(O,F2),0);

 

My suggestion would be to first define the event and then look for the lowest occurrence. You may also need to consider using more than three bars. There is quite a bit of discussion about fractals on the ReefCap and Stock Central boards. This doesn't answer your question but maybe will put you on the right path.

Preston



Ron, Preston

Just a small correction.

> It sounds like you are trying to define a fractal. Bill Williams used
> this in his work. Also, Roy Larsen has used fractals in his Trade
> Equity indicator. Below are 2 of his indicators from LE that define
> fractals(F1 and F2):

These are not "my" fractals, but they are as found in the MS 7.2 System Tester code for "PS Fractal Trading System 1" except for the last line addition that converts the output from binary to price.This same code, or versions of it, can be found on a number of public forums including the Guppy site.

Among other things the fractal code is useful for demonstarting the difference between conventional binary outputs and the price outputs used by my test tools.

Roy

Source / From: TOP
EquisMetastock[at]yahoogroups[dot]com

Equis and MetaStock® and MetaStock Professional® are registered trademarks of Equis International. Achelis Binary Wave®, The DownLoader®,
Expert Advisor®, OptionScope®, Quotecenter® and Smart Charts® are trademarks of Equis International, a Thomson Reuters company.

TradeStation® Pro, TradeStation® 2000i, OptionStation®, SuperCharts®, PowerEditor® and EasyLanguage®
are registered trademarks of TradeStation Technologies, Inc. Other names and marks referred to are the property of their respective owners.

All information provided on this website is for educational purposes only. Trading involves risk, including possible loss of principal and other losses.

Ten i inne materiały na tej stronie zostały zamieszczone zostały jedynie w celach edukacyjnych, nie ponoszę żadnej odpowiedzialno¶ci za ich stosowanie.

Gra na giełdzie i rynkach walutowych (FOREX) niesie ze sob± ryzyko poważnych strat finansowych!