Login Page - Create Account

Support Board


Date/Time: Sun, 22 Dec 2024 20:03:19 +0000



Post From: Referencing new bar for closing position in SpreadsheetStudy for Auto trading

[2015-04-30 20:19:19]
Sawtooth - Posts: 4141
If you have a starting timestamp, say from a position entry (J42), you could use something like this (e.g., in cell T3):
=IF(AND($J$42-INT($J$42)>=A4-INT(A4),$J$42-INT($J$42)<A3-INT(A3)),1,T4+1)

This will produce a 1 at the open of the first bar following the bar where the entry occurred, and increment thereafter. You can then reference T3 in L3/N3 for a certain bar number after the entry. If you wanted to exit a position at the open of the bar following the entry, set the 'Signal Only On Bar Close(L,N)' to No and use a L3/N3 formula that included something like this:
AND($J$8<>0,T3=1)
Date Time Of Last Edit: 2015-04-30 20:20:09