Entry and exit timer script for ThinkorSwim

M

mcdon030

Member
been trying to create a timer to confirm entry and exit. Basically, if entry holds after a certain hold time within a bar, then take it. if anyone has addtions or thoughts, please proceed:

Code:
## Mcdon 030 
#date 6112020

script timer{
input starttime = 0930;
input signal =0.0;
input holdtime =14;
def elapseSecs =  secondsFromTime(starttime);
def SecAtSignal = if !isnan(signal) then elapseSecs else SecAtSignal[1];
def elapsetgt =SecAtSignal+holdtime;
def trigger = if elapseSecs== elapsetgt && signal then 1 else 0;
plot time = if !isnan(trigger) then close else double.nan;
}
input starttime = 0930;
input entryholdtime =10;
input exitholdtime =20;
 
Last edited by a moderator:
K

Kimberly

New member
I am getting an error that says "At least one plot should be defined"
 
Top