. I am trying to do something very simple but can't get it to work right. I am using the strategy wizard and trying to simply put on a long position when price touches 1 tick past the high of the current day. I have wasted way too much time on this as I just know it is very simple. Any help would be appreciated.
Announcement
Collapse
No announcement yet.
Partner 728x90
Collapse
NinjaTrader
Break HOD go long
Collapse
X
-
Break HOD go long
ok...I am a noob but I think I should be able to figure this out
. I am trying to do something very simple but can't get it to work right. I am using the strategy wizard and trying to simply put on a long position when price touches 1 tick past the high of the current day. I have wasted way too much time on this as I just know it is very simple. Any help would be appreciated.
Tags: None
-
I suppose since I am new at this I am using flawed logic. Here is what I have come up with and a pic of what I get:
// This namespace holds all strategies and is required. Do not change it.
namespace NinjaTrader.Strategy
{
/// <summary>
/// Enter the description of your strategy here
/// </summary>
[Description("Enter the description of your strategy here")]
public class HiLowBreak : Strategy
{
#region Variables
// Wizard generated variables
private int target = 1; // Default setting for Target
private int stop = 1; // Default setting for Stop
// 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()
{
Add(CurrentDayOHL());
SetProfitTarget("", CalculationMode.Ticks, Target);
SetStopLoss("", CalculationMode.Ticks, Stop, false);
CalculateOnBarClose = true;
}
/// <summary>
/// Called on each bar update event (incoming tick)
/// </summary>
protected override void OnBarUpdate()
{
// Condition set 1
if (GetCurrentBid() > CurrentDayOHL().CurrentHigh[1] + 1 * TickSize)
{
EnterLong(DefaultQuantity, "");
}
}
#region Properties
[Description("")]
[GridCategory("Parameters")]
public int Target
{
get { return target; }
set { target = Math.Max(0, value); }
}
[Description("")]
[GridCategory("Parameters")]
public int Stop
{
get { return stop; }
set { stop = Math.Max(0, value); }
}
#endregion
}
Comment
-
Comment
-
I suggest you add a drawing to your strategy so you can visually see when exactly it would trigger to place a trade on the next bar - http://www.ninjatrader-support.com/H...gOnAChart.html
Comment
-
ok I will try that, but I actually want it to place the trade on the current bar...on touch one tick beyond HOD
Comment
-
Then you need to work with CalculateOnBarClose = false in realtime to be able to update the calcs on each tick - http://www.ninjatrader-support.com/H...BarClose1.html
Comment
-
well...you must love working with noobs....I can't get a drawing object to print in my strategy. Nothing shows up on the chart. ideas?
Comment
-
I've tried 0, 1, -1. I can get a bar color to change or outline color to change...cant get dot, triangle, arrow, etc. to print
Comment
-
Please follow the example here very closely - http://www.ninjatrader-support.com/H...gOnAChart.html
0, 1, -1 would not make sense, to draw you would want to use a valid value on your Y Price axis, such as the High / Low with an offset.
Comment
-
Latest Posts
Collapse
| Topics | Statistics | Last Post | ||
|---|---|---|---|---|
|
Started by Geovanny Suaza, 02-11-2026, 06:32 PM
|
0 responses
656 views
0 likes
|
Last Post
|
||
|
Started by Geovanny Suaza, 02-11-2026, 05:51 PM
|
0 responses
371 views
1 like
|
Last Post
|
||
|
Started by Mindset, 02-09-2026, 11:44 AM
|
0 responses
109 views
0 likes
|
Last Post
by Mindset
02-09-2026, 11:44 AM
|
||
|
Started by Geovanny Suaza, 02-02-2026, 12:30 PM
|
0 responses
574 views
1 like
|
Last Post
|
||
|
Started by RFrosty, 01-28-2026, 06:49 PM
|
0 responses
579 views
1 like
|
Last Post
by RFrosty
01-28-2026, 06:49 PM
|

Comment