I'm attempting to use the screener to identify splits in symbols I'm interested in so I can apply those splits using the built-in QuantShare split functionality. I've populated the split custom database and come up with the following screener code:
BarsToEvaluate = 500; // Look at the last 500 bars for splits
SplitRatio = GetData('splits', 'ratio', Zero);
filter = hhv(SplitRatio , BarsToEvaluate );
This screener code seems to properly identify splits and returns the split ratio as expected, but I can't get it to return the other column values (i.e., the announced column and the Date column) from the custom split database. Can you help?
Hi and thanks for the suggestions - I validated that the database and field exist, and the field is a string. I'm happy to share this code on the server if I can get it working, but it isn't there yet.
I think what is happening is I'm able to identify the highest SplitRatio using the hhv function, but I don't know how to identify the same bar for the remaining columns. For example, when I use the Date() function you mentioned, I get today's date, not the date when the condition occurred.
I've tried 50 different permutations of various functions (some shown commented-out below) to identify and present the date and announced fields on the same bar the condition (i.e., hhv(SplitRatio , BarsToEvaluate ) ) was true. How can I do that?
Trading financial instruments, including foreign exchange on margin, carries a high level of risk and is not suitable for all investors. The high degree of leverage can work against you as well as for you. Before deciding to invest in financial instruments or foreign exchange you should carefully consider your investment objectives, level of experience, and risk appetite. The possibility exists that you could sustain a loss of some or all of your initial investment and therefore you should not invest money that you cannot afford to lose. You should be aware of all the risks associated with trading and seek advice from an independent financial advisor if you have any doubts.