logo
Welcome Guest! To enable all features please Login or Register.

Notification

Icon
Error

Options
Go to last post Go to first unread
Lelouch  
#1 Posted : Monday, September 6, 2010 9:34:54 PM(UTC)
Lelouch

Rank: Newbie

Groups: Registered, Registered Users
Joined: 9/6/2010(UTC)
Posts: 6

I need help in this code for up fractal channel: If(H >= Ref(H,-2) AND H >= Ref(H,-1) AND H >= Ref(H,1) AND H >= Ref(H,2), If(H = 0, PREV,H), PREV ); at the current data, the line goes to 0.0 value instead of the previous fractal value. Is there anyway to fix this?
vienna  
#2 Posted : Tuesday, September 7, 2010 12:44:20 AM(UTC)
vienna

Rank: Advanced Member

Groups: Registered, Registered Users, Subscribers
Joined: 12/14/2009(UTC)
Posts: 140
Location: Austria

With:
AND H >= Ref(H,1)
AND H >= Ref(H,2),
you are trying to look one and two days into the future... For today this is unfortunatly not possible ;-)

You can try to change the whole formula to something like:
If(Ref(H,-2) >= Ref(H,-4)
AND Ref(H,-2) >= Ref(H,-3)
AND Ref(H,-2) >= Ref(H,-1)
:
and so on..
Lelouch  
#3 Posted : Tuesday, September 7, 2010 12:58:55 AM(UTC)
Lelouch

Rank: Newbie

Groups: Registered, Registered Users
Joined: 9/6/2010(UTC)
Posts: 6

Well I already tried that, the problem with it is that instead ploting on the fractal bar, it plot 2 bar after the fractal bar. If(Ref(H,-2) >= Ref(H,-4) AND Ref(H,-2) >= Ref(H,-3) AND Ref(H,-2) >= Ref(H,-1) AND Ref(H,-2) >= H, Ref(H,-2), PREV);
wabbit  
#4 Posted : Tuesday, September 7, 2010 2:48:36 AM(UTC)
wabbit

Rank: Advanced Member

Groups: Registered, Registered Users, Subscribers, Unverified Users
Joined: 10/28/2004(UTC)
Posts: 3,111
Location: Perth, Western Australia

Was thanked: 16 time(s) in 16 post(s)
You need to extend the line to the right, into the "undefined" area (requires forum.dll):

Code:

fractalup:=
H >= Ref(H,-2) AND
H >= Ref(H,-1) AND
H >= Ref(H,+1) AND
H >= Ref(H,+2);

hi:=ValueWhen(1,fractalup,H);

{extend to the right}
hi:=ExtFml("forum.sum",hi,1);
ValueWhen(1,hi>0,hi);




wabbit [:D]

vienna  
#5 Posted : Tuesday, September 7, 2010 3:11:29 AM(UTC)
vienna

Rank: Advanced Member

Groups: Registered, Registered Users, Subscribers
Joined: 12/14/2009(UTC)
Posts: 140
Location: Austria

hmm..
I think you have to decide:
- if you want an indicator which "only" shows you charts for the past or
- if you want an indicator which gives you signals for buying and selling.

If you want to have signals for buying and selling you shouldn't use values which are in the future..

If you want a chart which shows you what had happened - you can use this values in the future but you have to know that the last two days in your chart are wrong and will change next two days..

Edit:
ah I see Wabbit has a solution for this...
Lelouch  
#6 Posted : Tuesday, September 7, 2010 9:44:45 PM(UTC)
Lelouch

Rank: Newbie

Groups: Registered, Registered Users
Joined: 9/6/2010(UTC)
Posts: 6

wabbit wrote:
You need to extend the line to the right, into the "undefined" area (requires forum.dll):
wabbit [:D]

It work. Thanks.
gauravudani  
#7 Posted : Wednesday, March 16, 2011 1:23:03 AM(UTC)
gauravudani

Rank: Member

Groups: Registered, Registered Users
Joined: 2/12/2008(UTC)
Posts: 17

Hi , i want to do a system test using this formula , i want the system to buy when the high crosses the up fractal at the value of upfractal +1 . I tried a few formulas but with those formulas the system buys at the open of the next bar instead of the value of upfractal. I used 0 dely still no luck . Can you pls hel me . Thanks Gaurav Udani
wabbit  
#8 Posted : Wednesday, March 16, 2011 2:55:32 AM(UTC)
wabbit

Rank: Advanced Member

Groups: Registered, Registered Users, Subscribers, Unverified Users
Joined: 10/28/2004(UTC)
Posts: 3,111
Location: Perth, Western Australia

Was thanked: 16 time(s) in 16 post(s)
You cannot enter a trade at the high/low of the fractal, because the price has to move away from this extreme to form the fractal.


wabbit [:D]

gauravudani  
#9 Posted : Wednesday, March 16, 2011 3:40:15 AM(UTC)
gauravudani

Rank: Member

Groups: Registered, Registered Users
Joined: 2/12/2008(UTC)
Posts: 17

Thanks for the reply Right i get that , i want to buy after the formation of the fractal is complete ,as a buy stop loss order . This is what i tried Indicator 1 : alc_fract up fractalup:= H >= Ref(H,-2) AND H >= Ref(H,-1) AND H >= Ref(H,+1) AND H >= Ref(H,+2); hi:=Ref(ValueWhen(1,fractalup,H),-1); {extend to the right} hi:=ExtFml("forum.sum",hi,1); ValueWhen(1,hi>0,hi); INdicator 2 : alc_fract down fractaldn:= L <= Ref(L,-2) AND L <= Ref(L,-1) AND L <= Ref(L,+1) AND L <= Ref(L,+2); lo:=Ref(ValueWhen(1,fractaldn,L),-1 ); {extend to the right} lo:=ExtFml("forum.sum",lo,1); ValueWhen(1,lo>0,lo ); Indicator 3 : ALc_latch fract LE:=Cross(H, Fml( "alc_fract up") ); LX:=Cross( Fml( "Alc_fract down"),LOW) ; SE:=Cross( Fml( "Alc_fract down"),LOW); SX:=Cross(H, Fml( "alc_fract up") ); B:= ExtFml("forum.Latch",LE,LX,SE,SX); B = 1 AND Ref(B,-1) 1 Indicator 4 : alc_latch fract short LE:=Cross(H, Fml( "alc_fract up") ); LX:=Cross( Fml( "Alc_fract down"),LOW) ; SE:=Cross( Fml( "Alc_fract down"),LOW); SX:=Cross(H, Fml( "alc_fract up") ); B:= ExtFml("forum.Latch",LE,LX,SE,SX); B = -1 AND Ref(B,-1) -1 System testing I unticked Realistic Market Prices Buy order : Fml( "ALc_latch fract") Order Type : StopLoss - Fml( "alc_fract up") Sell Short Order : Fml( "ALc_latch fract short") Order Type : StopLoss - Fml( "alc_fract down") Now when i plot the result on the charts ,it enter the trade at the rate of the fractal , but skips a few trades on both the long and the short sides even if the fract is crossed Thanks Gaurav Udani
gauravudani  
#10 Posted : Wednesday, March 16, 2011 3:45:08 AM(UTC)
gauravudani

Rank: Member

Groups: Registered, Registered Users
Joined: 2/12/2008(UTC)
Posts: 17

not sure why even after i pressing enter and forming lines its still in the form of a para pls let me know if its diff to understand
wabbit  
#11 Posted : Thursday, March 17, 2011 3:15:09 AM(UTC)
wabbit

Rank: Advanced Member

Groups: Registered, Registered Users, Subscribers, Unverified Users
Joined: 10/28/2004(UTC)
Posts: 3,111
Location: Perth, Western Australia

Was thanked: 16 time(s) in 16 post(s)
For the trade entries, I'd use a pending order at the value of the fractal high/low. If you're only allowing one simultaneous position, you don't need to latch the signals as the EST takes care of this for you. Code the stop loss condition either as a market order or a pending order at the required level. I don't think you should use forward references in the EST as you have done it because it can cause some confusion for you and the EST; although it's OK in some special instances. I'd be recoding the logic to signal only using historical values not future vales.


wabbit [:D]

gauravudani  
#12 Posted : Friday, March 18, 2011 12:50:36 AM(UTC)
gauravudani

Rank: Member

Groups: Registered, Registered Users
Joined: 2/12/2008(UTC)
Posts: 17

Thanks Wabbit , i changed the code to this fractalup:= Ref(H,-3) >= Ref(H,-5) AND Ref(H,-3) >= Ref(H,-4) AND Ref(H,-3) >= Ref(H,-2) AND Ref(H,-3) >= Ref(H,-1); hi:=(ValueWhen(1,fractalup,Ref(H,-3))); {extend to the right} hi:=ExtFml("forum.sum",hi,1); ValueWhen(1,hi>0,hi); This code gives me a line plot on the high fractals , i am unable to code the system tester to buy at the cross of this like. the best i could reach was after unticking the realistic option . it would so as required in most of the cases but also at many places it would not trade at all. i use 3 positions as maximum The best i could reach is using this Buy Order Order Type Stop Limit Order Expiration Good Until Cancelled Entry Size Method # Of Units Signal Formula cross(h, Fml( "alc_fract up")) Price Formula Fml( "alc_fract up") Entry Size Formula 1 Strategic Delay Tick Minute Day # of Bars 0 0 0 where it buys at the cross of the fractal in most of the cases but again not always . some how have nt been ablle to code the reverse for sell short . also the same code behaves differently in buy to cover. your help is really appreciated Regards Gaurav Udani
wabbit  
#13 Posted : Monday, March 21, 2011 4:05:05 AM(UTC)
wabbit

Rank: Advanced Member

Groups: Registered, Registered Users, Subscribers, Unverified Users
Joined: 10/28/2004(UTC)
Posts: 3,111
Location: Perth, Western Australia

Was thanked: 16 time(s) in 16 post(s)
Have you had a look at the Fractal Trading Systems which came built-in with MS?


wabbit [:D]

gauravudani  
#14 Posted : Monday, March 21, 2011 11:25:34 PM(UTC)
gauravudani

Rank: Member

Groups: Registered, Registered Users
Joined: 2/12/2008(UTC)
Posts: 17

Yes , what it does is that it buys / sells after the bar that crosses the fractal is over . I want to back test trading at the price of the fractal. Regards Gaurav Udani
wabbit  
#15 Posted : Tuesday, March 22, 2011 3:12:57 AM(UTC)
wabbit

Rank: Advanced Member

Groups: Registered, Registered Users, Subscribers, Unverified Users
Joined: 10/28/2004(UTC)
Posts: 3,111
Location: Perth, Western Australia

Was thanked: 16 time(s) in 16 post(s)
As I mentioned previously, use pending orders to execute the trade at the price of the high/low fractal. To use these, you will need MS9 or newer as the older versions (IMHO) don't implement pending orders correctly.

Try something along the lines of (long trades only):


System Details PS Fractal Trading System 1 Pending Optimized No Order Bias Long Portfolio Bias Single Position Limit 1

Notes

Buy Order Order Type Stop Order Expiration Good Until Cancelled Entry Size Method Use Default Size Signal Formula hFractal:=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); hFractal; Price Formula hFractal:=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); valuewhen(1,hFractal,ref(h,-2)); Entry Size Formula
Strategic Delay Tick Minute Day # of Bars 0 0 0

Sell Short Order Order Type Market Order Expiration Good Until Cancelled Entry Size Method Use Default Size Signal Formula
Price Formula
Entry Size Formula
Strategic Delay Tick Minute Day # of Bars 0 0 0 Sell Order Order Type Stop Order Expiration Good Until Cancelled Signal Formula lFractal:=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); lFractal; Price Formula lFractal:=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); valuewhen(1,lFractal,ref(l,-2)); Strategic Delay Tick Minute Day # of Bars 0 0 0 Buy to Cover Order Order Type Market Order Expiration Good Until Cancelled Signal Formula
Price Formula
Strategic Delay Tick Minute Day # of Bars 0 0 0 Stops BreakEven Stop Positions None Floor Level 0.0 Pts Stop Loss Positions None Stop Value 0.0 Pts Trailing Stop Positions None Profit Risk Value 0.0 Pts Trailing Periods 0.0 Inactivity Stop Positions None Minimum Value 0.0 Pts Periods 0.0 Profit Target Positions None Target Value 0.0 Pts
Simulation Options General Options Points Only Test Yes Initial Equity 10000. Default Size 90.00 % Of Available Equity Trade Long Yes Trade Short No Optimization Results 9999

Trade Execution Options Realistic Market Prices Yes Buy Price N/A Sell Price N/A Sell Short Price N/A Buy To Cover Price N/A Delay To Open 1 Slippage Buy 0.00 Pts Sell 0.00 Pts Sell Short 0.00 Pts Buy to Cover 0.00 Pts

Broker Options Interest Rates Margin 0.00 % Money Market 0.00 % Margin Requirement Long Initial 100.00 % Long Maintenance 0.00 % Short Initial 150.00 % Short Maintenance 150.00 % Commissions Entry $0.00 Per Transaction Exit $0.00 Per Transaction



wabbit [:D]

gauravudani  
#16 Posted : Tuesday, March 22, 2011 11:49:18 PM(UTC)
gauravudani

Rank: Member

Groups: Registered, Registered Users
Joined: 2/12/2008(UTC)
Posts: 17

Hi , I tried this formula and faced a similar problem that i am facing . during exits the system tester behaves differently in a few cases it exits on a low fractal prior to the latest one i have a screen shot that may make it more clear , but i cant figure out how to attach that here ... regards Gaurav Udani
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.