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

Long/Short entries

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

    Long/Short entries

    Is there a way to stop a strategy from exiting a short trade when the buy trade signals? Or would I just have to do two seperate strategies one for long and one for short to avoid this?

    #2
    Originally posted by zachj View Post
    Is there a way to stop a strategy from exiting a short trade when the buy trade signals? Or would I just have to do two seperate strategies one for long and one for short to avoid this?
    Not sure that the requirement is clear.

    You mean that once in a trade, ignore all reversal signals until a target/stop is reached?
    Is this for unmanaged, or managed trade setup?

    Comment


      #3
      Yes ignore reverse signal. I'm doing backtesting on automated strategy.

      Comment


        #4
        Originally posted by zachj View Post
        Yes ignore reverse signal. I'm doing backtesting on automated strategy.
        Just gate the reversal signal to only be executed if MarketPosition is Flat.

        Comment


          #5
          But then the buy signal will be missed. Was looking for the long and the short to be completely disconnected. I guess I would have to have seperate strategies for long and short.

          Comment


            #6
            Is there a member of the NT staff that can confirm the info I have been given below? Is there no method to avoid a reversal other than to set requirement for position to be flat prior to entry? Looking for the short/long to run independently. Is a seperate strategy for short & long the only solution?

            Comment


              #7
              Originally posted by zachj View Post
              Is there a member of the NT staff that can confirm the info I have been given below? Is there no method to avoid a reversal other than to set requirement for position to be flat prior to entry? Looking for the short/long to run independently. Is a seperate strategy for short & long the only solution?
              If they are to run independently, then yes, they have to be independent objects/classes/files.

              Comment


                #8
                It seems if they are run together than it makes a stoploss pointless as in a way the reversal is the stop. Koganam what do u think on that topic? Do u personally always run long/short together if u dont mind me asking. I was working w a firm and there propriatery system was setup so that they could only be created seperate, so no reversals.

                Comment


                  #9
                  Originally posted by zachj View Post
                  It seems if they are run together than it makes a stoploss pointless as in a way the reversal is the stop. Koganam what do u think on that topic? Do u personally always run long/short together if u dont mind me asking. I was working w a firm and there propriatery system was setup so that they could only be created seperate, so no reversals.
                  There is more than one way to resolve the issue. I am too lazy, so I take the tack of using an enum to determine what I will do on reversal signals if I code for them. I am sure these enums are self-explanatory.
                  Code:
                  [FONT=Courier New][COLOR=#0000ff][FONT=Courier New][COLOR=#0000ff]public [/COLOR][/FONT][/COLOR][/FONT][FONT=Courier New][COLOR=#0000ff][FONT=Courier New][COLOR=#0000ff]enum[/COLOR][/FONT][/COLOR][/FONT][FONT=Courier New][COLOR=#000000] ReversalActionType[/COLOR][/FONT]
                  [FONT=Courier New]{[/FONT]
                  [FONT=Courier New]RevOnRevSig,[/FONT]
                  [FONT=Courier New]ExitOnRevSig [/FONT]
                  [FONT=Courier New]}[/FONT]
                   
                  [FONT=Courier New][COLOR=#0000ff][FONT=Courier New][COLOR=#0000ff]public [/COLOR][/FONT][/COLOR][/FONT][FONT=Courier New][COLOR=#0000ff][FONT=Courier New][COLOR=#0000ff]enum[/COLOR][/FONT][/COLOR][/FONT][FONT=Courier New][COLOR=#000000] AllowedTradeDirection[/COLOR][/FONT]
                  [FONT=Courier New]{[/FONT]
                  [FONT=Courier New]LongOnly,[/FONT]
                  [FONT=Courier New]ShortOnly,[/FONT]
                  [FONT=Courier New]All[/FONT]
                  [FONT=Courier New]}[/FONT]
                  Between them, I can pretty much gate my orders to run any which way that I want.

                  Comment


                    #10
                    I'm not farmiliar with enum, ill will take a look into that.

                    Comment

                    Latest Posts

                    Collapse

                    Topics Statistics Last Post
                    Started by Felix Reichert, 04-26-2024, 02:12 PM
                    5 responses
                    39 views
                    0 likes
                    Last Post NinjaTrader_BrandonH  
                    Started by cmtjoancolmenero, 04-29-2024, 03:40 PM
                    15 responses
                    45 views
                    0 likes
                    Last Post NinjaTrader_Jesse  
                    Started by ETFVoyageur, Yesterday, 06:05 PM
                    6 responses
                    37 views
                    0 likes
                    Last Post ETFVoyageur  
                    Started by rbeckmann05, Today, 02:35 PM
                    1 response
                    6 views
                    0 likes
                    Last Post NinjaTrader_BrandonH  
                    Started by Torontobluejays, Yesterday, 08:43 AM
                    6 responses
                    34 views
                    0 likes
                    Last Post rc5781
                    by rc5781
                     
                    Working...
                    X