Click here to Login





                                                   Reinvest Dividends in Your Trading System - Script

  0

0
swalk10
2014-09-27 11:43:41


Thank you for the AMM script - Reinvest Dividends in Your Trading System.

Analytically, it would be great to have an option to reinvest the dividends into shares of each particular asset generating the dividends as of X-dividend date. This allows certain advantages of evaluating relative asset performances vs using Adjusted Close.
If you get a chance to post some code along that line, that is appreciated.



QuantShare
2014-09-27 18:24:33

  0

For this you will need to update the script. Instead of adding cash to the portfolio, you should add more shares to the particular asset.



swalk10
2014-09-27 22:31:16

  0

I was just hoping for a bit of code example on the reinvest to shares as you have time.


QuantShare
2014-09-29 04:21:21

  0

Best Answer
Example: (To replace AddCash)

double shares = ts[0] * p.NbShares;
shares = (int)(shares / p.LastPrice);
if(shares > 0)
{
Orders.AddLongPosition(p.Symbol, shares, null);
}



swalk10
2014-09-29 09:03:33

  0

Thank you very much; I will test it out. I appreciate the help.


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
Reinvest Dividends in Your Trading System
Tax Implications for Your Trading System
Backtest different Segments in your Trading System
MAE and MFE of a Trading System
Design and backtest a trading system with two strategies

How-to Lessons
How to optimize an indicator in your trading system
How to add custom position-based metrics to your trading system
How to debug a trading system using the money management tool
How to optimize the number of positions in a trading system
How to add a metric in the trading system simulation report

Related Forum Threads
Need Simple Example of Ranking Stocks Implemented in Trading Syst...
Script Trading Example
How to read the number of positions in trading system
Optimize ranking system within a trading system?
Name of Trading System in AMM

Blog Posts
How to Backtest Your Trading System for Each Industry
5 position sizing techniques you can use in your trading system
Create a HTML or PDF Report of your Trading System Backtesting Re...
How to Switch On/Off Trading Rules in Your Stock Trading System
Improve your trading system performance by ranking stocks









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.