beauw
10-09-2008, 08:34 AM
I think I figured out the time portion of my problem, now I have a question about using BarsSinceEntry and BarsSinceExit as my entry and exit conditions.
My understanding of using BarsSinceExit in an onbarupdate script is that it will either return the number of bars since exit, or -1 in the case of no history of an exit. Is this the case? The way I had envisioned using it is in the condition that BarsSinceExit!=0 as one of my entry conditions. The problem that I have is that I am worried the today, as with the BarsSinceEntry()!=0 may mean that today will make BarsSinceEntry()=1. That is, if I do enter today, then will that make BarsSinceEntry=1 in an onbarupdate method? Or will it still be at 0?
The next day I expect that it will return a BarsSinceEntry of 1, since the program is now only running between 9:30 and 4 pm EST. Thus, I use both BarsSinceEntry() and BarsSinceExit()!=0. BarsSinceExit()!=0 is used for the entry, and BarsSinceEntry()>=1 or 2 depending on the answer you give to the question, does the BarsSinceEntry increase by 1 on the entry today? That is, if I buy today, will BarsSinceEntry be 0 or 1? It wasn't clear in the documents which it would be. I'm sure it will work the same for BarsSinceExit().
Thanks,
Beau
My understanding of using BarsSinceExit in an onbarupdate script is that it will either return the number of bars since exit, or -1 in the case of no history of an exit. Is this the case? The way I had envisioned using it is in the condition that BarsSinceExit!=0 as one of my entry conditions. The problem that I have is that I am worried the today, as with the BarsSinceEntry()!=0 may mean that today will make BarsSinceEntry()=1. That is, if I do enter today, then will that make BarsSinceEntry=1 in an onbarupdate method? Or will it still be at 0?
The next day I expect that it will return a BarsSinceEntry of 1, since the program is now only running between 9:30 and 4 pm EST. Thus, I use both BarsSinceEntry() and BarsSinceExit()!=0. BarsSinceExit()!=0 is used for the entry, and BarsSinceEntry()>=1 or 2 depending on the answer you give to the question, does the BarsSinceEntry increase by 1 on the entry today? That is, if I buy today, will BarsSinceEntry be 0 or 1? It wasn't clear in the documents which it would be. I'm sure it will work the same for BarsSinceExit().
Thanks,
Beau