How to square off orders which are placed by algo, instead of all orders?

abhi3292
My algo places some orders in morning and does square off by 3.15 if sl or target is not hit. However if I place some order manually and need to carry overnight, then how to program algo in such a way that it should not square off positions which were entered manually
  • tahseen
    When you place order via program, on placing you would get Order ID. Thus, your program knows what Orders it placed and only squares off those
  • abhi3292
    Thanks. I will try to implement that.
  • gaurmmec
    Apart from orderIds, u can tag your order like Placed by Algo so that its easy to filter in one go.
  • tahseen
    @gaurmmec solution is better and simple
  • abhi3292
    I want to sqaure off positions. Since whenever order is placed it is converted to position. Now i want to square off only those positions. Is it possible to tag positions? square off by order id or by tag does not seem right. Sometimes sl may get triggered before square off timings. Therefore, it is better to find open positions and square off them. Problem for me is how to differentiate positions which are placed by algo
  • sujith
    Positions API doesn't have any correlation with the orderbook. It will just show you the m2m of the account at that moment.
Sign In or Register to comment.