Current location | Thread information | |
![]() ![]() ![]() ![]() ![]() ![]() |
Last Activity 10/5/2024 12:51 AM 5 replies, 4598 viewings |
|
|
Printer friendly version |
^ Top | |||
julesrulesny![]() Legend ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 498 Joined: 8/28/2009 Location: NYC ![]() |
Hello, I forgot who wrote "SysTriggerLine". Who ever did it is one of the greatest, simplest trend following systems I have used.. A simple adjustment of the parameters at various times of the 24hour trading day, occasionally timed with some volatility indicator, or just patterns and price.. It becomes a masterful system to use on Forex.. And that is all one may need due to its simplicity. Works best during busiest rading hours around 3am to 10am and 5pm to 11pm when markets trend the most. anyways, my goal is to write this also as a STOP, so I can get reversing sigals and Enter re-enter when the signals change... I have tried writing this as a stop.. I have tried creating TWO strategies, one where SysTriggerLine fires as a LONG.. and another strategy where SysTriggerLine fires as a SHORT. Nothing seems to work.. I really want it to STOP out when it changes from Long to short and vice versa.. Then re-enter. As you can see in attachment "Points 1 2 3 4 Systrigger" .. (Point 1 is an enter for a Short, point A i'd like to exit, then re-enter as a LONG.. Point 2, exit the LONG, and re-enter as a SHORT.. And so on...). ***However, I tried something else as well - this didn't work either -- an early warning I noticed - **As you can see in attachment "Close Above Systrigger A"... Sometimes price will CLOSE above or below the SysTriggerLine BEFORE it actually changes from Long to Short, or Short to Long. **See below: "SysTriggerABstop" #Stop Dim sumof as Single Dim i as Integer Dim tmp as Single Dim wt as Single Dim lsma_ma as Single #Param "RPeriod" ,30,1,60 #Param "LSMA_Period" ,20,2,60 Dim myTRG As Single myTRG = systriggerline2 sumof = 0 For i = 0 To (RPeriod-1) tmp = ((RPeriod-i) - ((RPeriod+1)/3))*Close sumof = sumof + tmp Next wt = sumof*6/(Rperiod*(Rperiod+1)) lsma_ma = wt[1] + (wt-wt[1])*2/(LSMA_Period+1) If wt[1] < lsma_ma[1] and wt > lsma_ma Then Signal = LongSignal ElseIf wt[1] > lsma_ma[1] and wt < lsma_ma Then Signal = ShortSignal End If If wt > lsma_ma Then PlotPrice("wt", wt, Blue, 2) PlotPrice("lsma_ma", lsma_ma, Blue, 2) ElseIf wt < lsma_ma Then PlotPrice("wt", wt, Red, 2) PlotPrice("lsma_ma", lsma_ma, Red, 2) End If If Signal = LongSignal and C[1] < myTRG[1] and C > myTRG then Signal = exitSignal ElseIf If Signal = ShortSignal and C[1] > myTRG[1] and C < myTRG then Signal = exitSignal End If For what its worth, I'd rather just enter/exit as reversing signals.. So I attempted this: SysTriggerEEstop #Stop Dim sumof as Single Dim i as Integer Dim tmp as Single Dim wt as Single Dim lsma_ma as Single #Param "RPeriod" ,30,1,60 #Param "LSMA_Period" ,20,2,60 sumof = 0 For i = 0 To (RPeriod-1) tmp = ((RPeriod-i) - ((RPeriod+1)/3))*Close sumof = sumof + tmp Next wt = sumof*6/(Rperiod*(Rperiod+1)) lsma_ma = wt[1] + (wt-wt[1])*2/(LSMA_Period+1) If wt[1] < lsma_ma[1] and wt > lsma_ma Then Signal = LongSignal ElseIf wt[1] > lsma_ma[1] and wt < lsma_ma Then Signal = ExitSignal If wt[1] > lsma_ma[1] and wt > lsma_ma Then Signal = ShortSignal ElseIf wt[1] < lsma_ma[1] and wt < lsma_ma Then Signal = ExitSignal End If Clearly, neither work -- and I am at a loss.. I tried copying and pasting using other stops.. and filling in the gaps.. ****I even tried using my zScoreMA as a Stop..(As often when the indicator ZERO line is crossed, signifies a trend change in direction at same time with SysTriggerLine .. couldn't do that either).. Thanks if anyone can point me in the right direction. Marc [Edited by julesrulesny on 12/29/2014 11:20 PM] ![]() ![]() ![]() ![]() | ||
^ Top | |||
Jim Dean![]() Sage ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 3433 Joined: 3/13/2006 Location: L'ville, GA ![]() |
Impossible to do reversing via an OLang stop, or for that matter, with a trade plan. Must use the reversing option of an orders block. | ||
^ Top | |||
julesrulesny![]() Legend ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 498 Joined: 8/28/2009 Location: NYC ![]() |
I did not know that. Thank you. Can a system such as this be written as a stop?? | ||
^ Top | |||
Jim Dean![]() Sage ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 3433 Joined: 3/13/2006 Location: L'ville, GA ![]() |
You cannot assign LongSignal or ShortSignal in a stop, you can only test them. You can assign ExitSignal in a stop but not in a System. | ||
^ Top | |||
julesrulesny![]() Legend ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 498 Joined: 8/28/2009 Location: NYC ![]() |
Ok. Not exactly what you mean by "...you can only test them"? If I can't use LongSignal ShortSignal, how is it they can be tested? Do you mean "Debugging"? Why I'm confused is just b/c I see LongSignal ShortSignal being assigned in other #Stops in OLang? Rather a more appropriate term is they are being used in these Stops? (**Think I recall now discussing this once a long time ago.. a bit of dejavu). Perhaps, I don't understand the difference of the term "assign" then???? For example: Here's a STOP in OTPRO ...."PEAK STOP" #Stop ' Defines that this is a stop (required for project folders) ' *************************************************************************** ' * Peak Stop ' * by Hans van der Wal ' * ' * Summary: ' * Stop out of an existing trade if we go a given percent below yesterday's Close ' * ' * Parameters: ' * Percent = percentage value to use. ' * ' * Last Update: November 1, 2005 ' *************************************************************************** #Param "Percent", 1 ' Defines parameter Percent with a default value of 1(%) ' If we have a long signal in the vote line, and ' the close price is at least Percent % (1%) below yesterday's close price If Signal = LongSignal And (C-C[1])/C[1] < -1* Percent/100 Then Signal = ExitSignal ' exit the trade ' If we have a short signal in the vote line, and ' the close price is at least Percent % (1%) above yesterday's close price ElseIf Signal = ShortSignal And (C-C[1])/C[1] > Percent/100 Then Signal = ExitSignal ' exit the trade End If | ||
^ Top | |||
Jim Dean![]() Sage ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 3433 Joined: 3/13/2006 Location: L'ville, GA ![]() |
If you try to do: Signal = LongSignal or Signal = ShortSignal ... in a STOP, as a separate assignment line, it is IGNORED. But you normally will use one or both of them in a SYSTEM. The only signal assignment (ie setting) you can do in a STOP is: Signal = ExitSignal ==== You can "test" the direction of the active trade in a STOP by: if Signal = LongSignal then ... or if Signal = ShortSignal then ... But you can't change the direction of the signal in a Stop routine ... you can only end the active trade. === If you saw Long/ShortSignal "assignments" in OLang STOP routines before, then probably those routines were faulty. You probably are remembering their use in SYSTEM routines. [Edited by Jim Dean on 12/31/2014 6:51 PM] |
|
|
Legend | Action | Notification | |||
Administrator
Forum Moderator |
Registered User
Unregistered User |
![]() |
Toggle e-mail notification |