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

Notification

Icon
Error

Options
Go to last post Go to first unread
ArcMan  
#1 Posted : Wednesday, June 21, 2006 2:31:53 PM(UTC)
ArcMan

Rank: Newbie

Groups: Registered, Registered Users, Subscribers
Joined: 6/17/2006(UTC)
Posts: 4

Hi, I got some help from Wabbit on this one, but still need to figure this out, not to good with code. I have broken this down down into steps so you can understand it better, I am almost there, but stuck on a few issues. I am trying to re-write a Turtle Soup +1 (TS+1) formula but this is what I would like to achieve: For a Long Entry: 1. There has to be a low in the last 20 bars I tried to use BarsSince(L<Ref(LLV(H,20),-1) This is suppose to return the value of the lowest low in the last 20-bars, I don't know if that is correct. 2. This low cannot be in the last 4 bars I don't know how to exclude these 4 days from the BarsSince(L<Ref(LLV(H,20),-1) 3. Yesterday's bar has to move down 10 points or more Ref(C,-1)>=Ref(C,-2)+10 4. The bar then moves 3 points higher to enter a buy C<=Ref(C,-1)-3 I don't know if I have done the right thing but the TS +1 formula is below, I was wondering if what I wanted to acheive could be incorporated in the below: Buy setup: LLV(L,20)<Ref(LLV(L,20),-1) AND Ref(L,-1)>Ref(LLV(L,20),-1) AND Ref(L,-2)>Ref(LLV(L,20),-2) AND LLV(L,20)<Ref(LLV(L,20),-2) AND LLV(L,20)<Ref(LLV(L,20),-3) Sell setup: HHV(H,20)>Ref(HHV(H,20),-1) AND Ref(H,-1)<Ref(HHV(H,20),-1) AND Ref(H,-2)<Ref(HHV(H,20),-2) AND HHV(H,20)>Ref(HHV(H,20),-2) AND HHV(H,20)>Ref(HHV(H,20),-3) Would really appreciate some help on this
uasish  
#2 Posted : Wednesday, June 21, 2006 4:00:07 PM(UTC)
uasish

Rank: Advanced Member

Groups: Registered, Registered Users
Joined: 8/13/2005(UTC)
Posts: 170

Thanks: 7 times
Dear Sir, With apprehension of being wrong in the code ,i am still venturing out as seniors are there to correct us. This will be the code fulfilling your set of conditions := a:= TroughBars(1,L,5)>4; b:=(Ref(C,-2)-Ref(C,-1))<= ( Ref(C,-2)-Ref(C,-1))/ Ref(C,-2) *.1; m:=If(a AND b ,1,0); n:= ValueWhen(1,m,((C - Ref(C,-1))/C > .04)); n; Regards Asish
ArcMan  
#3 Posted : Thursday, June 22, 2006 2:47:32 PM(UTC)
ArcMan

Rank: Newbie

Groups: Registered, Registered Users, Subscribers
Joined: 6/17/2006(UTC)
Posts: 4

a:= TroughBars(1,L,5)>4; b:=(Ref(C,-2)-Ref(C,-1))<= ( Ref(C,-2)-Ref(C,-1))/ Ref(C,-2) *.1; m:=If(a AND b ,1,0); n:= ValueWhen(1,m,((C - Ref(C,-1))/C > .04)); n; Hi Asish, I am beginning to understand your logic here, but would it be possible to explain it a bit further? I am not familiar with the TroughBars function, but am willing to learn more about it, really appreciate your help. Regards, ArcMan
wabbit  
#4 Posted : Friday, June 23, 2006 9:19:52 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)
ArcMan wrote:
For a Long Entry: 1. There has to be a low in the last 20 bars 2. This low cannot be in the last 4 bars 3. Yesterday's bar has to move down 10 points or more 4. The bar then moves 3 points higher to enter a buy
Try this: In the 16 days bars before 4 bars ago, there must be at least one new llv(l,16), and the close yesterday must be lower than the close the bar before that by 10 points or more, and the close today is greater than or equal to the close yesterday plus 3 points. Ref(Sum(L=LLV(L,16),16),-4)>0 AND Ref(C,-1)<=(Ref(C,-2)-10) AND C>=(Ref(C,-1)+3) See if it produces the right results and get back to us. Hope this helps. wabbit :D
ArcMan  
#5 Posted : Friday, June 23, 2006 11:13:24 AM(UTC)
ArcMan

Rank: Newbie

Groups: Registered, Registered Users, Subscribers
Joined: 6/17/2006(UTC)
Posts: 4

I have had another run with the simulation tests and changed the values of the moves to correctly reflect the decimated moves, however, my results are still not correct, I am having problems with the results being concentrated in one area of the chart, at the beginning of the chart I have a couple of long entries which then close at the end of the chart, whereas, I know for a fact that there were formations which should have shown up from previous trades, but didn’t. Now the key to understanding this might lie in the original setups below, because these work fine along the entire length of the chart and come with indications as they were supposed to, perhaps we should begin to understand the function of the setup before we make another one to do something slightly different.
Original Buy setup: LLV(L,20)<Ref(LLV(L,20),-1) AND Ref(L,-1)>Ref(LLV(L,20),-1) AND Ref(L,-2)>Ref(LLV(L,20),-2) AND LLV(L,20)<Ref(LLV(L,20),-2) AND LLV(L,20)<Ref(LLV(L,20),-3) Original Sell setup: HHV(H,20)>Ref(HHV(H,20),-1) AND Ref(H,-1)<Ref(HHV(H,20),-1) AND Ref(H,-2)<Ref(HHV(H,20),-2) AND HHV(H,20)>Ref(HHV(H,20),-2) AND HHV(H,20)>Ref(HHV(H,20),-3) What the Original Buy Setup is supposed to do: The previous 20-bar low has to be at least 3-bars earlier. The close for the bar must be at or below the previous 20-bar low. The entry buy is placed the next bar at the earlier 20-bar low. What the Original Sell Setup is supposed to do: The previous 20-bar high has to be at least 3-bars earlier. The close for the bar must be at or above the previous 20-bar high. The entry sell is placed the next bar at the earlier 20-bar high.
What I would like to do (I have revised this to be more accurate): For an entry buy: The previous 20-bar low has to be at least 4-bars earlier. The low for the bar must be 10 points below the previous 20-bar low. The entry buy is placed at the close of the next bar if the close is at least 13 points (or decimated) higher than the low (the way I came to this conclusion was simply by adding 10+3, because you cannot tell in a static historical chart what would have happened on that day, so naturally if a buy signal is to be generated, it has to be at the next bar, but, only if the last bar meets the criteria) For an entry sell: The previous 20-bar high has to be at least 4-bars earlier. The high for the bar must be 10 points above the previous 20-bar high. The entry buy is placed at the close of the next bar if the close is at least 13 points (or decimated) lower than the high (the way I came to this conclusion was simply by adding 10+3, because you cannot tell in a static historical chart what would have happened on that day, so naturally if a sell signal is to be generated, it has to be at the next bar, but, only if the last bar meets the criteria) Wabbit, this makes sense, but is there a way I can fit into the context of my problem with the original setup above? I hope my explanation makes more sense now. Ref(Sum(L=LLV(L,16),16),-4)>0 AND Ref(C,-1)<=(Ref(C,-2)-10) AND C>=(Ref(C,-1)+3) I am on the correct track with this now, even with not so promising results it is looking up, wabbit your help is really appreciated and Asish who also contributed to this post, if I come with anything any sooner I will post it.
wabbit  
#6 Posted : Friday, June 23, 2006 1:40:49 PM(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)
Try this then..... z:=L=LLV(L,20) AND Ref(BarsSince(L=LLV(L,20)),-1)>3 AND L<(ValueWhen(2,L=LLV(L,20),L)*0.9); N:=Ref(z,-1)=1 AND C>(Ref(L,-1)*1.03); N; Please try to get the system straight before you post... it will make coding soooo much easier. It only takes a small change in your 'system' to cause dramatic changes in the code. I have only coded the entry (we see if we can get this right, then we will attempt the exit). The points have been replaced with multipliers (as discussed in separate corrspondence) so please check the results versus these multipliers before thinking there is something wrong with the code! Please test the code thoroughly.... I have been out for dinner and had some wine again! Best of luck. wabbit :D P.S. Perhaps you could include a chart with the LLV(L,20) on it and some text and pointers etc so we can visualise what you are trying to achieve?
ArcMan  
#7 Posted : Monday, June 26, 2006 11:35:20 AM(UTC)
ArcMan

Rank: Newbie

Groups: Registered, Registered Users, Subscribers
Joined: 6/17/2006(UTC)
Posts: 4

Hi Wabbit, To explain this more clearly I have attached a chart of an example long entry on my intended setup; I have 20-bars from 21/08/2001 to 18/09/2001 There is a low on 04/09/2001 (circled red) (dotted green line is an extension of this forward) low occured at 171.610 On 18/09/2001 an entry is generated based on the following criteria: (There is a low in the last 20-bars - 171.610) We have a new 20-bar low today (dotted blue line - 171.470), this low is at least 10 points below the previous low (this is beause GBPJPY trades at .01 movement as a point) This low then moves upwards 3 or more points, a buy signal is generated. This is the realtime scenario! - Obviously in backtesting everything will have to move back one day, and you can't tell when and if the new moved backed through the previous low! So lets work backwards, so that everything goes into +1 mode: We can look for a low in 20-bars (this doesn't have to be on the 20th bar, it can be anywhere in 20-bars but not in th last 4!), we should then look for a new low on yesterday's bar, this will give us the basic setup. If that new low on yesterday's bar is lower than the previous low in the last 20-bars then we have a setup, if then on the current we go up 3 or more points than yesterday's low then there is buy entry generated. I hope this helps to undertsand the concept better than what I'd explained earlier. UserPostedImage
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.