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

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

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

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by algospoke, 04-17-2024, 06:40 PM
        6 responses
        48 views
        0 likes
        Last Post algospoke  
        Started by arvidvanstaey, Today, 02:19 PM
        4 responses
        11 views
        0 likes
        Last Post arvidvanstaey  
        Started by samish18, 04-17-2024, 08:57 AM
        16 responses
        61 views
        0 likes
        Last Post samish18  
        Started by jordanq2, Today, 03:10 PM
        2 responses
        9 views
        0 likes
        Last Post jordanq2  
        Started by traderqz, Today, 12:06 AM
        10 responses
        21 views
        0 likes
        Last Post traderqz  
        Working...
        X