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

2 contracts instead of 1

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

    2 contracts instead of 1

    I made a simple strategy with builder. It has only 4 set of conditions and it uses price and one indicator. 1: When price crosses above = go long. 2: When price crosses below = exit long. 3. When price crosses below = go short. 4: When price crosses above = exit short.
    So basically, there should always be one contract active, either long or short.
    But what this does, is that in many cases there is 2 contracts active (maybe 60% of the trades) and the rest is done with 1 contract.
    I also made different strategies with other indicators, but the conditions were the same and seems that they do the same thing.
    Are my conditions too simple to handle the amount of contracts or whats the problem?

    #2
    Hello Paroooni1,

    Welcome to the NinjaTrader support forum.

    What you have described is actually a common item to come up, this is because of two of the conditions happening at once.

    If we assume that the position does not update between each set and requires 1 bar to update then we can see the problem based on what is being done. If you are long and your condition to exit the long is true it will become flat. The next set still thinks we are long so it also then enters short which both closes the position again and enters short creating an extra position.

    To fix this you have a few options. If this is a reversal strategy you can simply remove the exits. Calling the opposite entry method will exit and enter into the opposite direction.
    If you want exits you can make the condition more specific for the exit so that it does not become true at the same time as the entry.

    Your assessment is basically correct, the condition is just a little too simple for the amount of actions you want to do. This is simple enough for a simple two condition reversal strategy but would require a little more for adding exits safely.

    I look forward to being of further assistance.
    JesseNinjaTrader Customer Service

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by love2code2trade, 04-17-2024, 01:45 PM
    4 responses
    36 views
    0 likes
    Last Post love2code2trade  
    Started by alifarahani, Today, 09:40 AM
    2 responses
    13 views
    0 likes
    Last Post alifarahani  
    Started by junkone, Today, 11:37 AM
    3 responses
    15 views
    0 likes
    Last Post NinjaTrader_ChelseaB  
    Started by pickmyonlineclass, Today, 12:23 PM
    0 responses
    1 view
    0 likes
    Last Post pickmyonlineclass  
    Started by frankthearm, Yesterday, 09:08 AM
    12 responses
    44 views
    0 likes
    Last Post NinjaTrader_Clayton  
    Working...
    X