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().


    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#.


    Chelsea B.NinjaTrader Customer Service

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by Mindset, 04-21-2026, 06:46 AM
    0 responses
    88 views
    0 likes
    Last Post Mindset
    by Mindset
     
    Started by M4ndoo, 04-20-2026, 05:21 PM
    0 responses
    134 views
    0 likes
    Last Post M4ndoo
    by M4ndoo
     
    Started by M4ndoo, 04-19-2026, 05:54 PM
    0 responses
    68 views
    0 likes
    Last Post M4ndoo
    by M4ndoo
     
    Started by cmoran13, 04-16-2026, 01:02 PM
    0 responses
    118 views
    0 likes
    Last Post cmoran13  
    Started by PaulMohn, 04-10-2026, 11:11 AM
    0 responses
    67 views
    0 likes
    Last Post PaulMohn  
    Working...
    X