NinjaTrader Support Forum  
X

Attention!

This website will be down for maintenance from Friday May 24th at 6PM MDT until Saturday May 25th at 11AM MDT. We apologize for the inconvenience. If you need assistance during this time, please email sales@ninjatrader.com


Go Back   NinjaTrader Support Forum > Suggestions and Feedback > Suggestions And Feedback

Suggestions And Feedback New feature suggestions and feedback.

Reply
 
Thread Tools Display Modes
Old 08-07-2012, 04:16 PM   #1
Scarlett09
Junior Member
 
Join Date: Jul 2012
Posts: 24
Thanks: 2
Thanked 0 times in 0 posts
Default Strategy - B/S based off different security

Hi,

Can you lead me to the thread or to the code instructions on how to create a Strategy that develops buy/sell decisions based off the movements of an indicator of a different security.

For example I am looking to buy/sell Gold based on the movements in AUDUSD, so if the Double Stochastics in AUDUSD crosses above 20 then my Strategy will buy Gold and when the Double Stochastics in AUDUSD crosses below 80 I will want to sell Gold.

The securities mentioned are just an example but I am looking to base my b/s decisions off an indicator of a different security.

If this is not possible then please add it to the suggestion box.

Thank you,

S
Scarlett09 is offline  
Reply With Quote
Old 08-07-2012, 04:49 PM   #2
NinjaTrader_Matthew
NinjaTrader Customer Service
 
NinjaTrader_Matthew's Avatar
 
Join Date: Apr 2010
Location: Denver, CO, USA
Posts: 4,794
Thanks: 160
Thanked 568 times in 559 posts
Default

Hello,

Yes, this is possible to add another instrument to your strategy and to take signals from that instruments indicator values and execute on another instrument.

I'd suggest taking a look at the SampleMultiInstrument Strategy under Tools--> Edit NinjaScript--> Strategy
NinjaTrader_Matthew is offline  
Reply With Quote
Old 08-08-2012, 06:55 AM   #3
Scarlett09
Junior Member
 
Join Date: Jul 2012
Posts: 24
Thanks: 2
Thanked 0 times in 0 posts
Default

Hi Matthew,

The SampleMultiInstrument Strategy shows me how to create a manual strategy based on 2 indicators for one security.

I'm actually looking to use a single indicator on security 1 to determine whether to buy/sell on security 2. In my chart I have 2 Data Series and one indicator.

In the Help Guide under NinjaScript and "Multi-Time Frame & Instruments" it goes over code on how to do this but when I try to replicate the script in my code I am receiving numerous error messages when I compile.

Are there any examples of a complete NinjaScript that show how to trade 1 or 2 Data Series based off of one indicator?

Thank you,
Scarlett09 is offline  
Reply With Quote
Old 08-08-2012, 07:15 AM   #4
NinjaTrader_Joydeep
NinjaTrader Customer Service
 
NinjaTrader_Joydeep's Avatar
 
Join Date: Dec 2011
Location: India
Posts: 3,286
Thanks: 580
Thanked 546 times in 541 posts
Default

Hello Scarlett09,
Unfortunately we do not have a sample code but you can create a strategy as per your requirement using a multi instrument code.

A sample code will be like:

Code:
protected override void Initialize()
{
	Add("$AUDUSD", PeriodType.Minute, 5, MarketDataType.Last);
        //rest of the code
}
Code:
protected override void OnBarUpdate()
{
	if (BarsInProgress == 1)
	{
		if (CrossAbove(this.Stochastics(Closes[1], 7, 14, 3), 20, 1))  //if stochastics as claculated on secondary series cross over 20, buy gold
		{
			EnterLong(0, 1, "Buy Gold");
		}
	}
}
http://www.ninjatrader.com/support/h...inprogress.htm
http://www.ninjatrader.com/support/h...tml?closes.htm

Please let me know if I can assist you any further.
NinjaTrader_Joydeep 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

Similar Threads
Thread Thread Starter Forum Replies Last Post
Strategy based on scanner Andrea Fare Strategy Development 8 11-11-2009 04:44 PM
Using one security as a benchmark for strategy soupcancooloff Strategy Development 1 06-25-2009 10:39 AM
How to plot a security and its relative strategy just between 9:30AM and 4:00PM? stefy Strategy Development 3 01-26-2009 08:35 AM
Alternative to tick based/bar based strategy calculation? (i.e every minute/X ticks) Elliott Wave Strategy Development 9 07-11-2008 03:11 AM
Automated strategy security alchemillia Automated Trading 2 06-04-2008 06:34 AM


All times are GMT -6. The time now is 10:48 PM.