I'm currently trying to code a strategy with the swing indicators but i'm not able to make it works. I want to draw a blue arrow when the swing high line hit the price line and a red arrow when the swing low line hit the price line. Thanks !
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 Line
Collapse
X
-
Swing Line
Hello everybody,
I'm currently trying to code a strategy with the swing indicators but i'm not able to make it works. I want to draw a blue arrow when the swing high line hit the price line and a red arrow when the swing low line hit the price line. Thanks !Tags: None
-
Hello Dimi2212,
Welcome to the NinjaTrader Support Forums!
The Swing indicator can have their plot points recalculated as incoming data is updated, thus making it challenging to use in a strategy via programmatic calls. They are first and foremost mean to be used as visual trading tools
With that said you can still use the indicators for your calculations but would need to understand what price points can be accessed at which time programmatically, since those can be different from the historically plotted ones.
For example you may still do something like
Code:if (Swing(5).SwingHigh[0] > Swing(5).SwingHigh[6]) { DrawHorizontalLine("My horizontal line" + CurrentBar, Swing(5).SwingHigh[0], Color.Blue); }
JCNinjaTrader Customer Service
-
Hello Dimi2212,
I still am not sure about your condition for your Entry signals.
What are your conditions for your strategy to enter an order? Are you to see if the High price of those bars is greater than the Swing High or are you looking at where the line has been drawn?JCNinjaTrader Customer Service
Comment
-
Thanks for the reply JC,
the entry signal would be when the high price of those bars is greater than the precedent swing high. When the price cross above the precedent swing high and close above it. i'm just not able to visualize how to code this cross above.
Comment
-
Hello Dimi2212,
Thanks for your patience.
Here is example of how you may do this using the Strategy Wizard that you may view.
To Import
1. Download the attached file to your desktop
2. From the Control Center window select the menu File > Utilities > Import NinjaScript
3. Select the downloaded file
Note that on any files that say "File already exists on your PC" that start with an "@" symbol are the ones that came preloaded inside of NinjaTrader so you would say "No" so that you do not override those files.Attached FilesJCNinjaTrader Customer Service
Comment
Latest Posts
Collapse
Topics | Statistics | Last Post | ||
---|---|---|---|---|
Started by Graci117, Today, 09:02 PM
|
1 response
8 views
0 likes
|
Last Post Today, 09:09 PM | ||
Started by ETFVoyageur, Today, 07:55 PM
|
0 responses
7 views
0 likes
|
Last Post
by ETFVoyageur
Today, 07:55 PM
|
||
Started by janio973, Today, 07:24 PM
|
1 response
7 views
0 likes
|
Last Post Today, 07:35 PM | ||
Started by aligator, 01-06-2022, 12:14 PM
|
4 responses
248 views
0 likes
|
Last Post
by john_44573
Today, 06:11 PM
|
||
Started by reynoldsn, Today, 05:56 PM
|
0 responses
15 views
0 likes
|
Last Post
by reynoldsn
Today, 05:56 PM
|
Comment