Announcement
Collapse
No announcement yet.
Partner 728x90
Collapse
NinjaTrader
Enter Long 10 pts above 5 min ORB
Collapse
X
-
Enter Long 10 pts above 5 min ORB
This strategy is simple. I want to enter long 10 pts above and short 10 pts below 9:35am ET candle. I wrote the code it seems to always enter at the high of the 9:35 am candle. What's wrong with this code? Also, I want this strategy to execute just once per day. What changes should I make? Can anyone help me here please?Tags: None
-
Hello JustPats,
Thank you for your note.
I'd recommend adding some prints to your logic here to see what the values you're actually getting for High[0] and Low[0] are there, I think you'll find they are both equal to the open of that candle since you're running this OnEachTick and grabbing those values on the first tick of that bar. Further, make sure you're setting the stop loss before the entry as it needs to be set up first to get submitted when the entry fills:
if (Times[0][0].TimeOfDay == new TimeSpan(09, 35, 0) && IsFirstTickOfBar)
{
high935Candle = (High[0]);
entryPrice = high935Candle + (10 * TickSize);
low935Candle = Low[0];
stopLossPrice = low935Candle - (10 * TickSize);
}
if ((ToTime(Time[0]) >= 093500 && ToTime(Time[0]) < 160000) && entryPrice > 0 && stopLossPrice > 0
&& !tradeDoneToday)
{
if(Position.MarketPosition != MarketPosition.Long)
{
SetStopLoss("", CalculationMode.Price, stopLossPrice, false);
EnterLongStopLimit (5, entryPrice, entryPrice - (1 * TickSize), @"Long");
Print (entryPrice);
}
}
I'd consider setting the entry 10 ticks above the candle prior to the entry instead to try to get the behavior you're looking for.
Please let us know if we may be of further assistance to you.
Latest Posts
Collapse
| Topics | Statistics | Last Post | ||
|---|---|---|---|---|
|
Started by NullPointStrategies, Today, 05:17 AM
|
0 responses
50 views
0 likes
|
Last Post
|
||
|
Started by argusthome, 03-08-2026, 10:06 AM
|
0 responses
126 views
0 likes
|
Last Post
by argusthome
03-08-2026, 10:06 AM
|
||
|
Started by NabilKhattabi, 03-06-2026, 11:18 AM
|
0 responses
69 views
0 likes
|
Last Post
|
||
|
Started by Deep42, 03-06-2026, 12:28 AM
|
0 responses
42 views
0 likes
|
Last Post
by Deep42
03-06-2026, 12:28 AM
|
||
|
Started by TheRealMorford, 03-05-2026, 06:15 PM
|
0 responses
46 views
0 likes
|
Last Post
|

Comment