Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Make this reverse work...

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

    Make this reverse work...

    I've attached 4 tabs of the Control Center.

    I'm using NinjaScript to automate a strategy.

    To paraphase my code:

    OnBarUpdate()

    Upon a long signal
    ExitShort()
    EnterLong(1)

    Upon a short signal
    ExitLong()
    EnterShort(1)

    Problem: If the current trade is long 1 contract, then upon a short signal, I end up being short 2 contracts, instead of being short 1 contract. Why? I've attached various tabs from my Control Center.

    I simply want to reverse my position upon each signal.
    Attached Files

    #2
    No need to exit the current position explicitly. Just issue the Enter... method to enter the opposite position and NT internally will close any pending position.

    See SampleMACrossOver strategy
    DierkNinjaTrader Customer Service

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by jeanne, Today, 03:43 AM
    1 response
    17 views
    0 likes
    Last Post NinjaTrader_ShawnB  
    Started by Titli, Today, 09:36 AM
    0 responses
    12 views
    0 likes
    Last Post Titli
    by Titli
     
    Started by Mongo, Today, 09:28 AM
    0 responses
    4 views
    0 likes
    Last Post Mongo
    by Mongo
     
    Started by akvevo, Today, 08:59 AM
    1 response
    10 views
    0 likes
    Last Post NinjaTrader_ShawnB  
    Started by vantojo, Today, 08:14 AM
    0 responses
    6 views
    0 likes
    Last Post vantojo
    by vantojo
     
    Working...
    X