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
Help needed with Swing indicator
Collapse
X
-
Help needed with Swing indicator
I am using the Swing indicator in my strategy to enter trades when Close crosses a swing. The issue is that when I use a high strength setting such as 50 bars some entrees are made too far away from the swing. How do I prevent this and only have entrees made when Close crosses right next to the Swing?Tags: None
-
Hello relogical,
What code are you currently using in the condition?
If a print is added printing the Swing price, does this reflect the price that you are expecting?
For example:
Print(Close[0]: "+Close[0]+" > SwingHigh[0]: "+Swing(5).SwingHigh[0]+" && Close[1]: "+Close[1]+" < SwingHigh[1]: "+Swing(5).SwingHigh[1]);Chelsea B.NinjaTrader Customer Service
-
The entrees are made correct upon crossover of Swing line. The issue is that if the Swing strength is set to a high number the crossover is made not just where the Swing line ends but also several bars away. I just need to figure out how to make the entrees right at the end of the line.
Comment
-
Hello relogical,
So the order is being submitted at the correct time when the cross happens, but the order is not filling right away? Is this the issue?
In your prints, you are able to confirm that the cross happens at the right time and the order is being submitted, is this correct?
What type of order are you submitting?
Are you submitting a limit or stop order at a price that is not the current market price?Chelsea B.NinjaTrader Customer Service
Comment
-
The swing indicator when set to a high strength draws a longer swing line than a lower strength setting thus making my strategy enter into several trades on the same swing line even though the crossover is not right at the end of this line visually. In other words there are many crossover entrees made on the same swing line instead of just one.
Comment
-
Hello relogical,
Are you only wanting to allow 1 entry in a particular direction?
Are you wanting to somehow change the data so that there isn't multiple crossovers?
Are you running this with Calculate on bar close set to True and you are getting multiple trades on the same bar?
Are the multiple trades on different bars?Chelsea B.NinjaTrader Customer Service
Comment
-
Hello relogical,
In that case, I suggest you use a bool after the first entry that is reset once there is a new swing.
In #region Variables:
private bool allowTrades = true;
In OnBarUpdate:
if (/* new swing conditions */)
{
allowTrades = true;
}
if (/* entry conditions */ && allowTrades == true)
{
EnterLong();
allowTrades = false;
}Chelsea B.NinjaTrader Customer Service
Comment
Latest Posts
Collapse
Topics | Statistics | Last Post | ||
---|---|---|---|---|
Started by Mestor, 03-10-2023, 01:50 AM
|
11 responses
303 views
0 likes
|
Last Post
by z.franck
Today, 02:29 AM
|
||
Started by Padan, Today, 02:02 AM
|
0 responses
6 views
0 likes
|
Last Post
by Padan
Today, 02:02 AM
|
||
Started by bukowa, 11-09-2023, 06:07 PM
|
20 responses
407 views
0 likes
|
Last Post
by Adfra
Today, 01:36 AM
|
||
Started by yertle, Yesterday, 05:49 PM
|
2 responses
11 views
0 likes
|
Last Post
by yertle
Today, 12:12 AM
|
||
Started by kaywai, Today, 12:06 AM
|
0 responses
10 views
0 likes
|
Last Post
by kaywai
Today, 12:06 AM
|
Comment