SwingRay2 for strategy - NinjaTrader Programming | futures io social day trading
futures io futures trading


SwingRay2 for strategy
Updated: Views / Replies:7,142 / 38
Created: by Trader.Jon Attachments:8

Welcome to futures io.

(If you already have an account, login at the top of the page)

futures io is the largest futures trading community on the planet, with over 90,000 members. At futures io, our goal has always been and always will be to create a friendly, positive, forward-thinking community where members can openly share and discuss everything the world of trading has to offer. The community is one of the friendliest you will find on any subject, with members going out of their way to help others. Some of the primary differences between futures io and other trading sites revolve around the standards of our community. Those standards include a code of conduct for our members, as well as extremely high standards that govern which partners we do business with, and which products or services we recommend to our members.

At futures io, our focus is on quality education. No hype, gimmicks, or secret sauce. The truth is: trading is hard. To succeed, you need to surround yourself with the right support system, educational content, and trading mentors all of which you can find on futures io, utilizing our social trading environment.

With futures io, you can find honest trading reviews on brokers, trading rooms, indicator packages, trading strategies, and much more. Our trading review process is highly moderated to ensure that only genuine users are allowed, so you dont need to worry about fake reviews.

We are fundamentally different than most other trading sites:
  • We are here to help. Just let us know what you need.
  • We work extremely hard to keep things positive in our community.
  • We do not tolerate rude behavior, trolling, or vendors advertising in posts.
  • We firmly believe in and encourage sharing. The holy grail is within you, we can help you find it.
  • We expect our members to participate and become a part of the community. Help yourself by helping others.

You'll need to register in order to view the content of the threads and start contributing to our community.  It's free and simple.

-- Big Mike, Site Administrator

Reply
 8  
 
Thread Tools Search this Thread
 

SwingRay2 for strategy

  #1 (permalink)
Elite Member
Near the BEuTiFULL Horse Shoe
 
Futures Experience: Beginner
Platform: NinjaTrader
Broker/Data: MBTrading Dukascopy ZenFire
Favorite Futures: $EURUSD when it is trending
 
Trader.Jon's Avatar
 
Posts: 500 since Jul 2009
Thanks: 401 given, 176 received

SwingRay2 for strategy

Ryanb posted a version of the SwingRay indicator recently:
https://futures.io/free_downloads/ninjatrader-7/indicators/817-download.html?view
He hasnt been able to offer a solution to my question.

I am looking at the the code to access the values of the swings so that if Close[1] > SwingRayHiValue[1] == 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.

 
Code
  protected override void Initialize()
        {
            DisplayInDataBox 	= false;
            CalculateOnBarClose	= true;
            Overlay				= true;
            PriceTypeSupported	= false;
			
			lastHighCache = new ArrayList();  // used to identify swing points; from default Swing indicator
			lastLowCache = new ArrayList();
			swingHighRays = new Stack();   // LIFO buffer; last entry contains the nearest swing high
			swingLowRays = new Stack();
        }
I tried moving the arraycode from the Initialize to the OnBarUpdate but that didnt help.

Assist is very apprecaited,
Jon

Reply With Quote
 
  #2 (permalink)
Quick Summary
Quick Summary Post

Quick Summary is created and edited by users like you... Add FAQ's, Links and other Relevant Information by clicking the edit button in the lower right hand corner of this message.

 
  #3 (permalink)
Administrator: Retired Backtester
 Vendor: speedytradingservers.com 
Rennes France
 
Futures Experience: Advanced
Platform: NinjaTrader
Broker/Data: IB/Kinetick
Favorite Futures: Futures
 
sam028's Avatar
 
Posts: 3,367 since Jun 2009
Thanks: 3,574 given, 3,983 received


Did you try with making lastSwingLowValue and lastSwingHighValue public ?

Success requires no deodorant! (Sun Tzu)
Reply With Quote
The following 2 users say Thank You to sam028 for this post:
 
  #4 (permalink)
Elite Member
Near the BEuTiFULL Horse Shoe
 
Futures Experience: Beginner
Platform: NinjaTrader
Broker/Data: MBTrading Dukascopy ZenFire
Favorite Futures: $EURUSD when it is trending
 
Trader.Jon's Avatar
 
Posts: 500 since Jul 2009
Thanks: 401 given, 176 received


sam028 View Post
Did you try with making lastSwingLowValue and lastSwingHighValue public ?

sam,

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!


Thanks,
Jon

Reply With Quote
 
  #5 (permalink)
Elite Member
Florida
 
Futures Experience: Intermediate
Platform: Ninjatrader
 
Posts: 12 since May 2010
Thanks: 34 given, 12 received

Jon,

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[0], Values[1], 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...

 
Code
protected override void Initialize()
{
   Add(new Plot( new Pen( Color.White), "HighRay" ));
}
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.

Good Luck.

Reply With Quote
The following 4 users say Thank You to pam421 for this post:
 
  #6 (permalink)
Membership Temporarily Revoked
NYC
 
Futures Experience: Intermediate
Platform: Ninjatrader
Broker/Data: Interactive Brokers
Favorite Futures: forex
 
Posts: 38 since Aug 2011
Thanks: 9 given, 25 received

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 10:29 AM.
Reply With Quote
 
  #7 (permalink)
Elite Member
Phoenix, Arizona
 
Futures Experience: Advanced
Platform: Ninja Trader
Favorite Futures: Oil
 
Posts: 52 since Jul 2009
Thanks: 1 given, 6 received

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.

regards,
taddypole...

Reply With Quote
 
  #8 (permalink)
Membership Temporarily Revoked
NYC
 
Futures Experience: Intermediate
Platform: Ninjatrader
Broker/Data: Interactive Brokers
Favorite Futures: forex
 
Posts: 38 since Aug 2011
Thanks: 9 given, 25 received


Taddypole View Post
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.

regards,
taddypole...

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 02:42 PM.
Reply With Quote
 
  #9 (permalink)
Elite Member
Cotswolds UK
 
Futures Experience: Intermediate
Platform: NT7, Multicharts
Broker/Data: Mirus,Amp,ZenFire
Favorite Futures: Fdax
 
DarrenH's Avatar
 
Posts: 62 since Mar 2010
Thanks: 93 given, 23 received

Using SwingRay as Target

Hi Jon

Just wondered if you got it figured out, i would like to also use the LastSwingHighValue as a target.

ProfitTarget1 == SwingRay().LastSwingHighValue

I changed these 2 lines from private to public.
public double lastSwingHighValue = double.MaxValue;
public double lastSwingLowValue = double.MinValue;

If anybody has any ideas, programming newbie!
Thanks



Trader.Jon View Post
Ryanb posted a version of the SwingRay indicator recently:
https://futures.io/free_downloads/ninjatrader-7/indicators/817-download.html?view
He hasnt been able to offer a solution to my question.

I am looking at the the code to access the values of the swings so that if Close[1] > SwingRayHiValue[1] == 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.

 
Code
  protected override void Initialize()
        {
            DisplayInDataBox     = false;
            CalculateOnBarClose    = true;
            Overlay                = true;
            PriceTypeSupported    = false;
 
            lastHighCache = new ArrayList();  // used to identify swing points; from default Swing indicator
            lastLowCache = new ArrayList();
            swingHighRays = new Stack();   // LIFO buffer; last entry contains the nearest swing high
            swingLowRays = new Stack();
        }
I tried moving the arraycode from the Initialize to the OnBarUpdate but that didnt help.

Assist is very apprecaited,
Jon


Reply With Quote
The following 2 users say Thank You to DarrenH for this post:
 
  #10 (permalink)
Elite Member
Prague, Czech republic
 
Futures Experience: Beginner
Platform: NinjaTrader/ZF
Favorite Futures: ES, TF
 
Posts: 79 since Jul 2010
Thanks: 41 given, 34 received

Some swingrays stay...


Hello guys,

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.

Any helps is appreciated,
Daniel

Attached Thumbnails
SwingRay2  for strategy-swingraysproblem.png  
Reply With Quote

Reply



futures io > > > > > SwingRay2 for strategy

Thread Tools Search this Thread
Search this Thread:

Advanced Search



Upcoming Webinars and Events (4:30PM ET unless noted)

Jigsaw Trading: TBA

Elite only

FuturesTrader71: TBA

Elite only

NinjaTrader: TBA

Jan 18

RandBots: TBA

Jan 23

GFF Brokers & CME Group: Futures & Bitcoin

Elite only

Adam Grimes: TBA

Elite only

Ran Aroussi: TBA

Elite only
     

Similar Threads
Thread Thread Starter Forum Replies Last Post
Call ATM Strategy on an automated strategy to control position jsengxx NinjaTrader Programming 7 May 31st, 2016 05:51 PM
Utility To Transpose Optimized Strategy Values From Excel Output to Actual Strategy mercuryfx NinjaTrader 5 April 7th, 2012 04:59 PM
Ninjatrader7 ATM Strategy combine with Strategy Wizard Ninja Script schuster21 NinjaTrader Programming 4 July 4th, 2011 05:39 PM
Ninja Strategy multi-timeframe issue/Strategy to indicator nw123 NinjaTrader Programming 2 December 20th, 2009 07:24 PM


All times are GMT -4. The time now is 09:00 AM.

Copyright © 2017 by futures io, s.a., Av Ricardo J. Alfaro, Century Tower, Panama, +507 833-9432, info@futures.io
All information is for educational use only and is not investment advice.
There is a substantial risk of loss in trading commodity futures, stocks, options and foreign exchange products. Past performance is not indicative of future results.
no new posts
Page generated 2017-12-18 in 0.15 seconds with 20 queries on phoenix via your IP 107.20.115.174