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 sjsj2732, Yesterday, 04:31 AM
          0 responses
          36 views
          0 likes
          Last Post sjsj2732  
          Started by NullPointStrategies, 03-13-2026, 05:17 AM
          0 responses
          287 views
          0 likes
          Last Post NullPointStrategies  
          Started by argusthome, 03-08-2026, 10:06 AM
          0 responses
          288 views
          0 likes
          Last Post argusthome  
          Started by NabilKhattabi, 03-06-2026, 11:18 AM
          0 responses
          134 views
          1 like
          Last Post NabilKhattabi  
          Started by Deep42, 03-06-2026, 12:28 AM
          0 responses
          95 views
          0 likes
          Last Post Deep42
          by Deep42
           
          Working...
          X