Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Strategy using PriorOHLC

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

    Strategy using PriorOHLC

    I have been trying to get a pretty simple strategy working but can't get any trades to trigger. I just want it to enter a position when price (High/Low) crosses the prior open. Here is aht conditions I am using...

    // Set 1
    if (CrossBelow(Low, PriorDayOHLC1.PriorOpen, 1))
    {
    EnterLong(Convert.ToInt32(DefaultQuantity), "");
    }

    // Set 2
    if (CrossAbove(High, PriorDayOHLC1.PriorOpen, 1))
    {
    EnterShort(Convert.ToInt32(DefaultQuantity), "");
    }​

    Nothing happens when the high or low crosses the prior open. I attached the entire .cs file too

    Thanks
    Attached Files

    #2
    Hello Mlarocco,

    Thanks for your post.

    When testing the strategy you shared on my end I did not see the strategy place trades and I did not see any error messages appear.

    That said, it seems that the conditions in the strategy used to submit the orders are not becoming true. You would need to add debugging prints to the strategy to determine if the logic is being reached.

    If the expected trade(s) are not appearing, this would indicate that the condition to place the order is not evaluating as true or the order is being ignored for other reasons.

    To understand why the script is behaving as it is, such as placing orders or not placing orders when expected, it is necessary to add prints to the script that print the values used for the logic of the script to understand how the script is evaluating.

    In the strategy add prints (outside of any conditions) that print the values of every variable used in every condition that places an order along with the time of that bar.

    Prints will appear in the NinjaScript Output window (New > NinjaScript Output window).

    Below is a link to a forum post that demonstrates how to use prints to understand behavior.

    https://ninjatrader.com/support/foru...121#post791121

    Let us know if we may assist further.​​
    <span class="name">Brandon H.</span><span class="title">NinjaTrader Customer Service</span><iframe name="sig" id="sigFrame" src="/support/forum/core/clientscript/Signature/signature.php" frameborder="0" border="0" cellspacing="0" style="border-style: none;width: 100%; height: 120px;"></iframe>

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by NullPointStrategies, Yesterday, 05:17 AM
    0 responses
    56 views
    0 likes
    Last Post NullPointStrategies  
    Started by argusthome, 03-08-2026, 10:06 AM
    0 responses
    133 views
    0 likes
    Last Post argusthome  
    Started by NabilKhattabi, 03-06-2026, 11:18 AM
    0 responses
    73 views
    0 likes
    Last Post NabilKhattabi  
    Started by Deep42, 03-06-2026, 12:28 AM
    0 responses
    45 views
    0 likes
    Last Post Deep42
    by Deep42
     
    Started by TheRealMorford, 03-05-2026, 06:15 PM
    0 responses
    49 views
    0 likes
    Last Post TheRealMorford  
    Working...
    X