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

Notification

Icon
Error

Options
Go to last post Go to first unread
gorachand  
#1 Posted : Tuesday, June 30, 2020 7:37:02 AM(UTC)
gorachand

Rank: Advanced Member

Groups: Registered, Registered Users
Joined: 2/19/2012(UTC)
Posts: 106

Thanks: 1 times
Was thanked: 1 time(s) in 1 post(s)

Hello,

      I am intersted in a simple 20 period moving average of the code---say.

I wish to scan all scrips for the number of periods it has been over a value say "z" most recently for all scrips.

How does one write the exploration code for that?

Can anyone help?

Regards,

Sourav

MS Support  
#2 Posted : Tuesday, June 30, 2020 2:46:38 PM(UTC)
MS Support

Rank: Advanced Member

Groups: Moderators, Registered, Registered Users, Subscribers
Joined: 10/8/2010(UTC)
Posts: 1,960

Thanks: 92 times
Was thanked: 155 time(s) in 150 post(s)
Originally Posted by: gorachand Go to Quoted Post

Hello,

      I am intersted in a simple 20 period moving average of the code---say.

I wish to scan all scrips for the number of periods it has been over a value say "z" most recently for all scrips.

How does one write the exploration code for that?

Can anyone help?

Regards,

Sourav

Hello,

So you are looking for the Moving Average to be above a certain value and want to know how long? You would probably want to use BarsSince. I believe the following would do what you are looking for:

Code:
Z:=50;
BarsSince(Mov(C,20,S) > Z)

gorachand  
#3 Posted : Wednesday, July 1, 2020 4:12:59 AM(UTC)
gorachand

Rank: Advanced Member

Groups: Registered, Registered Users
Joined: 2/19/2012(UTC)
Posts: 106

Thanks: 1 times
Was thanked: 1 time(s) in 1 post(s)

Hello,

Thank you for your reply.

    Your code works well when fashioned as an indicator. I put the code as BarsSince(C>160) and the indicator opened in the upper inner window showed the desired results.

But running it as an exploration did not produce the expected results. Plugging in the code in the exploration filter gave errenous outputs. What I want is that the exploration result screen should show a tabular entry of the scrip's name on one side and for how many bars this condition has been true counting from the right bleeding edge of all the scrips on the other side.

How does one do that?

Regards,

Sourav

Edited by user Wednesday, July 1, 2020 4:46:49 AM(UTC)  | Reason: Not specified

MS Support  
#4 Posted : Thursday, July 2, 2020 2:43:52 PM(UTC)
MS Support

Rank: Advanced Member

Groups: Moderators, Registered, Registered Users, Subscribers
Joined: 10/8/2010(UTC)
Posts: 1,960

Thanks: 92 times
Was thanked: 155 time(s) in 150 post(s)
Originally Posted by: gorachand Go to Quoted Post

Hello,

Thank you for your reply.

    Your code works well when fashioned as an indicator. I put the code as BarsSince(C>160) and the indicator opened in the upper inner window showed the desired results.

But running it as an exploration did not produce the expected results. Plugging in the code in the exploration filter gave errenous outputs. What I want is that the exploration result screen should show a tabular entry of the scrip's name on one side and for how many bars this condition has been true counting from the right bleeding edge of all the scrips on the other side.

How does one do that?

Regards,

Sourav

Hi again,

Sorry about that. You would not want to use the Filter Column since this is designed for screening out (this would generate all rejects basically because the formula is in effect an 'always true' condition). The other columns are useful when you just want to report a value. Put the formula into a Column, i.e. Column A instead. In certain cases Load Minimum Records can cause issues, so you may also want to try Loading X Records instead if you seem to have different results between scanning and an indicator.

gorachand  
#5 Posted : Sunday, July 5, 2020 4:46:37 AM(UTC)
gorachand

Rank: Advanced Member

Groups: Registered, Registered Users
Joined: 2/19/2012(UTC)
Posts: 106

Thanks: 1 times
Was thanked: 1 time(s) in 1 post(s)

Thank you for your reply. Will try it out.

Regards,

Sourav

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.