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
Using the current bar size (in ticks) to create a safety stop and target.
Collapse
X
-
Using the current bar size (in ticks) to create a safety stop and target.
I am trying to use the NT8 strategy builder to create a safety stop and a target stop based on the tick size of the entry bar. I am currently concentrating on plugging in the ATR with a look-back of one into the "percent" window in the last tab of the SB to no avail. Tried lots of different things as well. Help please.Tags: None
-
Hello White Fork,
The Strategy Builder allows you to set a number of ticks from entry the stop is placed. This automatically uses the TickSize of the instrument.
Is this insufficient for your needs?
Any custom calculation would require unlocking the script and coding by hand.Chelsea B.NinjaTrader Customer Service
-
Thanks Chelsea! I have been working on figuring out coding for my system. Mostly just cobbling bits together and tweeking them at this point. However I can't find any previously code examples of my above request in the NT8 language. How would I express the above in code?
Comment
-
Hello White Fork,
Are you asking about using an offset with a number of ticks?
This is demonstrated in the Strategy Builder 301 course for the stop loss and profit target using a variable that represents a number of ticks from entry the stop or target will be placed.
Below is a public link.
Also below is a public link to the help guide.
Chelsea B.NinjaTrader Customer Service
Comment
-
Ticks, yes. But I want the "amount" of ticks to be derived from the size of the entry bar. When I get an entry signal from my "system". I am trying to generate a stop loss and target based on the size of the entry bar. Stop should be one (long signal) entry bar size away from the low of the (long signal) entry bar and target should be two (long signal) entry bar lengths away from the high of the(long signal) entry bar. Make sense?
Comment
-
Thank you for the links. I have already watched everything you guys have put out. In strategy builder (last tab) you can set the stop loss dialog "mode" box to ticks. Then in the "value" box pick whatever you want to generate the number of ticks. I totally get this. In the past I have linked the "Value" to my own input so as to control the number of ticks from my strategy after creating. I get this. i have also set the "value" box to "percent" and used the ATR indicator and nested ATR indicators inside of that but with out getting the desired results. What I can't figure out is what I pick in the "value" window that will allow me to place my stop loss one (or several) full bar length (entry bar/current bar) away from entry. Same with Target. I have tried nearly everything that won't return an error. Nothing works. Also the "Current Bar" in the misc tab, and so on. Will you please explain in detail how to do this? Thank you.
Comment
-
Hello White Fork,
The Strategy Builder is not capable of math. Any kind of math other than using an offset would require unlocking the script and coding by hand.
From example:
Print( (Close[0] - Open[0]) / TickSize );
This would print the number of ticks from the open to the close.
That type of custom calculation could be used to calculate a new price for an exit order or could be used for a number of ticks for set methods using CalculationMode.Tick.Chelsea B.NinjaTrader Customer Service
Comment
-
-
So I tried to build what I've been looking for (original post above), per your reply's and the help documents on the NT site. Unfortunately it's not working.See enclosed image (highlighted section of code). Any thoughts?1 Photo
Comment
-
Chelsea, You last reply "That type of custom calculation could be used to calculate a new price for an exit order or could be used for a number of ticks for set methods using CalculationMode.Tick. " How is it possible to use the custom statement "( (Close[0] - Open[0]) / TickSize );" in the Calculation Mode?"
Comment
-
What I'm not understanding is how to plug "( (Close[0] - Open[0]) / TickSize );" into "SetProfitTarget(CalculationMode.Ticks, ProfitTargetTicks);". I tried plugging it into "ProfitTargetTicks" intead of "= 200;", but I got an error.
Comment
-
Hello White Fork,
You are able to use Close[0] or any other bar information when the bars start updating in OnBarUpdate().
If you intend to set an exact price with CalculationMode.Price instead of a pre-set number of ticks, this logic will need to be performed for each bar in OnBarUpdate().Chelsea B.NinjaTrader Customer Service
Comment
Latest Posts
Collapse
Topics | Statistics | Last Post | ||
---|---|---|---|---|
Started by RaygunWizzle, Yesterday, 08:52 PM
|
3 responses
11 views
0 likes
|
Last Post Today, 02:50 PM | ||
Started by Tim-c, Today, 08:36 AM
|
4 responses
14 views
0 likes
|
Last Post Today, 02:45 PM | ||
Started by JohnS52, 03-22-2024, 08:06 AM
|
4 responses
28 views
0 likes
|
Last Post
by JohnS52
Today, 02:30 PM
|
||
Started by carnitron, 03-25-2024, 01:59 PM
|
11 responses
53 views
0 likes
|
Last Post
by carnitron
Today, 02:18 PM
|
||
Started by Gerik, 12-21-2023, 08:20 AM
|
15 responses
203 views
0 likes
|
Last Post
by Mindset
Today, 02:06 PM
|
Comment