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 NullPointStrategies, Yesterday, 05:17 AM
      0 responses
      56 views
      0 likes
      Last Post NullPointStrategies  
      Started by argusthome, 03-08-2026, 10:06 AM
      0 responses
      132 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
      45 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