Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Close position - Multiple events

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

    Close position - Multiple events

    Please excuse a newbie question: I am trying to close a position based on one of either of two events occurring. How do I code this?


    // Condition set 2
    if (CrossBelow(LinRegSlope(8).LRSlope, MyInput0, 1))

    {
    ExitLong(
    "", "");
    }


    2nd event to possibly occur would be:

    if (CrossBelow(Typical, CalculateValueArea(false, 8, 30, 0.7, "VWTPO", 6.75).VAt, 1)



    If either event occurs, I would like the long position to be closed. No further orders should be placed other than to close the position. Should this be in the same condition set or a new condition? A little confused right now. If someone could show how to do the code, it would be greatly appreciated. Thanks in advance!

    #2
    Two separate sets. The code will evaluate the first one first. Then it will evaluate the second.
    Josh P.NinjaTrader Customer Service

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by judysamnt7, 03-13-2023, 09:11 AM
    4 responses
    59 views
    0 likes
    Last Post DynamicTest  
    Started by ScottWalsh, Today, 06:52 PM
    4 responses
    36 views
    0 likes
    Last Post ScottWalsh  
    Started by olisav57, Today, 07:39 PM
    0 responses
    7 views
    0 likes
    Last Post olisav57  
    Started by trilliantrader, Today, 03:01 PM
    2 responses
    21 views
    0 likes
    Last Post helpwanted  
    Started by cre8able, Today, 07:24 PM
    0 responses
    10 views
    0 likes
    Last Post cre8able  
    Working...
    X