StockFetcher Forums · General Discussion · Help Creating Binary Indicator<< >>Post Follow-up
jfehrman
3 posts
msg #107417
Ignore jfehrman
8/7/2012 9:08:30 AM

W/ my limited knowledge of SF coding, I am having difficulty figuring out how to create an indicator that returns a set of values, ie overbought returns a 1, neutral returns a 0, oversold returns a -1. I have 5 indicators and I'm aiming to amalgamate the 5 into one score, which would read -5 if all 5 indicators were oversold and 5 if all were overbought. For instance:

If Indicator_1 is greater than .8, value return should be 1.
If Indicator_1 is less than .2, value returned should be -1.
If Indicator_1 is .8>.2, value returned should be 0.

Final_Indicator is the sum of values returned for Indicator_1, Indicator_2, ... Indicator_5.

Any help would be greatly appreciated!

traderseb
36 posts
msg #107458
Ignore traderseb
8/8/2012 7:37:37 AM

You may try this method and modify the indicators to suit your purpose.

Fetcher[
set{cnt1,count(Indicator_1 > .8,1)}
set{cnt2,count(Indicator_1 < .2,1)}
set{Ind1total,cnt1 - cnt2}

set{cnt3,count(Indicator_2 > .8,1)}
set{cnt4,count(Indicator_2 < .2,1)}
set{Ind2total,cnt3 - cnt4}

set{cnt5,count(Indicator_3 > .8,1)}
set{cnt6,count(Indicator_3 < .2,1)}
set{Ind3total,cnt5 - cnt6}

set{cnt7,count(Indicator_4 > .8,1)}
set{cnt8,count(Indicator_4 < .2,1)}
set{Ind4total,cnt7 - cnt8}

set{cnt9,count(Indicator_5 > .8,1)}
set{cnt10,count(Indicator_5 < .2,1)}
set{Ind5total,cnt9 - cnt10}

set{sum1,Ind1total + Ind2total}
set{sum2,Ind3total + Ind4total}
set{sum3,Ind5total + sum2}
set{Final_Indicator,sum1 + sum3}
]




StockFetcher Forums · General Discussion · Help Creating Binary Indicator<< >>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.