Login Page - Create Account

Support Board


Date/Time: Sun, 24 Nov 2024 04:22:45 +0000



Post From: Offering To The Community: Brett's Multi-Function Trailing Stop

[2015-10-29 19:42:46]
bjohnson777 (Brett Johnson) - Posts: 284
User126996: I understand about the delays. I keep getting hit with multiple things that "have to be fixed right now". With my health problems, I'm having trouble keeping up. I really need to be focused on programming right now.

Your proposed code would kinda work OK for replay, but it wouldn't work so well during live trades.

I ran into this problem and that's why I had to scrap my initial code and change over to sc.CurrentSystemDateTime.

The issue is using bars for current time. On a heavily traded 1min chart, this isn't too much of an issue, but a 2min chart or higher will show these problems.

2min Stock Market Example: Let's say you want to exit at 15:59 and stocks close at 16:00. On a 2min chart, odd numbers will never come up. The exit code wouldn't be triggered until 16:00 and then it would be too late. For a 2min example, it isn't too hard to just roll back the exit time to 15:58. But what about a 5min chart? or a 1h chart? That's when the code really starts to break.

Expanding the example a little more, what if trading totally falls off at 15:50? No bars means no tracked time ticks means nothing happens.

During the mid-day lull, some of the better traded stocks and ETF's might go several minutes without a trade. If someone set a time exit in the middle of that, nothing would happen.

That's my reasoning for turning on sc.UpdateAlways and checking the system clock when exit times are activated. This method is highly reliable during live trades.

During a replay, the bar time exit code would probably work OK for a 1min chart. For anything higher, there's the possibility that the person would want to exit sometime in the middle of a bar. The larger the bar time, the larger the time error would be. This would give skewed results and bad numbers in the replay reports. If someone tried to build a trading plan off that, there's a high possibility things could go wrong, and I'd get blamed.

I created the time exit features mainly as a safety catch. If I get distracted, get hit by an important phone call, something pulls me away, or I just have to go lie down for a little while, the safety catch will have my back in case I miss my exit time.

Thanks for the interest. :-)