I am looking at the the code to access the values of the swings so that if Close > SwingRayHiValue == try to go long etc. Nothing is displayed in the DataBox: can someone please take a look at the code to see what can be exposed for that strategy input? There are already DataSeries that are 'public' but they dont show in the DataBox.
I tried moving the arraycode from the Initialize to the OnBarUpdate but that didnt help.
Not yet ... but I will ... but I am guessing that it will only expose the very last hi and lo in the array, not all the values being drawn on the chart?! hhhmmmm ... guess that means I will have to try MRO(whatever I need to do here)etc; .. this will be interesting!
I just downloaded and installed the indicator you referenced.
There are no DataSeries definitions in the indicator. Thus none can display in the DataBox.
And the only places in the SwingRay2 indicator where it says "DataSeries" are not definitions of a DataSeries, they are properties that referencesthe Values array of DataSeries that NinjaTrader provides. The indicator also has no code to set values into these DataSeries either as Values, Values, etc. or by using the property names (HighRay, LowRay, etc.) Usually properties of this sort are accompanied by Add statements in the Initialize method (for example, see below.)
In an indicator I wrote recently, I found that the only things I could get to display in the NinjaTrader DataBox were dataseries values in dataseries that were added in the Initialize method. Apparently it's not enough for a DataSeries to just be public ... they have to be Add'ed too.
Something like this...
I colored them white so they wouldn't mess up the scaling of other dataseries which I wanted to display (making them Transparent seemed to prevent display in the DataBox.)
I also found that if more than 10 dataseries were added in Initialize, only the first 10 would display in the DataBox.
A better place for the array initialization code would probably be in OnStartUp() but it won't help the issue of displaying in the DataBox.
If you want to display in the DataBox, I think you're going to have to "Add" a dataseries and then populate it for each bar so when you mouse-over a bar, you can see the values you set into the Added dataseries in the DataBox. In the indicator I made last week, I added 10 dataseries Add statements to its Initialize method and then filled in values from OnBarUpdate - for debugging purposes.
The following 4 users say Thank You to pam421 for this post:
Best way to use swing rays is to modify the code as a function in your strategy.
In my strategy for example, the code has been completely rewritten and at any given time i have all the swing highs and lows for 28 forex currency pairs!!!
Last edited by BankRobberNT; October 13th, 2011 at 09:29 AM.
I use the SwingRay indicator and would like to do a project using it. I would like to create dymanic trendlines connecting the previous high/lows of an indicator (like Macd) with those of price. The other thought is to have the slope displayed on each trendline (one for price and one for the indicator). This would give a constant update of potential divergences.
Any sharing of previous work would be appreciated. Of course I would share the code during and on completion of any progress/solutions I come up with.
If you are referring to my post, the code has been already shared in form of the indicator. If you want to work on a new project you gotta be able to extract, and modify that simple code for your needs. I don't see how could mine completely rewritten code help you, which is btw far more complex and advanced, written in special way and much harder to understand.
Last edited by BankRobberNT; December 23rd, 2011 at 01:42 PM.
I noticed a little glitch in SwingRays and as ryanb has been off the forum for some months, I decided to write here. Im including a screenshot of what happens sometimes. Does anybody have any hints on how to fix this?
The issue is that sometimes, when a swingray is broken, it is displayed still as unbroken. An example of a such a swingray is included.