Click here to Login





                                                   Number of times X happened

  1

0
umair
2013-02-07 20:08:46


Opening price is less than closing price yesterday (Gapped down) and how many times it gapped down in the past 10 days?

a= sumif(histoprice(_open,0)<histoprice(_close,1);
b= barssince (day() !- ref(day(),10))+1;
c= iff(a>0, ref(a,b),10);

rule1= c/10

Help!



umair
2013-02-07 20:10:06

  0

a=count(histoprice(_open,0)<histoprice(_close,1),10)
b=10
rule1= a/b

??



QuantShare
2013-02-08 10:59:56

  1

a = histoprice(_open,0) < histoprice(_close,1);
b = day() != ref(day(), 1);
c = a and b;
d = sum(c, 8*10); // Number of past bars to look: In a hourly chart, there are 8 bars in a day






umair
2013-02-27 07:53:43

  0

I'm trying to count how many times a cross happened between 9:30 to 16:00 on a 1 minute chart

rule = cross(c,a);
rule1 = sum(rule,390);

390 minutes in= 6.3 hours

but it seems to be not working properly. i think i need to figure out how to count crosses for the present day between 930 to 1600

help!



umair
2013-02-27 08:16:30

  0

i came across an indicator that you guys created. YTimeSum(rule, 16,00);

this works and gives me the number of times the cross over occurred before 4pm. only problem is that when I create a pane to display this... i would expect the value to increase for everytime the cross over occured... but it does not. it stays constant to zero but right after 4pm.. it says "6" which is actually the total numbers of times cross over occured. anyway to make it add each time through out the day?



QuantShare
2013-02-27 12:32:02

  0

This function returns the sum of the specified time series for every value that occurred before the specified time.
To get the total number of crossover, you can use "sum" function.



umair
2013-02-27 21:09:23

  0

QS, I agree with you but the sum function gets the total number of crossover for the # of bars that you tell it. As time moves forward.. so does the range that you give the sum function.

for ex:
a= t1= 1, t2=2, t3=3
sum(a,2); solution at t2= 3, but solution at t3=5.

What I want to see is:
1, 3, 6

The YTimesum works..but it doesn't plot on pane properly.. and nor does it work in a filter.

Again, i'm trying to find the # of times a crossover occurs for ONE day (9:30-4pm) as they occur. So if before 10am the cross over occurred 10 times.. and then from 10am to 11am the crossover occurred 2 additional time.. at 11AM the value should be 12, and so on.



QuantShare
2013-02-27 21:20:40

  0

The "YTimesum" does work correctly but it calculates the sum at the specified time only.

Here is how to calculate that:
a = crossover....
b = sumif(a, 1, barssince(day() != ref(day(), 1)));






umair
2013-02-28 03:22:42

  0

You're the guru! thx!


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
Number of Times an Event Occurred in the First N-Minutes of a Tra...
Number of Consecutive Trading Bars Condition was True
Number of Stocks Above Upper Bollinger Bands
Trading Strategy based on the Number of Buy Signals
Number of Stocks per Industry

How-to Lessons
How to plot the number of stock tweets per day
How to dynamically change the number of positions in a portfolio?
How to display the number of stocks per day for different RSI gro...
How to display the number of notes per stock
How to optimize the number of positions in a trading system

Related Forum Threads
Number of bars
Backtest, if number of buy is more than open positions, how QS se...
Maximum value of a given number of bars
How to read the number of positions in trading system
Counter for number of occurences..

Blog Posts
True portfolio simulation applied to trading systems
Speed Up Optimizations by Saving Ranking Data into a Custom Datab...
Getting Accurate Backtesting Results: Survivorship bias-free S&P ...
4 indicators to create adaptive trading systems
QS Trading Software: Database Optimization









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.