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 Mindset, 04-21-2026, 06:46 AM
    0 responses
    90 views
    0 likes
    Last Post Mindset
    by Mindset
     
    Started by M4ndoo, 04-20-2026, 05:21 PM
    0 responses
    135 views
    0 likes
    Last Post M4ndoo
    by M4ndoo
     
    Started by M4ndoo, 04-19-2026, 05:54 PM
    0 responses
    68 views
    0 likes
    Last Post M4ndoo
    by M4ndoo
     
    Started by cmoran13, 04-16-2026, 01:02 PM
    0 responses
    120 views
    0 likes
    Last Post cmoran13  
    Started by PaulMohn, 04-10-2026, 11:11 AM
    0 responses
    69 views
    0 likes
    Last Post PaulMohn  
    Working...
    X