rottentrade
Member
I'm a bit confused about using the offset. Does "condition[1]" (see below) refers to the condition that happened 1 bar ago, or does it refer to "the most recent condition" (1 occurrence away)? If first, how would you code for the second one?
Here's my code (hypothetical):
def condition = price crosses above moving average;
def entry = condition[1];
Now I want to say, "if price is trading below the condition that happened earlier (whenever that is), then buy"
def condition = if price below condition[1] then buy else double.nan;
Does that work? Thnks in advance
Here's my code (hypothetical):
def condition = price crosses above moving average;
def entry = condition[1];
Now I want to say, "if price is trading below the condition that happened earlier (whenever that is), then buy"
def condition = if price below condition[1] then buy else double.nan;
Does that work? Thnks in advance