Announcement
Collapse
Looking for a User App or Add-On built by the NinjaTrader community?
Visit NinjaTrader EcoSystem and our free User App Share!
Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less
Partner 728x90
Collapse
NinjaTrader
Total Return of a Stock/ETF
Collapse
X
-
Total Return of a Stock/ETF
Is there anyway to get the total return for a stock (including dividends) ?Tags: None
-
Thanks Patrick, but how would I do it via code. The issue I have is getting the dividend yield historically. Is there a way to do that?
Comment
-
Hello,
The only way I could think you could do this would be to check the BarTime and compare that to the times in the list of Dividends in the MasterInstrument.
There is no documentation on this so I can not provide much, I can provide the following syntax which would assist in getting the actual values and dates of the dividends for the instrument:
Code:foreach (Dividend dividend in Instrument.MasterInstrument.Dividends) { Print("Date: " + dividend.Date + " Amount: " + dividend.Amount); }
From there you could do other logic such as compare the current Bars Time to see which dividend would apply and then do your calculations as needed from there.
I look forward to being of further assistance.JesseNinjaTrader Customer Service
Comment
-
BarChart data
I noticed that BarChart data comes adjusted for splits and dividends as compared to other providers such as IB, IQFeed, and Kinetick. Does that mean only the historical data is adjusted or the real-time data is adjusted at the BarChart server before being fed to you?
Comment
-
Hello,
Yes that would be correct, you can locate which data providers do this already in this document: http://ninjatrader.com/support/helpG...lightsub=split
Please ensure to ask new questions as new threads in the future.
I look forward to being of further assistance.JesseNinjaTrader Customer Service
Comment
Latest Posts
Collapse
Topics | Statistics | Last Post | ||
---|---|---|---|---|
Started by judysamnt7, 03-13-2023, 09:11 AM
|
4 responses
57 views
0 likes
|
Last Post
by DynamicTest
Today, 08:25 PM
|
||
Started by ScottWalsh, Today, 06:52 PM
|
4 responses
36 views
0 likes
|
Last Post
by ScottWalsh
Today, 07:40 PM
|
||
Started by olisav57, Today, 07:39 PM
|
0 responses
7 views
0 likes
|
Last Post
by olisav57
Today, 07:39 PM
|
||
Started by trilliantrader, Today, 03:01 PM
|
2 responses
19 views
0 likes
|
Last Post
by helpwanted
Today, 07:25 PM
|
||
Started by cre8able, Today, 07:24 PM
|
0 responses
9 views
0 likes
|
Last Post
by cre8able
Today, 07:24 PM
|
Comment