I buy instruments (from a list) and the qty will be based on Amount of INR 50,000.
After that I have around 5 Repairs in my strategy. in Each repair I buy quantity(based on amount of 50000) if my LTP is down by 5% from the average buy price( Includes Entry and previous repairs).
My 6th repair has a sell signal for those instrument for which LTP is > 3.8% of average price. Sell signal for the total quantity of the said instrument.
I need to get Average price and total quantity of the instrument.
As of now I am trying a code but its very raw and not appropriate and also it is not working as per my expectation.
Please see the code snippet of 5th Repair. I get
If the PNL of instrument traded in leg 1 of entry set 1 is greater than 500, condition is met.
Prashanth
Bhavesh8374 / Palakktn, Any Updates on this ? How you Guys resolved this ?
Bhavesh Savla
Sorry to say Prashant, but, there is no solution to this problem.
If you keep avg same insturment, you use position details value / qty.
In my case, I avg buy ATM CE/PE - which is different than the previous instument, hence, couldn’t achieve this.
Now, I understand why Tradetron can not provide AVG rate due to complexity of the problem.
Tradetron TeamTradetron team
There is no single keyword for “average price across entry and all repairs”.
What exists:
Net Quantity: open quantity of that instrument in the whole strategy.
Traded Instrument (field price): the fill price of one specific leg (Set / Condition / Leg).
Traded Instrument (field pnl): (LTP − entry price) × qty for one leg.
Ways to build it
Fixed number of repairs (single instrument): add up each leg’s price × quantity using Traded Instrument, then divide by Net Quantity with Math Operation.
Runtime variables: store running totals (cost and quantity) in each condition’s runtime. Initialize Variables cannot be used in list-based strategies.
List strategy with many repairs: this needs Python. You can connect your AI to Tradetron via MCP to help write it.