Any ideas?
Announcement
Collapse
No announcement yet.
Partner 728x90
Collapse
NinjaTrader
Execute Trade X number of ticks from outter Boilnger band
Collapse
X
-
Execute Trade X number of ticks from outter Boilnger band
I'm using the Strategy wizard and I'm having an issue figuring out how to execute a trade from a certain number of ticks from a bollinger band (outter band)).
Any ideas?Tags: None
-
Between 2 and 4 ticks
Thanks..I think thats it. How about if I wanted it to execute between 2 and 4 ticks ? I added both scenario's using the NT strategy tool in to the same set (Set 1).
So I have:
Close[0] + 4 * Ticksize <=Bollinger(xxxx).Lower[0]
Close[0] + 2 * Ticksize >=Bollinger(xxxx).Lower[0]
The I have the enter short in the "do the following" area.
Is this correct?
Comment
-
not executing
Ok thanks.
For some reason it is not executing. I have the strategy added to the chart. Is there a setting I'm missing?
I have the order properties set to the following:
Set order quantity = by strategy (I just entered 2 on the execution amount.
Time in Force = GTC
Also, how would I change the TIME in Force for only x amount of bars?
Comment
-
-
Code
I didnt include the wizard code that was in it. I also attached the exported strategy..
namespace NinjaTrader.Strategy
{
/// <summary>
/// Enter the description of your strategy here
/// </summary>
[Description("Enter the description of your strategy here")]
public class AT1 : Strategy
{
#region Variables
// Wizard generated variables
private int myInput0 = 1; // Default setting for MyInput0
// User defined variables (add any user defined variables below)
#endregion
/// <summary>
/// This method is used to configure the strategy and is called once before any strategy method is called.
/// </summary>
protected override void Initialize()
{
SetProfitTarget("", CalculationMode.Ticks, 4);
SetStopLoss("", CalculationMode.Ticks, 6, false);
CalculateOnBarClose = true;
}
/// <summary>
/// Called on each bar update event (incoming tick)
/// </summary>
protected override void OnBarUpdate()
{
// Condition set 1
if (CrossAbove(EMA(14), Bollinger(2, 14).Lower, 1)
&& Close[0] + 2 * TickSize >= Bollinger(2, 14).Upper[0]
&& Close[0] + 4 * TickSize <= Bollinger(2, 14).Upper[0])
{
EnterLongLimit(2, 0, "");
}
// Condition set 2
if (CrossBelow(EMA(14), Bollinger(2, 14).Lower, 1)
&& Close[0] + 2 * TickSize >= Bollinger(2, 14).Lower[0]
&& Close[0] + 4 * TickSize <= Bollinger(2, 14).Lower[0])
{
EnterShortLimit(2, 0, "");
}
}
#region Properties
[Description("")]
[Category("Parameters")]
public int MyInput0
{
get { return myInput0; }
set { myInput0 = Math.Max(1, value); }
}
#endregion
}
}Attached Files
Comment
-
Thanks - first you want to enter a correct limit price, a limit value of 0 will not work. Try Bid / Ask with an offset from the Price category.
Then you will need to rework your rules, as they never evaluate to true and trigger an order...the same bar the EMA 14 crosses above the lower Bollingers will rarely if ever coincide with the Close being 2 ticks higher than the upper Bollinger band.BertrandNinjaTrader Customer Service
Comment
-
Thanks
Thanks. Actually, the settings are much different (boilnger is much tighter then the default settings I sent you).
So in order to close out the order if its not filled with in x amount of bars... I can't do that within the Strategy tool..so what would the code look like for that?
Comment
-
Still not running
I've attached the code.
I made the change to enter on ask or bid price. I then went to the strategies tab and started hit the start button.
I put my actual values in so you can see it in action. Any ideas as to what I'm doing wrong?
Thanks again for all your help.Attached Files
Comment
-
Thanks, you will need to check your conditions again, as they appear to be too 'hard' since no trade is triggered even when reverting back to market orders.
Also you limit orders for long and short both enter on the ask so you may want to recheck this, too.BertrandNinjaTrader Customer Service
Comment
-
This seems like a old thread, but like to why whey do we enter on 1st bar closing outside, isnt too early, as the trend continues and there could be many bars following in same direction and still closes outside the bar?
I enter on 2nd bar that closes inside the band after 1st bar closes outside. But wanted to share how others enter the trade and if this is good method?
Comment
Latest Posts
Collapse
Topics | Statistics | Last Post | ||
---|---|---|---|---|
Started by samish18, Today, 10:13 AM
|
0 responses
1 view
0 likes
|
Last Post
by samish18
Today, 10:13 AM
|
||
Started by kenz987, Yesterday, 10:20 AM
|
2 responses
12 views
0 likes
|
Last Post
by kenz987
Today, 10:13 AM
|
||
Started by nicthe, 08-23-2023, 07:53 AM
|
7 responses
196 views
0 likes
|
Last Post
by nicthe
Today, 09:26 AM
|
||
Started by nicthe, Today, 09:24 AM
|
0 responses
5 views
0 likes
|
Last Post
by nicthe
Today, 09:24 AM
|
||
Started by stalt, 12-28-2015, 01:36 PM
|
6 responses
1,536 views
0 likes
|
Last Post
by giulyko00
Today, 09:16 AM
|
Comment