# Create (Advanced)

Create Plus is the advanced version of the Create page that allows creation of longer and more complicated strategies. You can access it by heading over to the Create page and click on "Switch to Advance" in the top right corner of the Create page. There are several differences between the Basic Create page and the Advanced Create page.

#### Comparator¶

Create Plus supports the following comparators:

- up by/down by
- crosses above/crosses below
- lower than equal to/higher than equal to
- lower than/higher than/equal to

#### Math operator¶

You can also use math operators to add, subtract divide and multiply values. Math operators are usefull for creating complex conditions. How is helpfull?

Let's understand this with an example

Example

Suppose you want to trigger an entry when there with a rising RSI. But you don't know by what percentage the RSI should rise. Now, how do we create this condition?

Ok, first lets consider a stock moving in a straight line.
For the above stock, what is the difference between the price on September 3rd and September 2nd?
The answer is 0. So, if I were to create a condition to look for the movement like in the above chart,
I would put in the below mentioned condition:
`Close(0) - Close(-1) equal to 0`

Again, lets consider a stock, whose price is rising gradually.
For the above stock, there is a price difference between the candles. The difference between the price on September 3rd and September 2nd = INR 10 and the difference between the price on September 4th and September 3rd = INR 10. So, if we calculate the difference between all the candle it is going to give a positive number( i.e. higher than 0). So, if I were to create a condition to look for the movement like in the above chart,
I would put in the below mentioned condition:
`Close(0) - Close(-1) higher than 0`

Now, we are going to use the same logic for rising RSI, we are going to take the help of indicator offset and math operator to do this. An uptrending RSI can denoted by positive difference.

Condition:

** RSI(14,0) - RSI(14,-1) higher than 0** and

**and**

`RSI (14,-1) - RSI (14,-2) higher than 0`

`RSI(14,-2) - RSI(14,-3) higher than 0`

The above expression calculating the difference between current candle RSI[^1] and previous candle RSI and checking whether this is higher than 0.

#### Math Functions¶

You can also perform mathematical operations in a strategy using the Create plus page. This is not available in the Basic Create page.

**Period Min**: The period min function returns the item with the lowest value within stated period. This function takes in two arguments, one is the period and the other is a variable that users want to compare `Period min(Period, Variable)`

. It will process all the values mentioned for the period mentioned and return the minimum value.

Example

**Scan on:**`Nifty 100`

**Time frame:**`1 day`

**Conditions:** `Close(0) lower than Period Min(5, Low(-1))`

The above query would return a list of stocks within Nifty 100, whose **current candle close price**[^1] is lower than lowest low price of the past five days.

Example

In this example we are going to take the rising RSI example and simplify our conditions using Period min function.

**Condition**: `Period Min (3,RSI(14,0) - RSI(14,-1)) higher than 0`

The above condition is going to check for the same condition as in the RSI example, but we just write one line instead of 3 lines.

**Period Max**: The period max function returns the item with the highest value within stated period. This function takes in two arguments, one is the period and the other is a variable that users want to compare `Period max(Period, Variable)`

. It scans through all the values mentioned for the period mentioned and returns the maximum value.

Example

**Scan on:**`Nifty 100`

**Time frame:**`1 day`

**Conditions:** `Close(0) higher than Period Max(5, high(-1))`

The above query would return a list of stocks within Nifty 100, whose **current candle close price**[^1] is higher than the highest high price of the past five days.

**Min:** The min() function compares two variables and returns the item with the lowest value. This function takes in two variable arguments, that users want to compare `Min(Variable, Variable)`

. This is different from Period min as this consider two variables instead of one. The min function is especially helpfull when you want to compare two independent conditions.

Example

**Scan on:**`Nifty 100`

**Time frame:**`1 day`

**Conditions:** `Close(0) lower than Min(SMA(Low,20,0), Low(-1))`

The above query would first calculate previous 20 period's simple moving average(low price) and previous candle's low price and check which variable has the lowest value among them. Then the scanner will check if the current close price[^1] of all Nifty 100 stocks is lower than the lowest of the two variables.

**Max:** The max() function compares two variables and returns the item with the highest value. This function takes in two variable arguments, that users want to compare `Max(Variable, Variable)`

. This is different from Period max as this consider two variables instead of one. The max function is especially helpfull when you want to compare two independent conditions.

Example

**Scan on:**`Nifty 100`

**Time frame:**`1 day`

**Conditions:** `Close(0) higher than Max(SMA(High,20,0), High(-1))`

The above query would first calculate previous 20 period's simple moving average(high price) and previous candle's high price and check which variable has the highest value among them. Then the scanner will check if the current close price[^1] of all Nifty 100 stocks is higher than the highest of the two variables.

**Ceil**: The ceil() function approximates the given number to the smallest integer, greater than or equal to the given float value. This function is helpful when creating conditions that involve calculation of value and you are unsure about the result. This function rounds up the value to the nearest largest integer. Ceil(5.678) would be rounded up to 6.

**Floor**: The floor () function returns the largest integer less than or equal to the given number. Similar to Ceil function, this function lets you round off the value to the nearest largest integer. Floor(5.678) would be rounded off to 5.

**Abs**: The abs() function is similar to mod function and is used to return the absolute value of a number. abs(-6) and abs(6), both would return the absolute value of 6.

Example

Suppose, you want to create a condition to filter out stocks in which there is a sudden change price level in a short timeframe(current candle). To do this you want to calculate the difference in open and close price of the same candle and then check if the range is more than a specified level. In the below mnetioned example, the specified level is the period days's Open - Close range.

**Scan on:**`Nifty 100`

**Time frame:**`5 min`

**Conditions:** `abs(`

`Open(0) - Close(0)`

`)`

`higher than`

`abs(`

`Prev N(Open,-1,day) - Prev N(Close,-1,day)`

`)`

## But I was unable to understand, why did you use abs() function?

Because abs function always returns a value and ignores whether it is positive or negative. In case of a green candle **(Open - Close)** would be negetive but for a red candle **(Open - Close)** would be positive. So, the above scan will show result whenever there is a big price move **irrespective of trend (Up or Down)**.

##### Multi-Timeframe Functions¶

**Multi-Timeframe (MTF)**: The multi timeframe() function allows users to perform multi timeframe analysis i.e check conditions for two different timeframes in a single query.

Note

MTF calculates value of larger timeframe indicator values on partial candles (since the larger timeframe candle takes more time to form). When MTF is used for backtesting, it can have look-ahead bias and live alerts may not always be verifiable with charts or match when backtested. This is because it is not possible to predict future OHLC values and indicator. You should test your strategy and understand the backtest result charts and not just deploy it on the basis of p/L.

Example

Suppose, you want to create a query where you want to create a strategy and take an entry when the stock is

a. trading above 50 EMA on a daily timeframe, and

b. hourly RSI is above 50, and

c. MACD is giving a buy signal in 5 min timeframe

You will be able to do this with just 3 lines now...

**Time frame:**`5 min`

**Conditions:**`Close (0) higher than`

`Multi timeframe(`

`day, EMA(Close,50,0)`

** )** and

`Multi timeframe(`

`hour, RSI(14,0)`

`)`

`higher than 50`

and `MACD (12,26,9,macd,0)higher than MACD (12,26,9,signal,0)`

**Multi-Timeframe Completed (MTF-Completed)**: The multi timeframe Completed() function checks for completely formed candle(of same or larger timeframe). Unlike the MTF, MTF-Completed does not consider Partial candle information and does not have a look ahead bias.

If you create a condition as `Close(0) crosses above Multi-timeframe completed(day, Supertrend(7,3,0))`

, then it will compare currently candle’s close with the Supertrend on a completely formed day candle i.e yesterday’s Supertrend value. So Multitime-frame with offset of -1 = Multitime-frame completed

Example

Suppose, you want to create a query where you want to create a strategy and take an entry when the stock is

a. trading above 50 EMA on a daily timeframe, and

b. hourly RSI is above 50, and

c. MACD is giving a buy signal in 5 min timeframe

**Time frame:**`5 min`

**Conditions:**`Close (0) higher than`

`Multi-timeframe Completed(`

`day, EMA(Close,50,0)`

** )** and

`Multi-timeframe Completed(`

`hour, RSI(14,0)`

`)`

`higher than 50`

and `MACD (12,26,9,macd,0)higher than MACD (12,26,9,signal,0)`

#### Brackets¶

Brackets are used to denote and group sub-expression. Bracket follow BODMAS rules.