Announcement

Collapse

Looking for a User App or Add-On built by the NinjaTrader community?

Visit NinjaTrader EcoSystem and our free User App Share!

Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less

Partner 728x90

Collapse

EnterLong with ExitLong etc

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

    EnterLong with ExitLong etc

    Hi,

    Newbie to NT and had some basic questions about EnterLong / ExitLong. Looking at some examples on the net, suppose I have a strategy where I do:

    ---

    if (cond1)
    EnterLong();
    if (cond2)
    EnterShort();

    ----

    (i) in the case above, does EnterLong() automatically call ExitShort(). More specifically, if an EnterLong() occurs, and I am short 1 contract, does EnterLong() generate two (2) long contracts = the first long to cancel the short 1 contract, and the 2nd long to actually go long ?

    Suppose now, I have the case where it is much more likely to exit a long condition (e.g. by say a profit taking rule), than by a short condition:

    if (cond1)
    EnterLong();
    if (cond2)
    EnterShort();
    if (Position.MarketPosition == MarketPosition.Long && cond3)
    ExitLong();
    if (Position,MarketPosition == MarketPosition.Short && cond4)
    ExitShort();

    (ii) is this case above, suppose EnterLong() occurs a few bars after an ExitShort(). Does EnterLong() automatically know that the Position.MarketPosition is flat ?

    #2
    Hello,
    If you are in a Short position and EnterLong is called to long market orders will be placed to bring you to a long position. The same would be the case if you were Long and EnterShort was called.
    EnterLong would check the position and if it is in a flat position it would only submit one long order in the example you outlined.
    If we can be of any other assistance please let us know.
    Cody B.NinjaTrader Customer Service

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by zstheorist, Today, 07:52 PM
    0 responses
    7 views
    0 likes
    Last Post zstheorist  
    Started by pmachiraju, 11-01-2023, 04:46 AM
    8 responses
    150 views
    0 likes
    Last Post rehmans
    by rehmans
     
    Started by mattbsea, Today, 05:44 PM
    0 responses
    6 views
    0 likes
    Last Post mattbsea  
    Started by RideMe, 04-07-2024, 04:54 PM
    6 responses
    33 views
    0 likes
    Last Post RideMe
    by RideMe
     
    Started by tkaboris, Today, 05:13 PM
    0 responses
    6 views
    0 likes
    Last Post tkaboris  
    Working...
    X