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 Market1337, 07-02-2022, 08:54 AM
    8 responses
    244 views
    2 likes
    Last Post kdegale
    by kdegale
     
    Started by smcllr, Today, 02:41 PM
    2 responses
    31 views
    0 likes
    Last Post smcllr
    by smcllr
     
    Started by Balage0922, Today, 01:25 AM
    1 response
    50 views
    0 likes
    Last Post Balage0922  
    Started by Skechers, Yesterday, 04:35 PM
    1 response
    35 views
    0 likes
    Last Post Tasker-182  
    Started by Gmonte, Today, 08:28 AM
    1 response
    45 views
    0 likes
    Last Post Gmonte
    by Gmonte
     
    Working...
    X