1
  1. I place the order using the following code and it gets executed without any problem:
   //place order        
`    strategy.entry(
     currentOrder.orderEntryId,
     direction              = longCondition ? strategy.long: strategy.short, 
     qty                    = currentOrder.quantity,
     stop                   = currentOrder.entryPrice,
     limit                  = currentOrder.limitPrice)`

  1. I want to set-up a SL and TP entry for the same order, but when I place it with the following code it does not get executed: `
 //setup SL and TP for the currently placed order
    strategy.exit(
         id                 = currentOrder.orderExitId, 
         from_entry         = currentOrder.orderEntryId,
         qty                = currentOrder.quantity,
         qty_percent        = 100,
         limit              = currentOrder.takeProfit,
         stop               = currentOrder.stopLoss)`


I looked into the values assigned to all parameters and they are all OK. Attaching a screen capture of the debug output: As you can see Price passed the TP line (green) but the strategy.exit did not execute

Zoran
  • 21
  • 2

1 Answers1

1

Resolved it - if the code cancels the order , SL/TP orders are also cancelled. This is also true for cancelling the order that that has already been entered.

Zoran
  • 21
  • 2