Announcement
Collapse
No announcement yet.
Partner 728x90
Collapse
NinjaTrader
How to enter on OPEN exit on CLOSE of current bar using Strategy Builder Wzard?
Collapse
X
-
How to enter on OPEN exit on CLOSE of current bar using Strategy Builder Wzard?
I'm sure it's obvious once you know how to do it, but I can't figure it out. Using one-minute bars and a condition of (previous bar = Bearish Engulfing candlestick) I want to sell the open of the current bar and exit by buying the close of the current bar.Tags: None
-
Hi Calvin, thanks for writing in. This will require the use of IsFirstTickOfBar. The first set will be if(IsFirstTickOfBar == true && <entry condition>) and the exit will be
if(Position.MarketPosition == MarketPosition.Long(or Short)) and the strategy will keep track of the current bar by using a variable. I have an example of this here:
https://ninjatrader.com/support/foru...ce#post1190417
To check the market position, select "Current Market Position" on the left side, and then "MarketPosition>Long" on the right side. IsFirstTickOfBar can also be found in the Misc folder.
Kind regards,
-ChrisLLast edited by NinjaTrader_ChrisL; 07-18-2022, 09:10 AM.
-
I was only able to follow some of what you said. Here is what I was able to put together:
SET !
IfFirstTickOfBar = True
CandleStickPattern(ChartPattern BearishEngulfing, 4)[0] = 1
Do the following
EnterShort(DefaultQuantity, "").
SET 2
BarsSinceEntryExecution(0, "", 0) = 0
Do the following
ExitShort(DefaultQuantity. "")
It seems to do what I want. Would you please take a look at it and let me know if there's anything else I need to do?
Many thanks for your help. Calvin
Comment
-
Hi, thanks for posting, The builder is able to read the first tick of the bar using IsFirstTickOfBar, so you will need to run the script with Calculate = OnEackTick to enter the market at the start of the bar. I have a related example here for you to reference:
Hi, I'm currently working on a strategy that is utilizing OnTickChange data using the linked method. I am using a Tick Chart. The strategy uses onTickChange to make intrabar entry, and does so fine with the Set1 and Set2, but if/when profit target is hit, it will submit another order after the profit target if the
Unfortunately, I do not have a ready-made example of what you are asking about specifically.
Comment
Latest Posts
Collapse
| Topics | Statistics | Last Post | ||
|---|---|---|---|---|
|
Started by Mindset, 04-21-2026, 06:46 AM
|
0 responses
89 views
0 likes
|
Last Post
by Mindset
04-21-2026, 06:46 AM
|
||
|
Started by M4ndoo, 04-20-2026, 05:21 PM
|
0 responses
135 views
0 likes
|
Last Post
by M4ndoo
04-20-2026, 05:21 PM
|
||
|
Started by M4ndoo, 04-19-2026, 05:54 PM
|
0 responses
68 views
0 likes
|
Last Post
by M4ndoo
04-19-2026, 05:54 PM
|
||
|
Started by cmoran13, 04-16-2026, 01:02 PM
|
0 responses
119 views
0 likes
|
Last Post
by cmoran13
04-16-2026, 01:02 PM
|
||
|
Started by PaulMohn, 04-10-2026, 11:11 AM
|
0 responses
69 views
0 likes
|
Last Post
by PaulMohn
04-10-2026, 11:11 AM
|
Comment