How to calculate an formula in a different timeframe

gr68

Suppose I have this code to calculate SMIsignal , emasignal .

//@version=4
study("test", overlay=true)

    a = 20
    b = 2
    ob = 40
    os = -40
    // Range Calculation
    ll = lowest (low, a)
    hh = highest (high, a)
    diff = hh - ll
    rdiff = close - (hh+ll)/2
    avgrel = ema(ema(rdiff,b),b)
    avgdiff = ema(ema(diff,b),b)
    SMI = avgdiff != 0 ? (avgrel/(avgdiff/2)*100) : 0

    ////////////////////////////////////////
    SMIsignal = ema(SMI,b)
    emasignal = ema(SMI, 10)

Trading view will calculate the value for the timeframe used in Tradingview e.g. 20 minutes . What code should I use if I would calculate SMIsignal and emasignal for a different timeframe for example 7 minutes ?

Mahome

use security function

example:

// both in same timeframe but the chart in different timeframe 
[_smi, _ema] =security(syminfo.tickerid, "7", [SMIsignal, emasignal])

or

// 7-min resolution
_smi = security(syminfo.tickerid, "7", SMIsignal)
// 20-min resolution
_ema = security(syminfo.tickerid, "20", emasignal)

for more information check https://www.tradingview.com/pine-script-reference/#fun_security

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

Excel formula to calculate orders placed per person within given timeframe of first order

From Dev

How calculate mysql variance and standard deviation within timeframe

From Dev

Excel Formula to Calculate Percentage on Different Sheet

From Dev

Math - how to calculate arccos formula?

From Dev

Math - how to calculate arccos formula?

From Dev

How to re-calculate a cell's formula?

From Dev

How to calculate a formula and get a floating point number

From Dev

How to calculate formula from string to int

From Dev

How to combine data and calculate in Excel with formula

From Dev

Build a formula to calculate total duration in Excel when have different parameters

From Dev

How to calculate with different columns of dates

From Dev

How to calculate the average of different categories?

From Dev

How to use different formula in case of en error?

From Dev

Calculate the number of hours in a given timeframe between two datetimes

From Dev

How to auto calculate/resolve a named cell within a formula?

From Dev

How to create a formula that calculate the total of spending base on their names?

From Dev

Calculate how high a cell value is compared to a formula with a variable

From Dev

Excel Formula: How to calculate amount to add, given target average price

From Dev

Formula to calculate net winnings

From Dev

Need a formula to calculate roll

From Dev

Better algorithm to calculate this formula

From Dev

Formula to calculate if 0

From Dev

Calculate with formula javascript

From Dev

How to calculate RMSE on different time scale

From Dev

How to calculate difference between data in different rows?

From Dev

How to calculate the percentage in different rows of one column?

From Dev

How to Calculate Values of Options from Different Select

From Dev

how to calculate the Sum of sales associated to different users

From Dev

EXCEL Formula_How to do different things according to the content of the cell

Related Related

  1. 1

    Excel formula to calculate orders placed per person within given timeframe of first order

  2. 2

    How calculate mysql variance and standard deviation within timeframe

  3. 3

    Excel Formula to Calculate Percentage on Different Sheet

  4. 4

    Math - how to calculate arccos formula?

  5. 5

    Math - how to calculate arccos formula?

  6. 6

    How to re-calculate a cell's formula?

  7. 7

    How to calculate a formula and get a floating point number

  8. 8

    How to calculate formula from string to int

  9. 9

    How to combine data and calculate in Excel with formula

  10. 10

    Build a formula to calculate total duration in Excel when have different parameters

  11. 11

    How to calculate with different columns of dates

  12. 12

    How to calculate the average of different categories?

  13. 13

    How to use different formula in case of en error?

  14. 14

    Calculate the number of hours in a given timeframe between two datetimes

  15. 15

    How to auto calculate/resolve a named cell within a formula?

  16. 16

    How to create a formula that calculate the total of spending base on their names?

  17. 17

    Calculate how high a cell value is compared to a formula with a variable

  18. 18

    Excel Formula: How to calculate amount to add, given target average price

  19. 19

    Formula to calculate net winnings

  20. 20

    Need a formula to calculate roll

  21. 21

    Better algorithm to calculate this formula

  22. 22

    Formula to calculate if 0

  23. 23

    Calculate with formula javascript

  24. 24

    How to calculate RMSE on different time scale

  25. 25

    How to calculate difference between data in different rows?

  26. 26

    How to calculate the percentage in different rows of one column?

  27. 27

    How to Calculate Values of Options from Different Select

  28. 28

    how to calculate the Sum of sales associated to different users

  29. 29

    EXCEL Formula_How to do different things according to the content of the cell

HotTag

Archive