- Katılım
- 23 Eki 2020
- Mesajlar
- 1,828
----- Original Message ----- From: Ed Montero To: metastock@xxxxxxxxxxxxx Sent: Thursday, April 20, 2000 7:37 AM Subject: Code for stops Is there any way to set a moving trailing stop in a MS System based on my own criteria. Specifically, on my S&P system, I move a trailing stop if a bar in my trade direction finishes in the upper 25% of the bar (if long) or lower 25% of the bar (if short), I move the trailing stop to a few ticks under/over the bar. I may also move it based on other criteria, such as weakening trend, etc. Can you write code to set a stop, or does it have to be set up using the available MS options only. Thanks for your help, Ed Montero emontero@xxxxxxxxxxxxxx Re: Code for stops . To: "MetaStock listserver" <metastock@xxxxxxxxxxxxx> . Subject: Re: Code for stops . From: "Glen Wallace" <gcwallace@xxxxxxxx> . Date: Thu, 20 Apr 2000 10:10:02 -0700 . References: <003601bfaad6$05e8cf50$336c83cc@xxxxxxxx> . Reply-To: metastock@xxxxxxxxxxxxx . Sender: owner-metastock@xxxxxxxxxxxxx Ed: Yes, you can write code to set a stop, but it's not pretty if you need to refer to the entry price or entry date. You also have the problem that the System Tester can only exit your trade on the open, close, high or low of the particular bar. The System Tester's built-in stops allow you to exit at the stop price, but I don't think these are flexible enough for what you have in mind. If you explain your exit parameters in more detail, someone here can probably make some suggestions. For what you have described, you could exit a long position with: | |
| |
Exit a Long Position ExitPrice:= If(Close >= High-0.25*(High-Low), Low-AFewTicks, PREV); Low <= ExitPrice | |
| |
Regards [21707] | |
| |
Source / From: |