[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Trade order with next bar open: Confusing result



PureBytes Links

Trading Reference Links

Color me confused!

I'm running TS5 and the last bar on my chart is Dec 7th. If I have the code:
   Sell the next bar at MyEntry Stop;
   print(date);
The last date to print to my debug window is 1011207 (december 7th). 

BUT, if  have the code:
   If Open of the next bar > MyPrice then Sell the next bar at MyEntry Stop;
   print(date);
The last date to print to my debug window is 1011206 (december 6th)! 

Why does the last bar disappear in my print statement? I also had a statement:
   if LastBarOnChart then print(date);
and that statement does not work either in the second case! I can see why I
would not get an order on the last bar as the open of the next bar does not yet
exist. But why would unrelated code suddenly not work either? How would I get
that other unrelated code to run?

Any light you can shed in this dark coding cave of hibernating insight would be
much appreciated. And, as I always said but always quickly forgot in grade
school, "I'll be your friend forever."

Thanks!