Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

How to double usual TP set in strategy

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

    How to double usual TP set in strategy

    Hi I have this code for my order management and for runner trade i want to double the usuall TP set in settings. Is there a quick way of doing it?

    Code:
    if (order.IsShort)
                    {
                        double tp = Instrument.MasterInstrument.RoundToTickSize(averageFillPrice - ProfitTarget * TickSize);
    
                        if (ProfitTarget > 0 && tp.ApproxCompare(bid) < 0)
                        {
                            targetOrder = SubmitOrderUnmanaged(0, OrderAction.BuyToCover, OrderType.Limit, filled, tp, 0, oco, "PT");
                        }
    
                        double sl = Instrument.MasterInstrument.RoundToTickSize(averageFillPrice + StopLoss * TickSize);
    
                        if (StopLoss > 0 && sl.ApproxCompare(ask) > 0)
                        {
                            stopOrder = SubmitOrderUnmanaged(0, OrderAction.BuyToCover, OrderType.StopMarket, filled, 0, sl, oco, "SL");
                        }
    
                    }
    
    {
                               entryOrder = SubmitOrderUnmanaged(0, OrderAction.SellShort, OrderType.Market, TradeSize, 0, 0, "", "BR");
    
                            return;
                        }​
    
    ​
    Last edited by tkaboris; 02-17-2023, 02:17 PM.

    #2
    Hello tkaboris,

    Do you mean double the quantity?

    You are supplying the variable filled as the quantity

    SubmitOrderUnmanaged(0, OrderAction.BuyToCover, OrderType.Limit, filled, tp, 0, oco, "PT")
    SubmitOrderUnmanaged(int selectedBarsInProgress, OrderAction orderAction, OrderType orderType, int quantity, double limitPrice, double stopPrice, string oco, string signalName)


    Just multiply this by 2 to double the quantity.

    SubmitOrderUnmanaged(0, OrderAction.BuyToCover, OrderType.Limit, filled * 2, tp, 0, oco, "PT")​
    Chelsea B.NinjaTrader Customer Service

    Comment


      #3
      I am sorry , i meant douple the Take profit in ticks, not double the size

      Comment


        #4
        Hello tkaboris,

        You are supplying tp for the price.

        How are you calculating that price?

        Lets say you are currently adding 10 ticks.

        tp = Position.AveragePrice + 10 * TickSize

        You could calculate double the number of ticks.

        tp = Position.AveragePrice + 20 * TickSize
        or
        tp = Position.AveragePrice + 10 * 2 * TickSize
        Chelsea B.NinjaTrader Customer Service

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by Mindset, 04-21-2026, 06:46 AM
        0 responses
        90 views
        0 likes
        Last Post Mindset
        by Mindset
         
        Started by M4ndoo, 04-20-2026, 05:21 PM
        0 responses
        137 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
        120 views
        0 likes
        Last Post cmoran13  
        Started by PaulMohn, 04-10-2026, 11:11 AM
        0 responses
        72 views
        0 likes
        Last Post PaulMohn  
        Working...
        X