StockFetcher Forums · General Discussion · Finding maximum in a list<< >>Post Follow-up
hraghav
12 posts
msg #63424
Ignore hraghav
6/6/2008 5:35:41 AM

I am doing some study on TRO's RFR filter (Thanks, TRO!)

How do I do this:

set{x1, high - open} OK
set{Long_Profit, x1/open }

I want to find the highest Long_Profit in the last 100 days. It fails if I try this:

set{max_prof, max(Long_Profit, 100)}

as max only takes two indicators max(ind1, ind2). I want max to take (ind1, LENGTH). Any ideas how this could be done?

nikoschopen
2,824 posts
msg #63434
Ignore nikoschopen
6/6/2008 12:39:39 PM

Fetcher[
set{x1, high - open}
set{Long_Profit, x1/open }
set{Max100LP, Long_Profit 100 day high}
add column Long_Profit{Today'sProfit%}
add column Max100LP{MaxProfit% (-100)}
]



hraghav
12 posts
msg #63440
Ignore hraghav
6/6/2008 3:24:41 PM

Niko:

Thanks again! You da, man!

nikoschopen
2,824 posts
msg #63441
Ignore nikoschopen
modified
6/6/2008 5:42:51 PM

No problem. Since ure dealing with %, rather than $, the following might be a little easier on the eyes. Also note that the column labeled Dayz (MaxProfit%) will tell you when the "MaxProfit%" occured.

Fetcher[
set{x1, high - open}
set{Long_Profit, x1/open}
set{Max100LP, Long_Profit 100 day high}
set{LP, mod(Long_Profit,10) * 100}
set{MaxLP, mod(Max100LP,10) * 100}
set{dayz, days(Max100LP reached 100 day high,100)}

add column High
add column Open
add column LP{Today'sProfit%}
add column MaxLP{MaxProfit% (-100)}
add column dayz{Dayz (MaxProfit%)}
]


In addition, you might want to consider what the drawdown might have been had you unfortunately missed the chance to unload ure position at the "exact" high of the day. Basically what ure looking for is the ratio between the possible Long (High - Open) and the possible Short (Open - Low). A ratio of 1 or higher would suggest that the Long had a wider range than the Short play. A ratio less than 1 would suggest that the Short had the upper hand for the day.

Fetcher[
set{x1, high - open}
set{Long_Profit, x1/open}
set{LP, mod(Long_Profit,10) * 100}
set{SP, day range - LP}
set{ratio, LP / SP}

add column High
add column Open
add column Low
add column LP{LongProfit}
add column SP{ShortProfit}
add column ratio
]


Although I do not wish to demean anyone in particular, I believe the so-called "Stat" filter offered so far is too simplistic. It tends to give only one-sided view without taking into account the "what if" scenario. The above example is just a scratch on the tip of the iceburg. We could go much further by analyzing, for example, what the range (High - Open) is when the stock closed down on the prior day versus when it closed up on the prior day. The reason is that when the stock closes up for the day, it tends to continue at the open on the next day.

hraghav
12 posts
msg #63442
Ignore hraghav
6/6/2008 6:04:34 PM

Niko:

You pretty much nailed it! :) I am pretty much analyzing along the same lines -- thanks to TRO's original Stat scan that piqued my interest. But as you said, I'm throwing all kinds of what-if and other stats at it. I will share the results with the forum folks once I have something concrete.

hraghav
12 posts
msg #63445
Ignore hraghav
6/6/2008 6:47:30 PM

Niko:

Why does the days(...) return -1 or 0 in the above forumla? What does it signify? Does it signify that today was the Max_Profit and days(...) formula is unable to handle it?

nikoschopen
2,824 posts
msg #63449
Ignore nikoschopen
6/6/2008 8:39:16 PM

I would think "0" means that the occurrence took place today, but I have no idea what "-1" means. Sorry!

chetron
2,817 posts
msg #63451
Ignore chetron
modified
6/6/2008 8:45:44 PM

i believe -1 means:

it did not occur today
it did not occur yesterday
but it could possibly occur sometime in the distant future, or very very soon.


sorry, i am watching monty python. lol.


very nice work on these filters, niko.

nikoschopen
2,824 posts
msg #63452
Ignore nikoschopen
modified
6/6/2008 8:49:02 PM


Quote from hraghav:

But as you said, I'm throwing all kinds of what-if and other stats at it. I will share the results with the forum folks once I have something concrete.
Monsieur TRO is fond of finding how many times a stock makes 5-cents or more within the last 100 days. Well, the problem is that you never quite know for sure whether the stock will go up at the open. Sometimes, it stumbles out of the gate and actually falls before reversing and heading higher. My point is that there are many "if-then" scenarios that can be applied to the filter that in the end you would be left with essentially a different filter. Let me know if I can be of any further help.

StockFetcher Forums · General Discussion · Finding maximum in a list<< >>Post Follow-up

*** Disclaimer *** StockFetcher.com does not endorse or suggest any of the securities which are returned in any of the searches or filters. They are provided purely for informational and research purposes. StockFetcher.com does not recommend particular securities. StockFetcher.com, Vestyl Software, L.L.C. and involved content providers shall not be liable for any errors or delays in the content, or for any actions taken based on the content.


Copyright 2022 - Vestyl Software L.L.C.Terms of Service | License | Questions or comments? Contact Us
EOD Data sources: DDFPlus & CSI Data Quotes delayed during active market hours. Delay times are at least 15 mins for NASDAQ, 20 mins for NYSE and Amex. Delayed intraday data provided by DDFPlus


This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.