Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Going Long as soon as the strategy starts

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

    Going Long as soon as the strategy starts

    I took Josh's advice and tried to use

    if (Historical)
    return;

    if (Current == 1)
    EnterLong();

    That doesn't work, and if I replace if(Current ==1) with something like:

    if (Position.MarketPosition == MarketPosition.Flat)

    then it enters every time my strategy exits the long position.

    What I am trying to do is go long as soon as I start the strategy with conditions that exit the position, and I only want it to happen only once???

    I also would like to to it as soon as I start the strategy and not OnBarClose, but it always seems to occur on the close of the bar????
    Last edited by edgeliner; 03-24-2008, 04:57 PM.

    #2
    Perhaps there is a command that will stop a strategy from running after a condition is met??? Anyone know??

    Comment


      #3
      When a condition is true, just return out of any method (OnBarUpdate) that executes strategy logic.
      RayNinjaTrader Customer Service

      Comment


        #4
        What the heck does that mean????

        Comment


          #5
          if (<condition-is-true>)
          return:

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by CarlTrading, 03-31-2026, 09:41 PM
          1 response
          152 views
          1 like
          Last Post NinjaTrader_ChelseaB  
          Started by CarlTrading, 04-01-2026, 02:41 AM
          0 responses
          87 views
          1 like
          Last Post CarlTrading  
          Started by CaptainJack, 03-31-2026, 11:44 PM
          0 responses
          131 views
          2 likes
          Last Post CaptainJack  
          Started by CarlTrading, 03-30-2026, 11:51 AM
          0 responses
          127 views
          1 like
          Last Post CarlTrading  
          Started by CarlTrading, 03-30-2026, 11:48 AM
          0 responses
          106 views
          0 likes
          Last Post CarlTrading  
          Working...
          X