Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Strategy Builder - Entering within forming candle

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

    Strategy Builder - Entering within forming candle

    Hello,

    I have been trying to figure out how to enter long when price breaks the previous candle's high and vise versa for shorting. I have my strategy calculate on each tick and have tried experimenting with limit orders but don't work. I have tried using the condition 'GetCurrentAsk(Default input) > High[0]' or 'CrossAbove(GetCurrentAsk(0), High, 1)' but neither of these work as no trades will be executed by the strategy. Below is an example of what I am looking for.

    Below is an example. pretend the most recently formed candle is still being formed and once price pushes it above the previous candle's high, I want to enter a long immediately. I have marked where I typically would have entered for this long.

    #2
    Hello davidson23,

    Thanks for your post.

    To compare the current ask price to the previous bar's High price, you would need to pass in a BarsAgo value of 1 when calling High (High[1]). High[1] would be referencing the previous bar's High price.

    For example, the condition might look something like this:

    if (GetCurrentAsk() > High[1])
    {
    //do something
    }


    Making Price Data Comparisons: https://ninjatrader.com/support/help...ataComparisons

    Ultimately, 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.

    You should add debugging prints outside of the condition that prints out each value being compared in the condition to see how they are evaluating in your script. Prints will appear in a 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
    Last edited by NinjaTrader_BrandonH; 07-02-2023, 01:06 PM.
    <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
    54 views
    0 likes
    Last Post NullPointStrategies  
    Started by argusthome, 03-08-2026, 10:06 AM
    0 responses
    131 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
    44 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