Jump to content

Make constant signal jump after certain timestamp


Recommended Posts

I have a constant signal of 0.002, I made it using the formula functionality. I need it to jump to 0.004 after a certain time-stamp. (28-5-2024 11:00).

How can I do this?  I would prefer not to use capsules.

The logic would look something like

if (time < time-stamp){

return 0.002

}else{

return 0.004

}

But I cannot get anything of this functionality to work.

Link to comment
Share on other sites

Posted (edited)

Hello Chris, 

you could try this:

signal(InterpolationMethod.Step, 1d, sample('2020-01-01T00:00:00Z', 0.002), sample('2024-01-01T00:00:00Z', 0.004)).resampleHold(10y, 1d)

This will create a signal based on the two timestamps. By using resampleHold() it will resample the signal to have one value each day and holding the last value for the amount of time you specified. In my example 10years. The duration must be at least the distance between the two datapoints, otherwise you will have a gap in your signal.

image.png.2e044acd0e39d62d05a6efa446dd0d5f.png

If you do not want to have values in the future you can extend the formula by adding .within(past()) at the end.

Regards,

Thorsten

Edited by Thorsten Vogt
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...