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

Notification

Icon
Error

Options
Go to last post Go to first unread
moneypick  
#1 Posted : Friday, September 22, 2006 11:03:46 AM(UTC)
moneypick

Rank: Advanced Member

Groups: Registered, Registered Users, Subscribers
Joined: 10/29/2004(UTC)
Posts: 32

Hi,

I want your help to create a formula to scan my watchlist for intraday trade on following condition:

Daily Difference in High and Low in comparison to yesterday close is greater than 3% in last fifteen days.

I create following formula to scan for today data:

If(((H-L)/Ref(C,-1))*100>3,((H-L)/Ref(C,-1))*100,0)

But my problem how can i found any particular scrip has daily difference >3 in last 15 days.

Thanks in advance,

(moneypick)

wabbit  
#2 Posted : Friday, September 22, 2006 7:39:43 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)
moneypick,

Although colorful, your post is hard to read. Try not to use colours unless it adds to the post.... please.

Your code : If(((H-L)/Ref(C,-1))*100>3,((H-L)/Ref(C,-1))*100,0)

is probably better written in parts, with an Alert function to extend the criteria. Try something like this :

Code:

x:=100*(H-L)/Ref(C,-1);
y:=Alert(x>3,15);

{plot}
y;



wabbit [:D]
moneypick  
#3 Posted : Saturday, September 23, 2006 8:52:39 AM(UTC)
moneypick

Rank: Advanced Member

Groups: Registered, Registered Users, Subscribers
Joined: 10/29/2004(UTC)
Posts: 32

Respected Wabbit,

Thanks for your kind reply. I highligted with colour to tell my conditon more simple because I am not well versed with English language.

Your code not fulfill my condition. Because I want to search that securities which has daily difference in his high and low >3 of his yesterday close.

For Example:

Open High Low Close Difference

--- 50 50 45 45 -

1st day 45 46 44 44 4.44%

2nd day 43 46 43 46 6.81%

3rd day 50 50 48 49 4.34%

..................................................................

15th day 60 62 59 61 6.18%

Please understand what can I want to say.

Regards,

(moneypick)

wabbit  
#4 Posted : Sunday, September 24, 2006 3:20:29 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)
Try this:
Code:

x:=100*(H-L)/Ref(C,-1);
y:=Sum(x>3,15)>=15;

{plot}
y;



wabbit [:D]
moneypick  
#5 Posted : Sunday, September 24, 2006 10:36:10 AM(UTC)
moneypick

Rank: Advanced Member

Groups: Registered, Registered Users, Subscribers
Joined: 10/29/2004(UTC)
Posts: 32

Respected Wabbit,

Thanks for your help.

I am also write a code but it is long.

----------------------------

aa:=100*(H-L)/Ref(C,-1);
ab:=100*(Ref(H,-1)-Ref(L,-1))/Ref(C,-2);
ac:=100*(Ref(H,-2)-Ref(L,-2))/Ref(C,-3);
ap:=100*(Ref(H,-3)-Ref(L,-3))/Ref(C,-4);
ae:=100*(Ref(H,-4)-Ref(L,-4))/Ref(C,-5);
af:=100*(Ref(H,-5)-Ref(L,-5))/Ref(C,-6);
ag:=100*(Ref(H,-6)-Ref(L,-6))/Ref(C,-7);
ah:=100*(Ref(H,-7)-Ref(L,-7))/Ref(C,-8);
ai:=100*(Ref(H,-8)-Ref(L,-8))/Ref(C,-9);
aj:=100*(Ref(H,-9)-Ref(L,-9))/Ref(C,-10);
ak:=100*(Ref(H,-10)-Ref(L,-10))/Ref(C,-11);
al:=100*(Ref(H,-11)-Ref(L,-11))/Ref(C,-12);
am:=100*(Ref(H,-12)-Ref(L,-12))/Ref(C,-13);
an:=100*(Ref(H,-13)-Ref(L,-13))/Ref(C,-14);
ao:=100*(Ref(H,-15)-Ref(L,-15))/Ref(C,-16);

y:=(aa>3 AND ab>3 AND ac>3 AND ap>3 AND ae>3 AND af>3 AND ag>3 AND ah>3 AND ai>3 AND aj>3 AND ak>3 AND al>3 AND am>3 AND an>3 AND ao>3);

y;

------------------------

(moneypick)[:D]

wabbit  
#6 Posted : Sunday, September 24, 2006 7:29:02 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)
moneypick,

Did my code solve your problem? The way I see it, my code and your code achieve the same results? I haven't tested them against each other, but they look similar?

If my short, simple code solves the problem, then your code is long and unwieldy. Try to simplify wherever you can. If you can get the logic right in the first place and the code will follow.

Simple code is often much more customisable too. Take for example, you want to change the periods to twelve bars instead of the current 15 bars. You would have to count through the variables and delete the extra three variables, then amend the logical code to fit the new twelve conditions: My solution, you just change the 15 to 12, easy.

Also, consider the situation if in the fifteen bars, you were going to allow a little bit of lattitude and say that only 12 of the 15 bars had to have 'scores' above 3. How would you code that with your solution? You would have to hand code every possible permuatation that would have 12 of 15 bars above 3 and 3 bars equalto or below three (I think that makes nearly 3000 combinations?) With the simpler solution:

Code:

bars:=15;
score:=3;
latitude:=3;

x:=100*(H-L)/Ref(C,-1);
y:=Sum(x>score,bars)>=(score-latitude);

{plot}
y;



Although there are occassions when 'brute-force' is required to achieve the objective, often there is a smarter, simpler way.... you just have to find it.


wabbit [:D]
Derek Worswick  
#7 Posted : Friday, June 22, 2007 5:25:48 AM(UTC)
Derek Worswick

Rank: Advanced Member

Groups: Registered, Registered Users, Subscribers, Unverified Users
Joined: 8/11/2005(UTC)
Posts: 104

Hi,

Could you please help me with an explanation of the uses of

Hilbert Period, Enhanced Hilbert Period or Discrete Fourier transform (DFT).

Were you should use each of the above.

Is the MetaSock code for Discrete Fourier transform (DFT) available anywere.

Hoping you can oblige.

Derek

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.