Announcement
Collapse
Looking for a User App or Add-On built by the NinjaTrader community?
Visit NinjaTrader EcoSystem and our free User App Share!
Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less
Partner 728x90
Collapse
NinjaTrader
Startegy run on one instrument but trade another
Collapse
X
-
Startegy run on one instrument but trade another
Example - How can one run startegy on ES but trade MES? Strategy runs on ES data but trades MES.Last edited by rocketstock; 02-06-2022, 09:25 PM.Tags: None
-
Hello rocketstock,
Add the MES data series with AddDataSeries().
Place the orders using BarsInProgress 1 as the index.
EnterLong(1, 1, "entry on secondary instrument");
EnterLong(int barsInProgressIndex, int quantity, string signalName)
Below is a link to an example that places orders to a secondary series.
Chelsea B.NinjaTrader Customer Service
-
-
Could this be added as a feature request? Trading data on MES especially some volume formulas get screwed up as it not as organized as ES. Retail causing trouble on MES. Additionally ES could be used for other things like stocks. Hence my thinking.
Comment
-
Comment
-
-
Sorry to bother on this topic again. But what is the use of the secondary or primary data series in strategy builder in picture i posted above. Can I not use that secondary data series to act on the primary. Like is ES was the secondary data series in strategy builder and MES was the primary in strategy on chart. Just trying to understand the purpose of the data series in startegy builder. Is there a video or link to that please?
Comment
-
Got it thanks. I am hesitant to unlock my script. Perhaps I could create a version for each instrument. Is there a sample file that does the whole things in one script? -looking at one instrument and trading another. I looked at links above and not able to me make it work.
Comment
-
Yes like both your ideas. I will try. Thank you so much. The volume patterns in MES are different from ES. Doesn't show on normal volume indicators. Most look similar. Head fakes detection etc are not caught on MES charts. I highly recommend NT consider adding this feature to strategy builder :-)
Comment
-
Originally posted by NinjaTrader_ChelseaB View PostHello rocketstock,
Make a copy of the script and unlock the copy.
https://youtu.be/H7aDpWoWUQs?t=355&l...We0Nf&index=14
The SampleIntrabarBacktest_NT8 demonstrates placing orders to BarsInProgress 1. If this is another instrument the orders will be placed to that instrument.
I created an unlocked version and tried this. Running this on ES chart 3 min. Execute trade on MES using ES data. Not working.
else if (State == State.Configure)
{
AddDataSeries("MES 03-22", BarsPeriodType.Minute, 3);
}
And
EnterShort(1, 1, "entry on secondary instrument");
Something is wrong in my coding. When I enter ES instead of MES in ( AddDataSeries("MES 03-22", BarsPeriodType.Minute, 3)
It works. Any other symbol it doesn't. MES above is the secondary data series per the documentation you sent.
These are the only two lines I added to unlocked script.Last edited by rocketstock; 02-09-2022, 04:33 AM.
Comment
-
Hello rocketstock,
Is there an error occurring with other instruments?
Are you seeing prints for BarsInProgress 1 appear in the output window?
This would let us know if the data is being processed to focus on the connection or the logic within the script.Last edited by NinjaTrader_ChelseaB; 02-14-2022, 02:50 PM.Chelsea B.NinjaTrader Customer Service
Comment
Latest Posts
Collapse
Topics | Statistics | Last Post | ||
---|---|---|---|---|
Started by inanazsocial, Today, 01:15 AM
|
1 response
5 views
0 likes
|
Last Post Today, 02:18 AM | ||
Started by rocketman7, Today, 02:12 AM
|
0 responses
6 views
0 likes
|
Last Post
by rocketman7
Today, 02:12 AM
|
||
Started by dustydbayer, Today, 01:59 AM
|
0 responses
1 view
0 likes
|
Last Post
by dustydbayer
Today, 01:59 AM
|
||
Started by trilliantrader, 04-18-2024, 08:16 AM
|
5 responses
23 views
0 likes
|
Last Post Today, 12:32 AM | ||
Started by Davidtowleii, Today, 12:15 AM
|
0 responses
3 views
0 likes
|
Last Post
by Davidtowleii
Today, 12:15 AM
|
Comment