# Get Runtime variable

**URL:** <https://qna.tradetron.tech/t/get-runtime-variable/2776>\
**Category:** Error execution\
**Tags:** keywords\
**Created:** [October 20, 2023, 1:34pm UTC](https://qna.tradetron.tech/t/get-runtime-variable/2776 "2023-10-20T13:34:23Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![rlakkoj](https://qna.tradetron.tech/letter_avatar_proxy/v4/letter/r/dec6dc/32.png) [@rlakkoj](https://qna.tradetron.tech/u/rlakkoj)\
**Post date:** [October 20, 2023, 1:34pm UTC](https://qna.tradetron.tech/t/get-runtime-variable/2776/1 "2023-10-20T13:34:23Z")

</div>

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

 ![image](https://qna.tradetron.tech/uploads/default/original/2X/3/378ad09e5a497eea44a4cd1e52a8a0069f06daa9.png)

 ![image](https://qna.tradetron.tech/uploads/default/original/2X/c/c1556a3daf73023d39e9a8fbdad60c53e287bac8.png)

---

<div class="post-metadata">

**Author:** ![mano00](https://qna.tradetron.tech/user_avatar/qna.tradetron.tech/mano00/32/1151_2.png) [@mano00](https://qna.tradetron.tech/u/mano00)\
**Post date:** [October 21, 2023, 7:15am UTC](https://qna.tradetron.tech/t/get-runtime-variable/2776/2 "2023-10-21T07:15:08Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![rlakkoj](https://qna.tradetron.tech/letter_avatar_proxy/v4/letter/r/dec6dc/32.png) [@rlakkoj](https://qna.tradetron.tech/u/rlakkoj)\
**Post date:** [October 21, 2023, 11:41am UTC](https://qna.tradetron.tech/t/get-runtime-variable/2776/3 "2023-10-21T11:41:36Z")

</div>

thanks for the response…here is the screen short

 ![image](https://qna.tradetron.tech/uploads/default/original/2X/2/2c5d7ce2349ef7d2dea61d560e0ce68a903e3883.png)

---

<div class="post-metadata">

**Author:** ![mano00](https://qna.tradetron.tech/user_avatar/qna.tradetron.tech/mano00/32/1151_2.png) [@mano00](https://qna.tradetron.tech/u/mano00)\
**Post date:** [October 21, 2023, 12:01pm UTC](https://qna.tradetron.tech/t/get-runtime-variable/2776/4 "2023-10-21T12:01:16Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![rlakkoj](https://qna.tradetron.tech/letter_avatar_proxy/v4/letter/r/dec6dc/32.png) [@rlakkoj](https://qna.tradetron.tech/u/rlakkoj)\
**Post date:** [October 21, 2023, 2:15pm UTC](https://qna.tradetron.tech/t/get-runtime-variable/2776/5 "2023-10-21T14:15:03Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![mano00](https://qna.tradetron.tech/user_avatar/qna.tradetron.tech/mano00/32/1151_2.png) [@mano00](https://qna.tradetron.tech/u/mano00)\
**Post date:** [October 21, 2023, 3:19pm UTC](https://qna.tradetron.tech/t/get-runtime-variable/2776/6 "2023-10-21T15:19:27Z")

</div>

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](https://qna.tradetron.tech/uploads/default/original/2X/a/ace8b9ed3fe13037a80ebc318892bae13116588d.png)  
ROUND–\>LTP–\> 50 (Base for Nifty)

---

<div class="post-metadata">

**Author:** ![rlakkoj](https://qna.tradetron.tech/letter_avatar_proxy/v4/letter/r/dec6dc/32.png) [@rlakkoj](https://qna.tradetron.tech/u/rlakkoj)\
**Post date:** [October 22, 2023, 6:06am UTC](https://qna.tradetron.tech/t/get-runtime-variable/2776/7 "2023-10-22T06:06:35Z")

</div>

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

 ![image](https://qna.tradetron.tech/uploads/default/original/2X/0/0c25917cd5adc5247bc54a6cb7d09f04e5b2c405.png)

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

 ![image](https://qna.tradetron.tech/uploads/default/original/2X/a/a4a678650b1a1ce97821d07777324abba49ac251.png)

and position builder…

 ![image](https://qna.tradetron.tech/uploads/default/original/2X/3/37c2fba04ddc5173e547aa4690f53d31bc9cdbea.png)

Does this look good Manoj? thanks in advance

---

<div class="post-metadata">

**Author:** ![mano00](https://qna.tradetron.tech/user_avatar/qna.tradetron.tech/mano00/32/1151_2.png) [@mano00](https://qna.tradetron.tech/u/mano00)\
**Post date:** [October 22, 2023, 7:44am UTC](https://qna.tradetron.tech/t/get-runtime-variable/2776/8 "2023-10-22T07:44:40Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![rlakkoj](https://qna.tradetron.tech/letter_avatar_proxy/v4/letter/r/dec6dc/32.png) [@rlakkoj](https://qna.tradetron.tech/u/rlakkoj)\
**Post date:** [October 22, 2023, 8:56am UTC](https://qna.tradetron.tech/t/get-runtime-variable/2776/9 "2023-10-22T08:56:17Z")

</div>

Good point, add the same…thanks Manoj
