Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Enter Long 10 pts above 5 min ORB

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    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?
    Attached Files

    #2
    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.

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by CarlTrading, 03-31-2026, 09:41 PM
    1 response
    47 views
    0 likes
    Last Post NinjaTrader_ChelseaB  
    Started by CarlTrading, 04-01-2026, 02:41 AM
    0 responses
    23 views
    0 likes
    Last Post CarlTrading  
    Started by CaptainJack, 03-31-2026, 11:44 PM
    0 responses
    33 views
    1 like
    Last Post CaptainJack  
    Started by CarlTrading, 03-30-2026, 11:51 AM
    0 responses
    50 views
    0 likes
    Last Post CarlTrading  
    Started by CarlTrading, 03-30-2026, 11:48 AM
    0 responses
    42 views
    0 likes
    Last Post CarlTrading  
    Working...
    X