As I don’t buy/sell right here and just use this condition to be open for x bars I am wondering how to count from there.
Code: Select all
If condition1 then begin
count=count+1;
///count is 1 when condition became true
count1=Holdperiod-count;
///as count counting the number of bars since the condition1 is true, I am using another variable count1 . Holdperiod indicates how many bars condition1 shall be true, see below
If count1<0 then condition1=false