Rank: Member
Groups: Registered, Registered Users Joined: 2/12/2008(UTC) Posts: 17
|
Hi,
I want to do a system test on simple rules .
Buy at the high of the nearest Up fractal
Sell at the low of the nearest Down fractal
I tried doing this
{ Defining up fractal ) =
High1 := Ref(HIGH,-2);
High2 := Ref(HIGH,-1);
High3 := Ref(HIGH,0);
High4 := Ref(HIGH,1);
High5 := Ref(HIGH,2);
If((High3 > High1) AND (High3 > High2) AND (High3 > High4) AND (High3 >
High5), High3,0);
{Defining Low Fractal } =
Low1 := Ref(LOW,-2);
Low2 := Ref(LOW,-1);
Low3 := Ref(LOW,0);
Low4 := Ref(LOW,1);
Low5 := Ref(LOW,2);
(If((Low3 < low1) AND (Low3
|
|
|
|
Rank: Advanced Member
Groups: Registered, Registered Users Joined: 11/7/2005(UTC) Posts: 602
|
You are going to have problems with:
High3 := Ref(HIGH,0);
High4 := Ref(HIGH,1);
High5 := Ref(HIGH,2);
Since in reality they don't exist so you probably should not be using them.
|
|
|
|
Rank: Member
Groups: Registered, Registered Users Joined: 2/12/2008(UTC) Posts: 17
|
They do exist , high 1 to high 5 is used to form a fromation of a fractal ( Bill Williams )
|
|
|
|
Rank: Advanced Member
Groups: Registered, Registered Users Joined: 11/7/2005(UTC) Posts: 602
|
Well if Bill Williams says it's OK then I guess it's OK.
I have added some additional code to keep us honest.
High1 := Ref(HIGH,-2); High2 := Ref(HIGH,-1); High3 := Ref(HIGH,0); High4 := Ref(HIGH,1); High5 := Ref(HIGH,2); a1:=If((High3 > High1) AND (High3 > High2) AND (High3 > High4) AND (High3 > High5), High3,PREV); a2:=(a1-Ref(a1,-1))<>0; a3:=BarsSince(a2=1); {------------------------------------} b1:=Cross(H,a1)*(a3>2); b1
I create a ceiling with your code then with BarsSince() make sure we are not taking positions until HIGH4 and HIGH5 are good. See if this runs into the same problems as your original one. You can also plot a1;H to visually see the crossover on the chart before you run it through system tester.
|
|
|
|
Rank: Member
Groups: Registered, Registered Users Joined: 2/12/2008(UTC) Posts: 17
|
Hi John,
Thanks For replying ,
What the above formulae does is that it buys on the open of the next bar when the condition is true.
I want to open the trade at the value of High3 ( Fractal )
Thanks
Gaurav Udani
|
|
|
|
Rank: Advanced Member
Groups: Registered, Registered Users Joined: 11/7/2005(UTC) Posts: 602
|
If your standing in time at point High3, High4 and High5 are in the future. The only time that a position can be taken would be the opening after day High5. Too late for what you want. I Googled Bill Williams, what he does with fractals is forecasts High4 and High5 by moving the previous High1-High5 pattern into the future (a fractal guess of High4 and High5). That would take a bit more coding. Some traders (on the sites I found) have had excellent luck with his methods so don't give up because of this discussion.
|
|
|
|
Rank: Member
Groups: Registered, Registered Users Joined: 2/12/2008(UTC) Posts: 17
|
Thanks John ,
I have been trading fractals for a little more than 2 years now , i trade for abt 70 accounts , they work wonders for me .
If at all you come accross anything related to coding of fractals for system testing please do lemme know.
:-)
Gaurav Udani
|
|
|
|
Rank: Advanced Member
Groups: Registered, Registered Users Joined: 11/7/2005(UTC) Posts: 602
|
I will, always have liked fractals but need to be a heavy duty programmer to apply (which I am not).
I am sure you already know about:
New Trading Dimensions - How To Profit From Chaos In Stocks, Bonds, And Commodities - Bill Williams
|
|
|
|
Rank: Member
Groups: Registered, Registered Users Joined: 2/12/2008(UTC) Posts: 17
|
yes have read all the 3 books of will williams , have also watch his 12 weeks home study course .
where i am stuck is coding different parameters of a system for backtesting .
|
|
|
|
Rank: Advanced Member
Groups: Registered, Registered Users, Unverified Users Joined: 7/12/2007(UTC) Posts: 134 Location: Perth Western Australia
|
Hi Gaurav,
You will probably need to give more details of the steps you are trying to code.
For example:-
Buy Condition - If last fractal was a High (up) Fractal buy when price >= Last Fractal and hold order open for x bars.
Sell Condition - ???
oz
|
|
|
|
Rank: Member
Groups: Registered, Registered Users Joined: 2/12/2008(UTC) Posts: 17
|
Hi Oz ,
My conditions are simple
Buy Condition :: Buy at the high of the previous up fractal
{ High1 := Ref(HIGH,-2); High2 := Ref(HIGH,-1); High3 := Ref(HIGH,0); High4 := Ref(HIGH,1); High5 := Ref(HIGH,2);
If((High3 > High1) AND (High3 > High2) AND (High3 > High4) AND (High3 > High5), High3,0);
}
Sell Condition :: Sell at the low of the previous sell condition
The above code even does that , but where i am stuck is that
1) Metastock feeds orders for all fractals whereas i want to trade only on the previos fractal
so lets say if in the last 30 bars there are 3 upfractals which are not crossed , metastock will have 3 buy orders in the system , whereas i just want an order at the last fractal
2) also it reacts wierd when there are gaps
Thanks
Gaurav
|
|
|
|
Rank: Advanced Member
Groups: Registered, Registered Users, Unverified Users Joined: 7/12/2007(UTC) Posts: 134 Location: Perth Western Australia
|
Hi Gaurav,
Are you talking a Swing Trade system?
Cheers,
oz
|
|
|
|
Rank: Member
Groups: Registered, Registered Users Joined: 2/12/2008(UTC) Posts: 17
|
Hi ,
Not exactally swing , depends on what time frame u r using it on .
Can be used for intraday as well as positional.
I do Both
Gaurav Udani
|
|
|
|
Rank: Advanced Member
Groups: Registered, Registered Users, Unverified Users Joined: 7/12/2007(UTC) Posts: 134 Location: Perth Western Australia
|
Hi Gaurav,
I think the code below should do the trick.
{Buy}
H1:= Ref(H,-2); H2:= Ref(H,-1); H3:= Ref(H,-0); H4:= Ref(H,1); H5:= Ref(H,2); FractalTest:= (H3>H1) AND (H3>H2) AND (H3>H4) AND (H3>H5); FractalHigh:=ValueWhen(1,FractalTest=1,H); Cross(H,FractalHigh)
{Sell}
L1:= Ref(L,-2); L2:= Ref(L,-1); L3:= Ref(L,-0); L4:= Ref(L,1); L5:= Ref(L,2); FractalTest:= (L3<L1) AND (L3<L2) AND (L3<L4) AND (L3<L5); FractalLow:=ValueWhen(1,FractalTest=1,L); Cross(FractalLow,L)
Cheers,
oz
|
|
|
|
Users browsing this topic |
Guest (Hidden)
|
Forum Jump
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.