Click here to Login

                                                   Creating Trading System/Simulation doesn�t work


2021-05-01 15:20:33


the following backtest doesn�t work:
Buy just before close of the current day if High of today > High of yesterday. Sell/Exit if Low of today < Low of yesterday. And I want to backtest only one stock, e.g. Facebook. Can anyone help me to get it run? Thank you!

// Buy rules

Rule1 = (HistoPrice(_high,0)) > (HistoPrice(_high,1));
buy = Rule1;

// Sell rules

Rule2 = (HistoPrice(_low,0)) < (HistoPrice(_low,1));
sell = Rule2

2021-05-02 13:14:58


Best Answer
have you tried the "ref" function rather than HistoPrice?
buy = high>ref(high,1);
sell = low<ref(low,1);
This works for me, rather than histoprice

2021-05-05 02:29:55


Great! Thank you, it�s working with the "ref" function. BTW: is ref(high,1) the same as high[1]?

2021-05-05 07:26:10


ref(high,1) is indeed the same as high[1]
thanks, I never knew about [1]!!

No more messages


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"


Trading Items
Adaptive Trading Indicator based on the Return of Past Trades
Output metric for each trading year
Backtest different Segments in your Trading System
Number of Trading Bars to Fill a Gap Up
Ichimoku Kinko Hyo - Trading Indicator

How-to Lessons
How to add a trading indicator to a chart
How to download a trading item from the Sharing Server
How to get trading orders from a portfolio programmatically
How to import trading data from CSV files
How to export trading data to a CSV file

Related Forum Threads
Need Simple Example of Ranking Stocks Implemented in Trading Syst...
Pairs trading
QuantShare Trading Software: New Version 2.9.2
Hysteresis in ranking sytem - reduce trading with time decay fact...
ApplyRule example in trading system

Blog Posts
QuantShare Trading Software: New Features in the 3.4.2 Version
10 masks to create thousands of rules to use into your trading sy...
Improve your trading system performance by ranking stocks
Let me Show You How to Create Hundreds of Profitable Trading Syst...
The Ultimate Guide to Create Trading Systems in QuantShare

Create an account
Affiliate Program
Contact Us
Trading Forum
How-to Lessons
About Us
Terms of Use

Copyright 2021
Social Media
Follow us on Facebook
Twitter Follow us on Twitter
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.