Any thoughts on how to convert the zero (na) value to another higher value during these periods before the true swing values are produced?
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
Swing values producing 'na' result
Collapse
X
-
Swing values producing 'na' result
I've noticed that the swing indicator produces 'na' or zero value when there is nothing to plot. This is throwing off my exits which depend on an accurate cross above the swingHigh. I understand that the Swing has these periods where there is nothing to paint to the plot when the swing condition hasn't developed yet. The problem is that my exit is using the zero (na) value as a legitimate value to trigger the exit.
Any thoughts on how to convert the zero (na) value to another higher value during these periods before the true swing values are produced?
Tags: None
-
Hello ShruggedAtlas,
Thanks for your post.
Perhaps you could check to see if the swing value is null or zero and then set it to another value instead? Have you tried that yet?Last edited by NinjaTrader_JoshG; 02-28-2019, 10:00 AM.Josh G.NinjaTrader Customer Service
-
yes I am experimenting with this:
temp = (SwingADX.SwingHigh[0] == null)? 100:SwingADX.SwingHigh[0];
Then using this as the exit:
if (Position.MarketPosition == MarketPosition.Long
&& Position.Quantity == PositionSize
//&& BreakEven != true
&& ADX3[0] > temp)
{
ExitLong(@"RESET", @"LE1");
Print(string.Format("{0}; {1}; {2}", Time[0], ADX3[0], temp));
}
but unfortunately I get the same result
Comment
-
-
Update: Ok it looks like Swing(ADX) is not producing a null value even though it shows 'na' in the Data Box. Printing to Output yields what looks like the prior swinghigh from several days back. I haven't a clue how to resolve this.
The image shows time; ADX; temp;
since temp is never null but rather is the prior ADX value my code won't ever convert the swing value to what I want1 PhotoLast edited by ShruggedAtlas; 02-28-2019, 05:44 AM.
Comment
Latest Posts
Collapse
Topics | Statistics | Last Post | ||
---|---|---|---|---|
Started by algospoke, Today, 06:40 PM
|
0 responses
10 views
0 likes
|
Last Post
by algospoke
Today, 06:40 PM
|
||
Started by maybeimnotrader, Today, 05:46 PM
|
0 responses
7 views
0 likes
|
Last Post Today, 05:46 PM | ||
Started by quantismo, Today, 05:13 PM
|
0 responses
7 views
0 likes
|
Last Post
by quantismo
Today, 05:13 PM
|
||
Started by AttiM, 02-14-2024, 05:20 PM
|
8 responses
168 views
0 likes
|
Last Post
by jeronymite
Today, 05:00 PM
|
||
Started by cre8able, Today, 04:22 PM
|
0 responses
10 views
0 likes
|
Last Post
by cre8able
Today, 04:22 PM
|
Comment