Click here to Login





                                                   Money management script question

  0

0
Obuli Govindaraju
2012-10-30 03:46:03


Question 1: Let's say I am running a trading system simulation on all 500 stocks in SP500 index. Does the event "OnEndPeriod" run on all 500 stocks at once for the same date?

Question 2: I want to write a simple trading system as follows.

When RSI(4) < 20 I want to set a rsi4Flag = true. After that when there is a bullish candlestick I want to buy. So Basically the buying rule will be rsi4Flag == true && Bullish_CandleStick == true.
How can I implement this using onEndPeriod? Or is there a better way to do it?







QuantShare
2012-10-30 09:40:11

  0

1/ Yes, the "OnEndPeriod" is called only once for the same date.
2/ It is better to add this rule in the trading system formulla

Bullish_CandleStick = Your rule;
buy = Bullish_CandleStick and rsi(4) < 20;






Obuli Govindaraju
2012-10-30 10:29:08

  0

Thank you for the quick reply.

Rsi(4) does not stay true all the time when a bullish candlestick occurs. That is why I want to first set a flag first indicating oversold after that I can simply look for a bullish candlestick.



QuantShare
2012-10-30 12:56:55

  0

You can use "hhv" function to detect if a rule has occurred at least once in the last N-bars:
hhv(rsi(4) < 20, 5); // Check the last 5 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
Withdraw a Fixed Amount Every Month - Money Management
Correlation Filter Money Management Strategy
Investing in stocks using the Kelly criterion money management st...
Return per Bar Stop - Money Management Strategy
Averaging Down Money Management Strategy

How-to Lessons
How to calculate the average of a time series using the money man...
How to debug a trading system using the money management tool
How to run a screen or a watchlist from a script
How to get stocks for a particular index using the global script
How to execute a script at regular intervals

Related Forum Threads
Money Management script and exit options in the wizard
Can a Money Management script access a custom function?
Get the Previous N bar Date/DateTime in Money Management script
Advance Money Management Script debug.
Money Management Script variables and more

Blog Posts
Create a trading strategy using the money management tool - Part ...
Create a trading strategy using the money management tool - Part ...
Basic trading system implemented using the money management tool
Several money management strategies in a trading system
Money Management: Optimize the scale-in strategy









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.