Click here to Login





                                                   Creating Trading System/Simulation doesn�t work

  0

0
Farhad
2021-05-01 15:20:33


Hi,

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



JC
2021-05-02 13:14:58

  0

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



Farhad
2021-05-05 02:29:55

  0

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


JC
2021-05-05 07:26:10

  0

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



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
Output metric for each trading year
R Squared of a Trading System Equity Curve
Adaptive Trading Indicator based on the Return of Past Trades
Backtest different Segments in your Trading System
Ichimoku Kinko Hyo - Trading Indicator

How-to Lessons
How to add a trading indicator to a chart
How to create a trading system
How to import trading items from other accounts
How to export trading data to a CSV file
How to add a metric in the trading system simulation report

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...
How to combine long, short and custom portfolio strategies within...
Several money management strategies in a trading system
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.