Right now it goes something like:
Code: Select all
condition1 = open[7] <= close[8] and high[4] > open[6];
if condition1 and long_on <> 1 then sellshort ("SE") 1 contract next bar open;
if marketposition = -1 then Print(File("C:\users\odrk\Desktop\name-enter-short.txt"),CurrentDate,CurrentTime);
if marketposition = -1 and barssinceentry >= holding_time-1 then sell ("timeX") all contracts next bar open;
if marketposition = 0 then Print(File("C:\users\odrk\Desktop\name-short-cover.txt"),CurrentDate,CurrentTime);
This returns the date and the time the short signal was triggered as expected, but the second print-statement writes an entry for every bar that a short position is not on. What I would like it to do is to print the date and time that the short was covered, otherwise I end up with a file with a lot of time stamps in it, most of them are not of interest.
Does anyone have any suggestions on how to do that?
Thanks in advance!