The details for comparing values in a multi-time script can be found here: http://www.ninjatrader-support.com/H...ameInstruments
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
Indicator
Collapse
X
-
Hi ryebank,
To clarify, this is now on a single series (same time frame)?
Is this an "if" statement? Something like...
Code:if (SMA(Close,8)[0] >= SMA(Close,14)[0]) do something;
TimNinjaTrader Customer Service
Comment
-
hi
Yes single time frame.
An alert is generated if certain conditions are meet on bar[0] and one of these constraints is that SMA(Close,8)[0] is greater than or egual to SMA(Close,14)[0] - on all occasions where SMA(Close,8)[0] = 1.5362 and SMA(Close,14)[0] = 1.5362 it fails the test even though it passes all other constraints
Comment
-
Hi ryebank,
Try testing just the SMA condition by itself, to be sure what is truly happening, I tried the following, and the condition was satisfied several times.
I tried this and was able to get several instances (on a 5min ES chart dating back several months)
Code:if (SMA(Close,8)[0] == SMA(Close,14)[0]) { Print("Yes"); DrawVerticalLine("tag" + CurrentBar, 0, Color.Magenta, DashStyle.Solid, 4); }
TimNinjaTrader Customer Service
Comment
-
ok
i've run some tests and can see that if i use '<' then it passes so that implies that the value of SMA 8 is lower that SMA 14 but in the data box it says they are the same
How do i find out what the exact values of the SMA's are if they are not the same s in the data box
Comment
-
Hi ryebank,
You can Print the values, for example:
Code:if (CurrentBar<15) return; if (SMA(Close,8)[0] == SMA(Close,14)[0]) { Print("Yes"); Print(SMA(Close,8)[0]); Print(SMA(Close,14)[0]); DrawVerticalLine("tag" + CurrentBar, 0, Color.Magenta, DashStyle.Solid, 4); }
Gain does not provide Historical daily data: http://www.ninjatrader-support.com/H...HistoricalData
As a worksaround, you can try 1440 Minutes bars.TimNinjaTrader Customer Service
Comment
-
Mta
Thanks for all the info, but i'm struggling with referencing data form a daily chart to compare that with data from a 5/15/60 minute chart
What i'm trying to achieve is this
protected override void OnBarUpdate()
{
if (CurrentBar < 1) return;
if (EMA(Close,8)[0] > EMA(Close,14)[0] && (make the same comparison on the daily chart) || (EMA(Close,8)[0] < EMA(Close,14)[0] && (make the same comparison on the daily chart)
do something
}
}
Comment
-
Hello ryebank,
Please not that multi time frame indicators are only available in version 7.
You'll have to look at sampleMultiTimeFrame. Click Tools > Edit NinjaScript > strategy and open this file.
Documentation is available here.
Once you've added the daily series in the Initialize, its close value is then accessed with Closes[1]
Example:
if (EMA(Closes[1], 8)[0] > EMA(Closes[1],14)[0] )Ryan M.NinjaTrader Customer Service
Comment
Latest Posts
Collapse
Topics | Statistics | Last Post | ||
---|---|---|---|---|
Started by wzgy0920, 04-20-2024, 06:09 PM
|
2 responses
26 views
0 likes
|
Last Post
by wzgy0920
Today, 10:43 PM
|
||
Started by wzgy0920, 02-22-2024, 01:11 AM
|
5 responses
32 views
0 likes
|
Last Post
by wzgy0920
Today, 10:33 PM
|
||
Started by wzgy0920, Yesterday, 09:53 PM
|
2 responses
49 views
0 likes
|
Last Post
by wzgy0920
Today, 10:29 PM
|
||
Started by Kensonprib, 04-28-2021, 10:11 AM
|
5 responses
192 views
0 likes
|
Last Post
by Hasadafa
Today, 10:19 PM
|
||
Started by GussJ, 03-04-2020, 03:11 PM
|
11 responses
3,234 views
0 likes
|
Last Post Today, 08:07 PM |
Comment