Use Entry Candle - High and Low using Runtime Variable

Below video explains how to store values of Entry Candle - High and Low using Runtime Variable, based on simple EMA Crossover condition.

Entry Condition:

Simple EMA Crossover as shown below:

image

Steps followed:

  1. Entry condition will be checked (in this case - EMA Crossover)
  2. Positions will be taken based on Position Builder.
  3. Then the Runtime variable will be generated

Setting a variable name:

  1. Click on ‘Runtime variable’

  1. Set the name. Note that name is space and case sensitive:

  1. Now click on Fx, under value for putting variables formula:
    The Formula for Entry Candle High is defined below.
    Please make sure that candle no. is -1, as it is the previous candle. Do not select 0 position candle.
    Make sure to Save the formula.

  1. Similarly for capturing low value, below is the formula:

  1. So the runtime variables saved will look as below:

For Set Exit Condition:

  1. Here the Target is 10 points above the Entry Candle High.
  2. And the Stoploss is 10 points below the Entry Candle Low.

As you can see, we have to use “get runtime” keyword and use the “variable name” used while creating variables to fetch that data.

A good practice to follow here is as follows:

  1. Create a group shown below and put variables accordingly as shown.
    This will make sure that your ‘get runtime’ is being checked first, so for eg: only if ‘nifty_high’ as a runtime variable exists, then only it will continue to check the Target or a Stoploss condition that is set.

Next Step is to ‘kill’ the runtime variable at the time of Set exit.

So, click on the ‘Runtime variable’ in front of Set Exit as shown below:

And use below formulas to essentially kill the runtime variables:
This makes sure that the same variable is not being used elsewhere in your strategy.

Hence, again at the time of re-entry, it will generate the new set of variables, since the earlier ones are already killed. So the cycle will repeat smoothly.

How to use this on a list of Stocks:

Assume you have selected “FnO” as the list as shown below:

image

Note that in the variable name, you need to add the name of that variable list. and use vertical pipes symbol to denote that its a list as shown below:

And similarly in the Exit condition, you have to select the list name accordingly as shown in below image:

Hope this helps.

@Nelson How we use value from nifty_high for entry purpose?

Purpose: I would like to take an entry only when the candle high is broken.