Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Trying to build this simple strategy

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

    Trying to build this simple strategy

    Hi all, I am very new at this. I am hoping someone can help me

    I want to build this very simple auto trading strategy:

    I need to be able to look at the candle that just closed, and
    if it was green - go long for the entire length of the next candle
    if it was red - go short for the entire length of the next candle

    And I would like to enter in the number of total trades ahead of time - like 20,30 or 150... And the strategy would then run trades for every candle that many times.

    I keep using the Strategy Builder, but I cannot figure out what I have to use in the Conditions and Actions to accomplish this.

    #2
    Hello vixtor,

    Thank you for your post.

    Please see the attached example strategy that demonstrates how this could be accomplished. The strategy check if the Close is greater than the Open for up bars and calls EnterLong. It also checks if the Close is less than the Open for down bars and calls EnterShort. Then we check if the strategy is in a long or short position and if BarsSinceEntryExecutuion is equal to 1 and exit our long or short position. The number of trades input would be used to determine the number of trades placed by EnterLong/EnterShort. Please note to change the Entries Per Direction property in the Strategies window to the same number as 'NumberOfTrades'. For example, if NumberOfTrades is set to 20, also set Entries Per Direction to 20.

    See the help guide link below for more information.
    BarsSinceEntryExecution - https://ninjatrader.com/support/help...yexecution.htm
    Strategy Builder screens - https://ninjatrader.com/support/help...er_screens.htm
    Conditions - https://ninjatrader.com/support/help...on_builder.htm
    Actions - https://ninjatrader.com/support/help...t8/actions.htm

    Please let us know if we may assist further.
    Attached Files
    <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


      #3
      This is something I can only accomplish by using C#, right? I can't do this using the wizard?

      Comment


        #4
        Hello vixtor,

        Thank you for your note.

        C# is used to create all NinjaScripts. This example script was made using the Strategy Builder. You may view the example script in the Strategy Builder to see how the strategy is set up. Also, you may view the code of the strategy by clicking the 'Unlock code' button in the Strategy Builder.

        Please 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 Mindset, 04-21-2026, 06:46 AM
        0 responses
        93 views
        0 likes
        Last Post Mindset
        by Mindset
         
        Started by M4ndoo, 04-20-2026, 05:21 PM
        0 responses
        138 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
        123 views
        0 likes
        Last Post cmoran13  
        Started by PaulMohn, 04-10-2026, 11:11 AM
        0 responses
        73 views
        0 likes
        Last Post PaulMohn  
        Working...
        X