Click here to Login





                                                   Count Down Days

  0

0
Dave W.
2013-11-12 22:23:17


I'd like to setup a buy condition based on a count of the number of down days. For example, I'd like to say, "buy if 3 out of the last 5 days has a lower close".

I thought I could do this with the count() function, but I can't seem to get it to work. Is there an easy way to achieve what I'm trying to do?

Thanks.



Dave W.
2013-11-12 22:41:12

  0

I may have answered my own question. Is this the correct way to count the number of down bars over the last 5 bars?

DownBarsCount = SumIf(close < ref(close,1),1, 5);



QuantShare
2013-11-13 19:21:41

  1

Best Answer
Yes, correct.

Or you can use:

DownBarsCount = sum(close < close[1], 5);

To check if something is correct or not, the easier way is to plot it on a chart to get a visual confirmation.






No more messages
0




Reply:

No html code. URLs turn into links automatically.

Type in the trading objects you want to include: - Add Objects
To add a trading object in your message, type in the object name, select it and then click on "Add Objects"










QuantShare

Trading Items
Moving Average Crossovers In the Past Trading Days
Last Gap Up/Gap Down Price Size
% bars in last N trading days where stock close price increased
Days Since Inception Filter
Number of Days to a Specific Date

How-to Lessons
How to change volume bar colors when the price closes down
How to remove non-active securities
How to quickly download the most recent EOD data for your stocks
How to plot two different time frames in the same chart
How to add future bars to plan for market scenarios

Related Forum Threads
DOWN LOADER-(nse)
Component count
days naming
close above the highest high in the last 5 days
Calendar days charts vs Trading day charts

Blog Posts
Historical volatility estimators
How to measure market strength with the composite tool
Forecast volatility using trading rules and neural networks
Trading System: Moving average crossover and few others buy and s...
Example of a trading system implemented in QuantShare Software









QuantShare
Product
QuantShare
Features
Create an account
Affiliate Program
Support
Contact Us
Trading Forum
How-to Lessons
Manual
Company
About Us
Privacy
Terms of Use

Copyright © 2024 QuantShare.com
Social Media
Follow us on Facebook
Twitter Follow us on Twitter
Google+
Follow us on Google+
RSS Trading Items



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.