Click here to Login





                                                   How to specify a "within n-bars" condition?

  0

0
pvu2017
2018-01-01 00:47:11


For example I want to have the following rules...

rule1 = cross(close,sma(20));
rule2 = close > ref(close,1);

buy = rule1 <within 3-bars> AND rule2;

Question: are conditionals in QS for "within 3-bars"?

Thanks,
P.V.



QuantShare
2018-01-01 05:39:46

  0

Best Answer
You can use the highest value over a specific period.
Example:
hhv(rule1, 3) == 1
or just
hhv(rule1, 3)


Returns true if rule1 is TRUE in one of the previous past three bars.



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
How far are the close prices from the support line
Export Indicators Data
CompRule
Plot Economic Indicators on a Chart
Sortino Ratio of an Asset

How-to Lessons
How to draw distances on a chart?
How to plot the relative performance of several stocks/indices
How to plot the number of stock tweets per day
How to dynamically update the settings of an indicator
How to generate buy/sell signals from a trading system

Related Forum Threads
How do I Import Tick Data from a CVS file
How to import Bid, Ask and Trade ticks from CSV file?
How to create a watchlist of scrips that are in an intermediate u...
How do I find the close price for an entry matching a custom DB
How can I incorporate earnings release data into my backtests scr...

Blog Posts
Buy the best/top rated stocks or how to create powerful rank base...
How to Create Your First Meta-Strategy
How to Scan for Parallel Resistance and Support Lines
Let me Show You How to Create Hundreds of Profitable Trading Syst...
How to Optimize a Trading System with Thousands of Billions of Co...









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.