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 NullPointStrategies, Yesterday, 05:17 AM
    0 responses
    55 views
    0 likes
    Last Post NullPointStrategies  
    Started by argusthome, 03-08-2026, 10:06 AM
    0 responses
    132 views
    0 likes
    Last Post argusthome  
    Started by NabilKhattabi, 03-06-2026, 11:18 AM
    0 responses
    73 views
    0 likes
    Last Post NabilKhattabi  
    Started by Deep42, 03-06-2026, 12:28 AM
    0 responses
    45 views
    0 likes
    Last Post Deep42
    by Deep42
     
    Started by TheRealMorford, 03-05-2026, 06:15 PM
    0 responses
    49 views
    0 likes
    Last Post TheRealMorford  
    Working...
    X