What is "Init var" & "Max Profit" inside `Set runtime`

I want to initialise variable with maximum profit, Is that what it is?

Why does Init Var has variable name & value and the Set Runtime also has variable value? how does it work?

@Ujjwal @dinesh any help? tagging you guys, if you are the moderator.

Hi Ronak,

Init var keyword is used to set some variable and assign them a value for the strategy. The variables created using init var keyword can be accessed by get runtime keyword ( mostly used when strategy has custom python code)
Example: to set a variable with name “abc” and value as “5”

Max profit is a seperate keyword which can be used for trailing SL
This example will check if profit has reached more than Rs. 3000, it will start trailing from Rs. 2000 and will exit strategy when pnl drops by 1000 points from max pnl.

2 Likes

Thanks you @vikram.bajaj.
Trailing SL is what is exactly I am looking for. But example that you gave is still at strategy level, Right?

My goal is to have TSL at Set level.
Either using Init Var or Python code.

Do you have any suggestion? which would be easier (or even if it’s possible using Init Var)

Thanks!

Yes, given logic wil work at strategy level. Its not possible to apply set level TSL from condition builder.

It will require custom python code. Please share your TSL logic for sets here- http://questionnaire.tradetron.tech/
Quant team will get back with its cost and timeline.

Hi @vikram.bajaj,

Thank you for the above sample. Can you please throw some light on how to use “Set Runtime”? I have been trying to configure this but it looks like it is not possible to set a value to it. Some usage example around this keyword will be helpful.

Thanks.