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.

True.
I don’t find any clear implementation of init var, get runtime, set runtime.
This are the master keys of every developer and I am struggling hard to get this implemented in strategy using Tradetron platform.
OR
Is it like, this is of no use in tradetron env. Mainly used in Python code. If so, then what could be the ideal use of such keywords.

Simply put, as traditional developer, I want to init var in start of the strategy, then I’ll set runtime this variable with some value in repair condition and then I’ll get runtime this variable to check for desired value.

How to achieve this simple thing? please someone help.