Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Simple Strategy Build Help Please

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

    Simple Strategy Build Help Please

    I am having trouble writing a very simple ninjatrader 8 strategy in the strategy builder.

    I am trying to write it for instrument NQ on a 1000 tick chart, but would like this to be modified by the user to be able to select any instrument and any chart type/time frame

    The parameters/conditions are;
    Trading hours between 8 AM and 4 PM EST
    Enter long position if tick bar close above 50 period SMA
    Enter short position if tick bar close below 50 period SMA

    inital profit target set at 120 ticks
    initial stop loss set at 80 ticks
    (I would like the user to adjust these profit target and stop loss values)

    and I would like the strategy to not enter a new long until a short position is triggered (this is the part I am getting hung up on) right now I have been trying to write this strategy but after it hits profit target it enters a new long trade after that bar close because it is still above the 50 SMA and vice versa for the short side

    I'd like the strategy to be able to "reset" itself so that it does not enter a new trade after profit target until it closes back over the other side of the 50 period SMA.

    Any and all help would be greatly appreciated.​

    #2
    Hello tonybeans.

    You can set 2 new Boolean variables: AllowLong=true , AllowShort=true


    Long
    Conditions:
    && “close above 50 period SMA”
    && AllowLong=true

    Actions:
    EnterLong()

    When exiting from Long to take profit set:
    AllowLong=false
    AllowShort=true


    Short
    Conditions:
    && “close below 50 period SMA”
    && AllowShort=true

    Actions:
    EnterShort()

    When exiting from Short to take profit set:
    AllowLong=true
    AllowShort=false


    Last edited by KonstantinosNT; 02-18-2023, 04:31 AM.

    Comment


      #3
      Originally posted by KonstantinosNT View Post
      Hello tonybeans.

      You can set 2 new Boolean variables: AllowLong=true , AllowShort=true


      Long
      Conditions:
      && “close above 50 period SMA”
      && AllowLong=true

      Actions:
      EnterLong()

      When exiting from Long to take profit set:
      AllowLong=false
      AllowShort=true


      Short
      Conditions:
      && “close below 50 period SMA”
      && AllowShort=true

      Actions:
      EnterShort()

      When exiting from Short to take profit set:
      AllowLong=true
      AllowShort=false


      This is exactly what I needed thank you so much !

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by Mindset, 04-21-2026, 06:46 AM
      0 responses
      88 views
      0 likes
      Last Post Mindset
      by Mindset
       
      Started by M4ndoo, 04-20-2026, 05:21 PM
      0 responses
      134 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
      119 views
      0 likes
      Last Post cmoran13  
      Started by PaulMohn, 04-10-2026, 11:11 AM
      0 responses
      69 views
      0 likes
      Last Post PaulMohn  
      Working...
      X