retesere20

tos-seconds-till-lastopen

Mar 14th, 2019
80
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. def Secs_till_close__Future_looped= if (!Market_Hours_USED) then na else if IsZeroFirstBar then na else
  2. if (DaysPassed OR !isnan(Secs_till_close__Future_looped[1])) then Secs_till_close__Future_looped[1] else
  3. fold ST_indx=0 to max_bars_in_day with D_start=0 while D_start==0 do if getvalue(IsNewDay,-ST_indx) and getvalue(Seconds_Till_OPEN,-ST_indx+1)<0 and getvalue(Seconds_Till_CLOSE,-ST_indx+1)>0 then getvalue(Seconds_Till_CLOSE,-ST_indx+1) else getvalue(BarFrameInSeconds,0);
  4.  
  5.  
  6.  
  7. def Seconds_till_Last_Market_Bar = if (!Market_Hours_USED) then na else if IsZeroFirstBar then na
  8. else if (Seconds_Till_CLOSE < Secs_till_close__Future_looped) and Seconds_Till_OPEN<0 and Seconds_Till_CLOSE>0 then Seconds_Till_CLOSE
  9. else if IsNewDay and Seconds_Till_CLOSE[1] >Seconds_till_Last_Market_Bar[1] and Seconds_Till_OPEN<0 and Seconds_Till_CLOSE>0 then Seconds_Till_CLOSE[1] else Seconds_till_Last_Market_Bar[1];
RAW Paste Data