![]() |
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
|
|||||||
| Suggestions And Feedback New feature suggestions and feedback. |
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Junior Member
Join Date: Jul 2012
Posts: 24
Thanks: 2
Thanked 0 times in 0 posts
|
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 |
|
|
|
|
|
#2 |
|
NinjaTrader Customer Service
Join Date: Apr 2010
Location: Denver, CO, USA
Posts: 4,778
Thanks: 158
Thanked 565 times in 556 posts
|
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
Matthew
NinjaTrader Customer Service |
|
|
|
|
|
#3 |
|
Junior Member
Join Date: Jul 2012
Posts: 24
Thanks: 2
Thanked 0 times in 0 posts
|
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, |
|
|
|
|
|
#4 |
|
NinjaTrader Customer Service
Join Date: Dec 2011
Location: India
Posts: 3,286
Thanks: 580
Thanked 546 times in 541 posts
|
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...tml?closes.htm Please let me know if I can assist you any further.
Joydeep M.
NinjaTrader Customer Service |
|
|
|
![]() |
| Thread Tools | |
| Display Modes | |
|
|
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 |