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

Error

 Previous Topic Next Topic
 ketal #1 Posted : Wednesday, April 23, 2014 2:35:24 AM(UTC) Rank: MemberGroups: Registered, Registered Users, Unverified UsersJoined: 3/7/2014(UTC)Posts: 17Thanks: 6 times Hi,I am trying to code swing points both high and low. Following are the conditions:1) Swing Point High - high of current bar must be highest of next 6 bars.2) Swing Point Low - low of current bar must be lowest of next 6 bars. I have done the coding for the above. following are the coding:1) Swing Point HighH>Ref(H,+1) AND H>Ref(H,+2) AND H>Ref(H,+3) AND H>Ref(H,+4) AND H>Ref(H,+5) AND H>Ref(H,+6)2) Swing Point LowL
 Wanna join the discussion?! Login to your Discussions forum accountor Register a new forum account.
 wabbit #2 Posted : Wednesday, April 23, 2014 6:17:47 AM(UTC) Rank: Advanced MemberGroups: Registered, Registered Users, Subscribers, Unverified UsersJoined: 10/28/2004(UTC)Posts: 3,111Location: Perth, Western AustraliaWas thanked: 16 time(s) in 16 post(s) I'm not really certain of what your trying to achieve, but be very aware of how much looking into the future you allow in your trading.Try this:Code:`````` sph:=H>Ref(H,+1) AND H>Ref(H,+2) AND H>Ref(H,+3) AND H>Ref(H,+4) AND H>Ref(H,+5) AND H>Ref(H,+6); sph:=sph AND Alert(sph=0,2); {plot} sph AND Ref(BarsSince(sph),-1)>6; ``````
 ketal #3 Posted : Wednesday, April 23, 2014 8:57:01 AM(UTC) Rank: MemberGroups: Registered, Registered Users, Unverified UsersJoined: 3/7/2014(UTC)Posts: 17Thanks: 6 times wabbit wrote:I'm not really certain of what your trying to achieve, but be very aware of how much looking into the future you allow in your trading.Try this:Code:`````` sph:=H>Ref(H,+1) AND H>Ref(H,+2) AND H>Ref(H,+3) AND H>Ref(H,+4) AND H>Ref(H,+5) AND H>Ref(H,+6); sph:=sph AND Alert(sph=0,2); {plot} sph AND Ref(BarsSince(sph),-1)>6; `````` Hi Wabbit,Thanks for prompt reply. I am actually trying to find out the swing points for support and resistance using the conditions. Its a lagging tool. Thanks for the code. I have copied it in expert advisor and attached the same on the chart. Its working. BUT its not highlighting all the bars which is also fulfilling the formula condition. Attached is the 60 bars EOD chart for your reference arrows are showing the bars fulfilling the condition as per the code provided by you. But there are bars on the chart which should also show the down arrow as all of them are fulfilling the condition.Request you to please help. Regards,K
 wabbit #4 Posted : Wednesday, April 23, 2014 9:19:01 AM(UTC) Rank: Advanced MemberGroups: Registered, Registered Users, Subscribers, Unverified UsersJoined: 10/28/2004(UTC)Posts: 3,111Location: Perth, Western AustraliaWas thanked: 16 time(s) in 16 post(s) Ah... ok, I think I understand now your "time/bar limits"?How's this?Code:`````` sph:=H>Ref(H,+1) AND H>Ref(H,+2) AND H>Ref(H,+3) AND H>Ref(H,+4) AND H>Ref(H,+5) AND H>Ref(H,+6); {plot} hi:=If(PREV=0,sph, If(BarsSince(PREV=0)<6,1,0)); {plot} hi AND Alert(hi=0,2); ``````  I'm pretty sure the code meets your definition, but I think your definition needs some further refinement, as you will see when you plot this during a downtrend. I don't think you can simply say to ignore repetitive signals which occur within 6 bars of a previous signal, because as soon as the period is over, the code will trigger a new event, which will not help you to identify resistance/support levels.
 ketal #5 Posted : Wednesday, April 23, 2014 11:10:30 AM(UTC) Rank: MemberGroups: Registered, Registered Users, Unverified UsersJoined: 3/7/2014(UTC)Posts: 17Thanks: 6 times Hi Wabbit,Thanks a ton!The code is working great both in the down and up trend. There is only one problem (which I think I can manage :) ). If the left most bar is SPH it is now showing as per the code. I have attached the chart for the same for your reference. I have changed the condition a bit. I have removed the H+6 and L+6 from the condition. Basically I am trying to find the trend as well as support and resistance from using this swing points or fractals. If you see the chart you will see clear hh and hl in the uptrend on the chart as per the conditions. System is trend trading, its still in work in progress. Thanks once again for helping me out. Reagrds,K
 jigshir #6 Posted : Sunday, October 23, 2016 7:01:31 AM(UTC) Rank: MemberGroups: Registered, Registered Users, SubscribersJoined: 12/7/2013(UTC)Posts: 23Thanks: 1 times hi wabbit you code is working when i past this indicator >new but when overlay with chart just show line graph not like text high lite in chart bar SPL and SPH what should i do for correct ?
 Dipayan #7 Posted : Thursday, January 12, 2017 7:28:56 PM(UTC) Rank: NewbieGroups: Registered Users, SubscribersJoined: 1/10/2017(UTC)Posts: 1 how to take trade through swing point ? please advise.
 Users browsing this topic
 Similar Topics Formula for swing point (Formula Assistance) by AA50 3/1/2009 7:20:41 AM(UTC)
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.