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
Take long trade on green bar after every red bar pull back
Collapse
X
-
Take long trade on green bar after every red bar pull back
I am making a strategy where I want to take a long position when a green candle closes above the sma 9 while hma 30 is rising and vice versa for shorts. I have all that figured out and entered into the strategy builder. I need some help on getting the strategy to take a long position when the rules happen each time after a 2 or 3 red candle pullback. I used the SavedBar int but that doesnt seem to work. I have attached a picture of what I am trying to do.Tags: None
-
Hello Barrett,
Thanks for your post.
I would suggest using a bool to control when you are allowed to enter a long or short trade, and to change EntriesPerDirection and EntryHandling in the Default Properties page of the Strategy Builder to allow entering multiple times in the same direction.
The bool can start as true, and be set to false when your entry order is submitted. The bool can be reset back to true when you see a pullback, or when the Strategy Position is flat.
Please see the conditions and actions examples below to see how you can make position checks.
Conditions - https://ninjatrader.com/support/help...on_builder.htm
Actions - https://ninjatrader.com/support/help...t8/actions.htm
As an example, your pullback conditions can be modelled by looking at the last 3 bars to see if 2 bars ago is green (Close[2] > Open[2]), if 1 bar ago is green (Close[1] > Open[1]), and if the current bar is red (Close[0] < Open[0])
We look forward to assisting.JimNinjaTrader Customer Service
-
Hello Barrett,
The specific entry conditions may need additional logic so they are taken (as an example) if the strategy is already in a position, or if the strategy is flat. Additional checks on other bar price levels can be used to further narrow your entry conditions. The Conditions examples can share how to make position checks if you would like to use that criteria with your entry signals.
You could consider using the Slope which can be used with an indicator as input to see if the indicator plot is rising or falling. You could also consider using IsRising and IsFalling. Slope, Rising and Falling can be found under Misc in Conditions.
When building new conditions, it can help to make an action that prints the value you want to use so you can see how you may model your logic.JimNinjaTrader Customer Service
Comment
-
Hello Barrett,
I understand this but there will be a problem when its 2 green bars right after the red bar before the signal bar. Im not sure how to get past that.
An example for checking the strategy position can be found here - https://ninjatrader.com/support/help...ionComparisons
Also is there a way I could have the HMA be either rising or flat and falling or flat?JimNinjaTrader Customer Service
Comment
Latest Posts
Collapse
Topics | Statistics | Last Post | ||
---|---|---|---|---|
Started by IanS00, 03-27-2024, 11:24 AM
|
2 responses
10 views
0 likes
|
Last Post Today, 02:00 AM | ||
Started by Mariawilcoxi, Today, 01:32 AM
|
0 responses
1 view
0 likes
|
Last Post
by Mariawilcoxi
Today, 01:32 AM
|
||
Started by gleichnerany, Today, 01:17 AM
|
0 responses
4 views
0 likes
|
Last Post
by gleichnerany
Today, 01:17 AM
|
||
Started by WHICKED, 03-27-2024, 12:33 PM
|
4 responses
45 views
0 likes
|
Last Post Today, 12:28 AM | ||
Started by f.saeidi, Today, 12:12 AM
|
0 responses
6 views
0 likes
|
Last Post
by f.saeidi
Today, 12:12 AM
|
Comment