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

Get Previous Trade signal Direction

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

    Get Previous Trade signal Direction

    Is there a possibility of knowing the last trade direction to act on subsequent trades? For example, if the last signal from an RSI was a buy, I only want the next initiate trade to be a sell even though there are buy signals until the sell signal presents itself.

    I see that there is Name method and OrderAction noted here: https://ninjatrader.com/support/helpGuides/nt8/en-us/

    but is there a way to keep track of previous OrderAction on initiate?
    Last edited by Boonfly8; 07-03-2018, 01:59 PM.

    #2
    Hello Boonfly8,

    Thanks for your post.

    There is not a direct way of detecting what a previous order's direction was without custom logic. For example, you could create a variable that you control that gets set whenever a new entry order is submitted.

    Code:
    EnterLong(); 
    LastDirection = 1;
    
    -OR-
    EnterShort();
    LastDirection = 2;
    You could also use Position.MarketPosition to determine where your strategies position is.

    Position.MarketPosition - https://ninjatrader.com/support/help...etposition.htm

    Please let us know if we can be of further assistance.
    JimNinjaTrader Customer Service

    Comment


      #3
      Hi Jim,

      thanks for the tip, I'll work on that and see!
      Last edited by Boonfly8; 07-03-2018, 03:04 PM.

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by Tim-c, Today, 02:10 PM
      1 response
      7 views
      0 likes
      Last Post NinjaTrader_ChelseaB  
      Started by Taddypole, Today, 02:47 PM
      0 responses
      2 views
      0 likes
      Last Post Taddypole  
      Started by chbruno, 04-24-2024, 04:10 PM
      4 responses
      50 views
      0 likes
      Last Post chbruno
      by chbruno
       
      Started by TraderG23, 12-08-2023, 07:56 AM
      10 responses
      399 views
      1 like
      Last Post beobast
      by beobast
       
      Started by lorem, Yesterday, 09:18 AM
      5 responses
      25 views
      0 likes
      Last Post NinjaTrader_ChelseaB  
      Working...
      X