Get Runtime variable

In my strategy, I’m trying to buy when LTP crosses above trigger candle which is candle crossing 20 EMA.
Trigger candle - (-1) candle crossing 20 EMA…I capture high of that candle and store in variable.
Any subsequent candle that crosses the high is where I buy.

Problem: I’m able to capture high of trigger candle in get variable, but the trade doesnt get executed…Pls help

Hey, @rlakkoj In runtime variable “n_ce_high” what instrument high are you storing in it?
Is it same as your LTP you are checking in the condition builder? if possible can you post the screenshot of Get Runtime initialisation, So people can help you quicker.

thanks for the response…here is the screen short

okay use this : LTP(runtime variable(n_ce_high)) > Get Runtime (n_ce_high)+ 5
Instead on instrument name choose Run time variable in LTP

Hey @rlakkoj n_ce_high has only high value not the instrument name for calculating LTP, add another runtime variable through Instrument name --> NFO–>NIFTY50–>CURRENTWEEK–>CE–>ATM. this variable stores the name of the instrument from which LTP has to be searched for. This will solove your problem.

1 Like

Thanks Mano…will try and let you know. Any reason why the existing code is not working? I appreciate if you can provide some more details on it

Hey @rlakkoj I just saw your position, I don’t think the strike selection is correct here if you need ATM strike do this instead,image
ROUND–>LTP–> 50 (Base for Nifty)

Initialized 2 variables…to capture high of the candle and instrument name.

check if last traded price is greater than high of candle that crossed 20 ema

and position builder…

Does this look good Manoj? thanks in advance

Yes @rlakkoj this does look good, in condition Builder add one more condition like (Net qty ==0) or some variable which keeps tabs of trade and not run on constant loop.
the condition LTP> HIGH +5 will be true and this might create an unlimited loop, which will result in constant trade placement.
Hope this helps,
cheers

Good point, add the same…thanks Manoj