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 JoMoon2024, Today, 06:56 AM
    0 responses
    6 views
    0 likes
    Last Post JoMoon2024  
    Started by Haiasi, 04-25-2024, 06:53 PM
    2 responses
    17 views
    0 likes
    Last Post Massinisa  
    Started by Creamers, Today, 05:32 AM
    0 responses
    5 views
    0 likes
    Last Post Creamers  
    Started by Segwin, 05-07-2018, 02:15 PM
    12 responses
    1,786 views
    0 likes
    Last Post Leafcutter  
    Started by poplagelu, Today, 05:00 AM
    0 responses
    3 views
    0 likes
    Last Post poplagelu  
    Working...
    X