Mql4 to pinescript help

 
    if (iTime(NULL, TF2, 0) == LatBarTime)
    return (0);
    LatBarTime = iTime(NULL, TF2, 0);
      
    for (i = HistoryBars + Len; i > 0; i--) 

    Sig_A = iBarShift(NULL, TF1, iTime(NULL, TF2, i));
I have two timeframe, Tf1 and Tf2.
How can I get the pinescript equivalent of this mql4 code
 

Improperly formatted code removed by moderator. Please EDIT your post and use the CODE button (Alt-S) when inserting code.

Code button in editor

Hover your mouse over your post and select "edit" ... 





 

for multi time frame option in pine script:

==> Use this assignment in definition and it creates a time frame input option to do all the calculation from that time frame.

study("Test", resolution = "")
 

try this  but i dont know  if is much correctnot use frequently  pine


//@version=5
indicator("My Indicator", overlay=true)

TF1 = timeframe.period  // Specifica il timeframe per TF1
TF2 = timeframe.period  // Specifica il timeframe per TF2

var int LatBarTime = na

if ta.timeframe.isseconds
    TF1 := timeframe.period * 60

if ta.timeframe.isminutes
    TF2 := timeframe.period * 60

if ta.timeframe.isdaily
    TF2 := timeframe.period * 60 * 24

if ta.timeframe.isweekly
    TF2 := timeframe.period * 60 * 24 * 7

if ta.timeframe.ismonthly
    TF2 := timeframe.period * 60 * 24 * 30

if ta.timeframe.isyearly
    TF2 := timeframe.period * 60 * 24 * 365

if ta.change(time) and ta.time(timeframe.period, "0")
    LatBarTime := time

i = barssince(LatBarTime)

Sig_A = ta.barssince(ta.time(timeframe.period, i))

plot(Sig_A)