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 DerkWehler, Today, 11:35 AM
        10 responses
        20 views
        0 likes
        Last Post DerkWehler  
        Started by tkaboris, Today, 01:42 PM
        1 response
        4 views
        0 likes
        Last Post NinjaTrader_Jesse  
        Started by dbennett3, Today, 01:59 PM
        0 responses
        1 view
        0 likes
        Last Post dbennett3  
        Started by webus, Today, 06:22 AM
        4 responses
        18 views
        0 likes
        Last Post webus
        by webus
         
        Started by DayTradingDEMON, 07-11-2024, 08:54 AM
        16 responses
        48 views
        0 likes
        Last Post DayTradingDEMON  
        Working...
        X