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 Geovanny Suaza, 02-11-2026, 06:32 PM
          0 responses
          558 views
          0 likes
          Last Post Geovanny Suaza  
          Started by Geovanny Suaza, 02-11-2026, 05:51 PM
          0 responses
          324 views
          1 like
          Last Post Geovanny Suaza  
          Started by Mindset, 02-09-2026, 11:44 AM
          0 responses
          101 views
          0 likes
          Last Post Mindset
          by Mindset
           
          Started by Geovanny Suaza, 02-02-2026, 12:30 PM
          0 responses
          545 views
          1 like
          Last Post Geovanny Suaza  
          Started by RFrosty, 01-28-2026, 06:49 PM
          0 responses
          547 views
          1 like
          Last Post RFrosty
          by RFrosty
           
          Working...
          X