Achiii800
New member
Basically, I want to count the 'number of active 'entries'.
Suppose, we had a condition for going long and short as:
def buy = condition1;
def sell = condition2;
Every time 'buy' is true, I want to add 1, starting from 1.
Every time 'sell' is true, I want to subtract 1, starting from -1.
Note: I don't want it to be a cumulative of all, just the active orders.
Ex1:
buy, buy, sell, sell, sell
should return the following values:
1,2,-1,-2,-3
Ex2:
buy, NaN, NaN, sell, NaN
1,0,0,-1,0
Seems pretty simple, but I wasn't able to crack it. I tried using the CompoundValue() function, but pretty lost.
Would love some help on this!
Thanks in advance.
Suppose, we had a condition for going long and short as:
def buy = condition1;
def sell = condition2;
Every time 'buy' is true, I want to add 1, starting from 1.
Every time 'sell' is true, I want to subtract 1, starting from -1.
Note: I don't want it to be a cumulative of all, just the active orders.
Ex1:
buy, buy, sell, sell, sell
should return the following values:
1,2,-1,-2,-3
Ex2:
buy, NaN, NaN, sell, NaN
1,0,0,-1,0
Seems pretty simple, but I wasn't able to crack it. I tried using the CompoundValue() function, but pretty lost.
Would love some help on this!
Thanks in advance.