• If this is your first visit, you will have to register before you can post. To view messages, please scroll below and select the forum that you would like to visits. Questions? Be sure to check out the Forum FAQ.

Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Multiple entries per direction, only the favorable buys

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

    Multiple entries per direction, only the favorable buys

    In my strategy I've enabled multiple entries per direction (up to 5). Every time a buy signal is triggered my strategy buys long than when a sell is triggered it sells long all held share. Some buy signals are better than others in relationship to the previous buy price. Any way to say only buy again if the price has dropped lower than the 1st buy price? I'd like to skip buying a second share if the price is higher on the 2nd, 3rd, 4th or 5th buy trigger.

    Also if the buy price has dropped since the first buy I'd like to buy double.

    For example:

    there are 3 buy signals

    1st buy trigger at $2 = buy long 1 share
    2nd buy trigger at $1 = buy long 2 shares
    3rd buy trigger at $3 = skip buying

    1st sell trigger = sell long all held shares and reset buy triggers

    Any way to do this or something like this? Thanks

    #2
    Hello jerblaster23,

    Welcome to the NinjaTrader forums!

    You can compare the an order's AverageFillPrice from an order that is assigned to a variable in OnOrderUpdate().
    https://ninjatrader.com/support/help.../nt8/order.htm

    For example:

    if (myOrder != null && myOrder.OrderState == OrderState.Filled && Close[0] < myOrder.AverageFillPrice)
    {
    EnterLong(myOrder.Quantity * 2);
    }

    Below I am providing a link to a forum post with helpful information about getting started with NinjaScript and C#.
    https://ninjatrader.com/support/foru...040#post786040

    Chelsea B.NinjaTrader Customer Service

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by Andreas M., Today, 04:42 PM
    0 responses
    1 view
    0 likes
    Last Post Andreas M.  
    Started by sidlercom80, Today, 12:29 PM
    2 responses
    21 views
    0 likes
    Last Post fx.practic  
    Started by itrader46, Today, 02:49 PM
    3 responses
    12 views
    0 likes
    Last Post NinjaTrader_ChelseaB  
    Started by m94306, Today, 03:01 PM
    1 response
    8 views
    0 likes
    Last Post NinjaTrader_Heath  
    Started by fx.practic, Today, 02:54 PM
    3 responses
    10 views
    0 likes
    Last Post fx.practic  
    Working...
    X