Go Back   NinjaTrader Support Forum > NinjaScript Development Support > Indicator Development

Indicator Development Support for the development of custom indicators using NinjaScript.

Reply
 
Thread Tools Display Modes
Old 08-08-2012, 12:28 PM   #1
JohnDev
Junior Member
 
Join Date: Jun 2012
Posts: 5
Thanks: 1
Thanked 0 times in 0 posts
Default WillSpread Indicator

Can anyone code this indicator? The code here is in Genesis Trade Sense. I'm completely lost with C#.

It takes a spread between two market symbols and creates a moving average type indicator. In this case, it shows when the ES is gaining on the 30 year bond. It would be great to have an input variable for the two symbols, so I could change them and use it on different markets.

Thanks,
John

&Spread := (Close Of "ES-067" / Close Of "ZB-067") * 100
&5EMA := MovingAvgX (&Spread , 5 , True)
&20EMA := MovingAvgX (&Spread , 20 , True)
&5EMA - &20EMA
JohnDev is offline  
Reply With Quote
Old 08-08-2012, 12:32 PM   #2
NinjaTrader_Joydeep
NinjaTrader Customer Service
 
NinjaTrader_Joydeep's Avatar
 
Join Date: Dec 2011
Location: India
Posts: 3,286
Thanks: 580
Thanked 553 times in 545 posts
Default

Hello JohnDev,
Welcome to the forum.

Unfortunately we do not do custom NinjaScript coding. I will leave the thread open for any forum member who might assist you.

To develop your custom indicator/strategies you can also contact any of our independent NinjaScript consultants. You can get the list of our NinjaScript consultants from here http://www.ninjatrader.com/partners#...pt-Consultants
NinjaTrader_Joydeep is offline  
Reply With Quote
Old 08-13-2012, 09:36 PM   #3
mrdude
Junior Member
 
Join Date: Jan 2012
Location: Portsmouth, NH
Posts: 20
Thanks: 0
Thanked 6 times in 5 posts
Default

I took a stab at this. Let me know if this is what you're looking for.


EDIT: See post #8 for updated version
Last edited by mrdude; 08-14-2012 at 07:53 PM.
mrdude is offline  
Reply With Quote
The following 2 users say thank you to mrdude for this post:
Old 08-14-2012, 06:57 AM   #4
JohnDev
Junior Member
 
Join Date: Jun 2012
Posts: 5
Thanks: 1
Thanked 0 times in 0 posts
Default

First of all, thanks for attempting this.

I installed the indicator but couldn't get it to plot on my chart. I added "ZB 09/12" in the second instrument field and "ES 09/12" as my input series. In my list of indicators on my chart it gave me "WillSpread (ES 09/12 {1350 tick) (>Unknown<, >Unknown<, >Unknown<)
JohnDev is offline  
Reply With Quote
Old 08-14-2012, 11:12 AM   #5
mrdude
Junior Member
 
Join Date: Jan 2012
Location: Portsmouth, NH
Posts: 20
Thanks: 0
Thanked 6 times in 5 posts
Default

The input will have to be the identical text for the name of the instrument. I tested it out last night with currency pairs and it worked with $EURGBP as the input. When I get home tonight I'll play around with futures to see if it just needs a different format, though I'm not sure if I have any futures data to test with.
mrdude is offline  
Reply With Quote
The following user says thank you to mrdude for this post:
Old 08-14-2012, 02:12 PM   #6
flyguy767
Junior Member
 
Join Date: Dec 2008
Location: Palm Springs, Ca
Posts: 11
Thanks: 0
Thanked 5 times in 4 posts
Default

Quote:
Originally Posted by JohnDev View Post
First of all, thanks for attempting this.

I installed the indicator but couldn't get it to plot on my chart. I added "ZB 09/12" in the second instrument field and "ES 09/12" as my input series. In my list of indicators on my chart it gave me "WillSpread (ES 09/12 {1350 tick) (>Unknown<, >Unknown<, >Unknown<)
If your symbol mapping is the same as mine then change ZB 09/12 to ZB 09-12.
flyguy767 is offline  
Reply With Quote
Old 08-14-2012, 06:52 PM   #7
JohnDev
Junior Member
 
Join Date: Jun 2012
Posts: 5
Thanks: 1
Thanked 0 times in 0 posts
Default

Thanks, I tried that. No luck.
JohnDev is offline  
Reply With Quote
Old 08-14-2012, 07:50 PM   #8
mrdude
Junior Member
 
Join Date: Jan 2012
Location: Portsmouth, NH
Posts: 20
Thanks: 0
Thanked 6 times in 5 posts
Default

I was able to test this out with futures and it turns out that I needed to make a few changes to handle the input, but after the change it's working for me using ES 09-12 and ZB 09-12. As flyguy pointed out, the input will need to be in the format of ZB 09-12.



Here's the updated version along with a screenshot of the indicator
Attached Images
File Type: png WillSpreadFutures.png (107.1 KB, 63 views)
Attached Files
File Type: zip WillSpreadv1.1.zip (4.0 KB, 52 views)
Last edited by mrdude; 08-14-2012 at 07:52 PM.
mrdude is offline  
Reply With Quote
Old 08-14-2012, 08:18 PM   #9
JohnDev
Junior Member
 
Join Date: Jun 2012
Posts: 5
Thanks: 1
Thanked 0 times in 0 posts
Default

It looks correct on your chart but it won't plot on my end. I've attached a pic of my settings.

I'm brain dead at this point in the evening. I'll give it another try in the morning.

Thanks
Attached Images
File Type: jpg Willspread Chart.jpg (223.6 KB, 32 views)
JohnDev is offline  
Reply With Quote
Old 08-14-2012, 08:21 PM   #10
JohnDev
Junior Member
 
Join Date: Jun 2012
Posts: 5
Thanks: 1
Thanked 0 times in 0 posts
Default

Sorry, wrong chart.
Attached Images
File Type: png WillSpread Screencap.png (29.1 KB, 27 views)
JohnDev is offline  
Reply With Quote
Old 08-14-2012, 08:22 PM   #11
flyguy767
Junior Member
 
Join Date: Dec 2008
Location: Palm Springs, Ca
Posts: 11
Thanks: 0
Thanked 5 times in 4 posts
Default

Quote:
Originally Posted by mrdude View Post
I was able to test this out with futures and it turns out that I needed to make a few changes to handle the input, but after the change it's working for me using ES 09-12 and ZB 09-12. As flyguy pointed out, the input will need to be in the format of ZB 09-12.



Here's the updated version along with a screenshot of the indicator
mrdude,
Thanks for the WillSpread Ind. I tested your first version on about every combination of (min, ticks, range, contracts, and stocks that I trade) and it worked fine.
Last edited by flyguy767; 08-14-2012 at 08:38 PM.
flyguy767 is offline  
Reply With Quote
Old 08-14-2012, 08:23 PM   #12
mrdude
Junior Member
 
Join Date: Jan 2012
Location: Portsmouth, NH
Posts: 20
Thanks: 0
Thanked 6 times in 5 posts
Default

From Control Center, click on the Log tab. Do you see an errors there?

It's possible that the indicator didn't update, so maybe deleting it and re-importing will help.
mrdude is offline  
Reply With Quote
Old 08-14-2012, 08:42 PM   #13
flyguy767
Junior Member
 
Join Date: Dec 2008
Location: Palm Springs, Ca
Posts: 11
Thanks: 0
Thanked 5 times in 4 posts
Default

Quote:
Originally Posted by JohnDev View Post
Sorry, wrong chart.
I noticed at SecondInstrument you have ZB 09-12 (4500 tick) when it should be just ZB 09-12.
flyguy767 is offline  
Reply With Quote
Old 12-20-2013, 10:52 AM   #14
Steadman
Junior Member
 
Join Date: Nov 2013
Posts: 7
Thanks: 0
Thanked 0 times in 0 posts
Default Ninja 7 will not allow import

Ninja 7 latest version keeps saying the file is probably corrupt and it cannot import WillSpread. Does anyone have any ideas?
Steadman is offline  
Reply With Quote
Old 12-20-2013, 11:54 AM   #15
NinjaTrader_ChelseaB
NinjaTrader Customer Service
 
NinjaTrader_ChelseaB's Avatar
 
Join Date: Dec 2012
Location: Denver, CO
Posts: 2,552
Thanks: 38
Thanked 519 times in 512 posts
Default

Hi Steadman,

Thanks for your post.

Please post a copy of the script you are attempting to import.
NinjaTrader_ChelseaB is offline  
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -6. The time now is 05:34 PM.

FULL RISK DISCLOSURE: Futures trading contains substantial risk and is not for every investor. An investor could potentially lose all or more than the initial investment. Risk capital is money that can be lost without jeopardizing ones financial security or lifestyle. Only risk capital should be used for trading and only those with sufficient risk capital should consider trading. Past performance is not necessarily indicative of future results. View Full Risk Disclosure.