RSI higher then rsiMA by a specific value? - pine-script-v5

Thanks in advance.
How can I code that rsi is greater than rsiMA by a specific number in pine5?
I can only make it higher by the current ma value

Related

How to plot the lowest/highest RSI peak if RSI os / ob (pine script)

I started pine a few months ago, I am working on my script and I need help from someone more qualified than me to solve the following problem:
I would like to plot the lowest/highest RSI peak since rsi is oversold/overbought and have the last plot every time the condition(rsi os/ob) is true.
I tried valuewhen, lowest/highest, bars since functions but without results. Maybe need to use array or counter but for moment that is beyond my skills.
Thanks for your help.
enter image description here

How to incorporate real time variable into an equation for swift 3.0

I am trying to create a function to tell the distance traveled after the elapse of x amount of actual clock time.
Would like to incorporate real time into this function: So after x amount of time of traveling, will still be able to obtain distance traveled in real time.
So: let distanceTraveled = (rate * realClockTimeTraveled)
I just don't know how to incorporate actual clock time into the equation. I would appreciate your insights and suggestions. Thank you so much, in advance!

NetFlow, count min, median, and max number of bytes per flow

I have captured .silk file.
Is it possible to count min, median, and max number of bytes per flow using SiLK utils?
If yes, could you please point me in the right direction.
Have you tried this? rwstats --overall-stats filename.silk

How to check analog values to see if they have varied more than 1V in the last 5 min?

I have an AB PLC where I am trying to read analog values to see if the values vary more than 1V in 5 minutes? I have 10 sets of values I need to read. What would the easiest way to implement this? I can think of creating arrays to save the values each time I read them but the part I am having trouble with is, how to keep a running average of the values and compare against each time I read them.
Any help with this would be greatly appreciated!!
If I understand correctly all you want to do is see if your analog input is more or less than 1V from your set value? Just check if your value is greater than (set value + 1V) or less than (set value - 1V) every plc scan then set a bool value to true. That should be it.
I think finding an average of the analog input is not the way to go for this. But if you did want to find an average of an analog input over time you would need 3 things. Sample time, interval time, and total intervals. You would set up a sample time of, lets say 12 seconds. You will get the analog value every 12 seconds. After 60 seconds you would take the total and divide by (60/12 == 5). You would then add that value to the previous value average value that you totaled up and divide by the total number of intervals times (total intervals) you have accumulated. Hope I didn't make that to complicated.
What i understood from you question is you want check whether input voltage changed or not using the analog value you got, in my case i'm using 0 to 10v. Just simple store the analog value at max input i mean at 10v and just do the same for 0v and you can simply calculate the value for 1v. All you have do is compare the value with +/- 1v value you got from the calculation. you can do this dynamically with n-number of analog inputs(n= max analog inputs supported by your PLC.)
Have a look at FFL and FFU. They are First-In-First-Out buffers. You specify the length of the buffer you want and use FFL and FFU in pairs on the same buffer. Running averages are not that difficult to compute, and there are a number of ways to best implement depending on the platform (SLC vs CLX). The simplest method that would work on both platforms is to use a counter.ACC as a value to indirectly reference the element number of the FIFO for an addition function, then divide by the number of elements in your FIFO. This can all be done in a single multi-branch rung.
1. Load your value into FIFO buffer at some timer interval using FFL.
2. If you don't need the FIFO values 'Popped out' for use elsewhere, just set .POS to 0 when the FIFO is full and let it continue to update with new values, the values aren't cleared so they are still readable for your Running Average. But you MUST either use FFU to step the .POS back or use a MOV function to change the .POS once it's full or it will stop taking values.
3. Create a counter with a .PRE equal to the .LEN of your FIFO
4. On a parallel Rung, with each increment of the counter.ACC use an ADD function. Here's an example assuming CLX. If you're using SLC you can do the same thing but obviously you can't use tag names:
ADD
Value1: AllValues
Value2: FIFO[IndexCounter.ACC]
Destination: AllValues
5. When your counter.DN bit is set, divide AllValues by FIFO.LEN and store in a RunningAverage Tag, then reset the counter. Have your counter step once for each scan or put it all in a Periodic Function to execute the routine.

Generate 0 entity in a run

Suppose to have an time interval ( from 0 to 3600000 that is one hour in milliseconds). I have to generate entity with average 3 and I utilise an Exponential Distribution. The average is (3600000/3) that is how I wanna sample the distribution. If in a particular run I obtain 0 entity create is wrong or can be correct result? Anyone can help me?
It's not an error to get zero. With exponential interarrival times and a rate of 3 per hour, the number of occurrences in an hour has a Poisson distribution with λ=3. The probability of getting n outcomes is
e-λλn/n!
which for n=0 is just under 0.05. In other words, you would see a zero roughly one out of every 20 times.