Construct an else statement that instructs to go long if the close is above the close five bars ago, and short if its below.
if close>close[5] then buy next bar open
else
sellshort next bar open;
Use a block statement to exit short and long trades after 5 bars.
If barssinceentry=5 then begin
sell next bar open;
buytocover next bar open;
end;
Code an else-if statement that will go long if the close is higher than the open, and short if the close isn’t higher than the open and it’s not Tuesday.
if close>open then buy next bar open
if dayofweek(date) <> 2 then sellshort next bar open;
Login
Password
Signup Here Lost Password