protected override void Initialize() { CalculateOnBarClose = true; Add("ES ##-##", PeriodType.Day, 1); } protected override void OnBarUpdate() { if (BarsInProgress != 0) return; // Long Entry #1 if (CrossAbove(SMA(5), SMA(20), 1)) { EnterLong(1, DefaultQuantity, "LEn1"); } // Long Exit #1 if (CrossBelow(SMA(5), SMA(20), 1)) { ExitLong(1, "LEx1", "LEn1"); } }
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
Trade /ES on VIX chart
Collapse
X
-
Trade /ES on VIX chart
Hello, I would like to run a strategy on a VIX chart (primary bars), but place trades on /ES (secondary bars). I have cobbled together example code below, however, it doesn't do what I want to achieve. Any help on how to do this would be appreciated.
Code:Tags: None
Latest Posts
Collapse
Topics | Statistics | Last Post | ||
---|---|---|---|---|
Started by nandhumca, Today, 03:41 PM
|
0 responses
4 views
0 likes
|
Last Post
by nandhumca
Today, 03:41 PM
|
||
Started by The_Sec, Today, 03:37 PM
|
0 responses
3 views
0 likes
|
Last Post
by The_Sec
Today, 03:37 PM
|
||
Started by GwFutures1988, Today, 02:48 PM
|
1 response
5 views
0 likes
|
Last Post Today, 03:09 PM | ||
Started by ScottWalsh, 04-16-2024, 04:29 PM
|
6 responses
33 views
0 likes
|
Last Post
by ScottWalsh
Today, 02:57 PM
|
||
Started by frankthearm, Today, 09:08 AM
|
10 responses
36 views
0 likes
|
Last Post
by frankthearm
Today, 02:54 PM
|
Comment