How to specify max allocation for a trade?

How can I specify max allocation for a trade instead of hardcoding lots for purchasing options? I want to purchase say x number of lots that can be purchased for a total of 25000.

So if LTP for Nifty 50 ATM is 100 and lot size is 50, I want to purchase 5 lots as my max allocation is 25000.
if LTP is 101, the traded quantity will only be 4 lots.

You can specify value as 25000, this would purchase lots basis the price.

I have a different problem though.
I want to provide value but at the same time want to limit the number of lots to x in case the price is really low. How can I achieve this?

Using both may not be possible. You have to use either value or lot.

Thanks for your reply.

Another thing that could work for me is not taking a trade when the price is lower than specified price.

For this I added below condition in Condition Builder

But in notification log I see the LTP is very different from the actual trade price. e.g. LTP was shown as 60 but the CE trade was taken at 112.
Any insights on what could have caused this? How can I ensure the LTP of instrument price is picked correctly? I am trying to pick the spot price in Position Builder like this -

You have to use traded instrument name keyword instead of just instrument name in your LTP condition. There is a possibility that ATM of strike might get shifted after execution of your trade if there is a price action movement.

I understand well that in exit conditions we must use traded instrument name to find LTP of the traded instrument.

But here the LTP is in the Entry condition. How does “Traded Instrument Name” work here as no trade has been taken, and I want to initiate trade only when price is > 33.

You are correct, then your condition under entry is correct. Then there may be an issue with position selection. How you making sure of same CE stike in your position definition? Ideal way would be to use runtime variable under initialization, define 2 variable to capture your strike and price of strike. In your entry and position builder use those to variable.

This is exactly what I need. I need to capture strike and price in my entry condition and use these in the position builder.

But I don’t know how to achieve this. Is there any example you can share, that I can learn from?

Appreciate your help, thanks in advance.