I want to sort 40 rules in a rule-set dynamically (based on BuyInd(<rule>, 4,60) perfromance) and apply the rule with the best performance in the trading system simulation.
How do i do that in the Strategy Script? Not sure i came across a sorting function for rules .. Note, comp wont work here because comp compares across securities not against rules.
You could use the "ApplyRule" function to test every rule then choose the one that performs best.
How do i now sort and apply the rule with the best BuyInd performance to the buy condition?
This can be done only using the money management script. And would probably take a lot of time to backtest.
Thanks for pointing me to CompRule - I tried it but see one issue with the BuyInd. The rules i'm using is
comp(perf(close,per),"rank",1,1) < 11; (1 rule for each per: per = 20, 40, 60, 80, 100)
I want to pick the rule delivering the best portfolio performance of the 10 stocks picked by the rule (not stock performance).
BuyInd1( ) picks the rule delivering the best stock performance for each stock being evaluated.
Is there some way I can evaluate the portfolio performance of each rule, in order to pick the rule with the max portfolio performance?
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.