Announcement

Collapse

Looking for a User App or Add-On built by the NinjaTrader community?

Visit NinjaTrader EcoSystem and our free User App Share!

Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less

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.​​
    Brandon H.NinjaTrader Customer Service

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by Jimmyk, 01-26-2018, 05:19 AM
    6 responses
    834 views
    0 likes
    Last Post emuns
    by emuns
     
    Started by jxs_xrj, 01-12-2020, 09:49 AM
    6 responses
    3,290 views
    1 like
    Last Post jgualdronc  
    Started by Touch-Ups, Today, 10:36 AM
    0 responses
    9 views
    0 likes
    Last Post Touch-Ups  
    Started by geddyisodin, 04-25-2024, 05:20 AM
    11 responses
    62 views
    0 likes
    Last Post halgo_boulder  
    Started by Option Whisperer, Today, 09:55 AM
    0 responses
    8 views
    0 likes
    Last Post Option Whisperer  
    Working...
    X