Also how would I assign a limit order above/below the high/low? And am I able to add a stoploss/target that adjusts to the high/low of the 8:30min candle?
Announcement
Collapse
No announcement yet.
Partner 728x90
Collapse
NinjaTrader
Candle High/Low - Stop/Target
Collapse
X
-
Candle High/Low - Stop/Target
I'm would to like build a strategy that uses the high & lows of the 8:30am 1 min candle, to place a buy/stop limit order 6 ticks, for example, above the high for a long and below the low for a short. Is there a simple way of selecting the values of the 8:30am candle?
Also how would I assign a limit order above/below the high/low? And am I able to add a stoploss/target that adjusts to the high/low of the 8:30min candle?Tags: None
-
Hello kevo93,
Thank you for your post.
You could set a time condition that checks if the current time is 8:30, and if so it saves the high and low of the current bar to variables that you may use later. Are you planning to do this in the Strategy Builder or in the NinjaScript Editor? I would be glad to provide a quick example depending on how you are creating your script.
I look forward to your reply.
-
Hello kevo93,
Thank you for that information.
I apologize for asking more questions; I would like to further clarify. Are you looking to place orders during the 8:30am candle or do you want to save those High and Low values for setting the prices of orders placed at a different time? Depending on what you are looking for, there are different options so I would like to provide the most relevant approach. You also mentioned using "a stoploss/target that adjusts to the high/low of the 8:30min candle" - what type of adjustment related to the high/low of that candle are you referring to?
I appreciate your patience and look forward to a more detailed description of what you are looking to achieve in the Strategy Builder.
Comment
-
To explain further, I want my trades to execute after 8:30am, so 8:31am until 9am.
For the stop/target adjustment, Ideally as I do in my manual trading I enter long or short 6 ticks above the high or below the low, with a profit target 2x the size of the 8:30am candle (high to low), and for my stoploss I use one of 2 options either I use the low of the candle on long positions, and the high on short, OR 75% of the candle.
Comment
-
Hello kevo93,
Thank you for your reply.
I have created a video demonstrating how you could get your entries, stops, and targets set up according to your description:
World's leading screen capture + recorder from Snagit + Screencast by Techsmith. Capture, edit and share professional-quality content seamlessly.
When it comes to math in the Strategy Builder, it is done using the Offset option:
An offset can't be used on defined variables, so it can be tricky to calculate the desired values. In some cases, you may want to create a custom series to create custom math calculations. This starts to stretch the capabilities of the Strategy Builder and make it more complex, as math can be performed in an unlocked NinjaScript that is edited in the NinjaScript Editor without having to use a custom series. For some details about using a custom series to perform math, please see the following post:
with regard to the attached image: Line A is an indicator Line B is the m period MAX of line A Line C is an average of this indicator A Line D is another average of this indicator A is it possible, possibly using the strategy builder, but without adding a temporary variable, to set on the condition: line C crosses below line D
For more examples of conditions and actions in the Strategy Builder, please see the following pages:- https://ninjatrader.com/support/help...on_builder.htm
- https://ninjatrader.com/support/help...t8/actions.htm
Please let me know if I may be of further assistance.
Comment
-
Hi Emily,
Attached are screenshots of my strategy builder.
As is no trades are being executed. Can you see what's not working?
4 PhotosLast edited by NinjaTrader_Emily; 02-13-2023, 09:27 AM.
Comment
-
Attached is a chart; the highlighted area represents what I want the AmHigh & AmLow variables to be set to, the green line would be my Long Limit Entry, the red line for Short Limit.
The blue dot is where a long entry should of been.
One more thing, is it possible to limit the number of trades to only 1 per direction within that time filter? 1 Long and 1 Short?1 Photo
Comment
-
Hello kevo93,
Thank you for your patience.
I would first like to apologize; I was incorrect in some of the guidance I provided because I was really focused on how to calculate the desired values and spaced that SetProfitTarget and SetStopLoss have a limit to using a fixed value only when used in the Strategy Builder. They are set inside of OnStateChange() when State == State.Configure when used in the Strategy Builder, and in order to use dynamic values like we attempted that requires them to be in an unlocked script inside of OnBarUpdate(). This is mentioned on the help guide pages for the Set() methods like the following:- https://ninjatrader.com/support/help...etstoploss.htm
- https://ninjatrader.com/support/help...ofittarget.htm
What you have described for your strategy is still possible in the Strategy Builder using Exit methods in the actions section of the Conditions and Actions page. My colleague has posted some good information and critical considerations related to doing this here:
Hi Ninjas, How can I create a ProfitTarget and StopLoss according to the size of each candlestick (High and Low) when I just enter (Long and Short) using Strategy Builder? I have tried this but it doesn't work: Variable: TargetStopPoints Double TargetStopTicks Double Do the following: EnterLong(DefaultQuantity,"")
As for no trades being submitted, I see in Set 2 that you have both EnterLongLimit and EnterShortLimit set up. Typically, you may not go long and short at the same time. Additionally, there are order handling rules that reduce unwanted positions which are detailed here:
https://ninjatrader.com/support/help...rnalOrderHandl ingRulesThatReduceUnwantedPositions
For example, "Methods that generate orders to enter a position will be ignored if:
•The strategy position is flat and an order submitted by an enter method (EnterLongLimit() for example) is active and the order is used to open a position in the opposite direction"
You may certainly limit the number of trades per direction; the default value for "Entries per direction" may be set in the Default Properties page of the strategy builder, and it may also be adjusted in the strategy properties when enabling a strategy from a chart or the Strategies tab of the Control Center:
As the strategy you are building is a little complex, I recommend setting up the condition/action sets for only one direction first (either long or short). Once you have the logic set for the entry and the proper stop and target information for one direction, you can add new sets to put your conditions for an entry and its stops/targets in the other direction.
You can also contact a professional NinjaScript Consultant who would be eager to create or modify this script at your request or assist you with your script. The NinjaTrader Ecosystem has affiliate contacts who provide educational as well as consulting services. Please let me know if you would like a list of affiliate consultants who would be happy to create this script or any others at your request or provide one on one educational services.
Please let me know if I may be of further assistance.
Comment
-
Hello kevo93,
You can search our list of NinjaScript consultants through the link below. Simply enter a consultant name or search by using our filter categories. Once you have identified your consultants of choice, please visit each consultant's site for more information or contact them directly to learn more:You can locate the contact information for the consultants on their direct websites for any additional questions you may have. Since these consultants are third-party services for NinjaTrader, all pricing and support information will need to be obtained through the consultant.
The NinjaTrader Ecosystem website is for educational and informational purposes only and should not be considered a solicitation to buy or sell a futures contract or make any other type of investment decision. The companies and services listed on this website are not to be considered a recommendation and it is the reader's responsibility to evaluate any product, service, or company. NinjaTrader Ecosystem, LLC is not responsible for the accuracy or content of any product, service or company linked to on this website.
Let me know if I may be of further assistance.
Christopher S.NinjaTrader Customer Service
Comment
Latest Posts
Collapse
| Topics | Statistics | Last Post | ||
|---|---|---|---|---|
|
Started by NullPointStrategies, Yesterday, 05:17 AM
|
0 responses
62 views
0 likes
|
Last Post
|
||
|
Started by argusthome, 03-08-2026, 10:06 AM
|
0 responses
134 views
0 likes
|
Last Post
by argusthome
03-08-2026, 10:06 AM
|
||
|
Started by NabilKhattabi, 03-06-2026, 11:18 AM
|
0 responses
75 views
0 likes
|
Last Post
|
||
|
Started by Deep42, 03-06-2026, 12:28 AM
|
0 responses
45 views
0 likes
|
Last Post
by Deep42
03-06-2026, 12:28 AM
|
||
|
Started by TheRealMorford, 03-05-2026, 06:15 PM
|
0 responses
50 views
0 likes
|
Last Post
|
Comment