Issues in getting average price and net quantity

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

  1. price and qty for each( Entry and repair).
  2. Calculate the total amount
  3. Divide with Quantity to get average price

But its not working… Please help.

5th Repair

Sell snapshot

Sell Position Builder

Sell Qty FX

Please help

Exactly my requirement :slight_smile:

Got any better solution? I’ve continuous repair condition, so I doubt I can use this clumsy logic.

Simply put - net qty * avg price should do the logic - but unfortunately its not. :frowning:

Hi Bhavesh,

It’s not possible. I gave this requirement to Tradetron and was ready to pay for the strategy.

They said this requirement is not feasible to develop.

Ohh sad. :sleepy:

There are lot of things which are restricted / limiting to develop using strategy builder.

Although, its quite simple & easy to implement few things. But at the same time its high time they should re-visit their strategy builder tool.

Does this help??
https://tradetron.tech/keyword/documentation
Traded instrument
Example #3

Which says:

This newly introduced parameter makes it much easier to find the PNL of individual legs

The formula used for calculating PNL in Traded instrument keyword is (LTP - Entry Price) * Qty Traded

You can simply use it like the PNL keyword, check below for example

If the PNL of instrument traded in leg 1 of entry set 1 is greater than 500, condition is met.