OmniTrader Professional Forum OmniTrader Professional Forum
forums calendars search
today this week
 
register logon control panel Forum Rules
You are currently browsing as a guest.
You should logon to access more features
A Self-Moderated Community - ALL MEMBERS, PLEASE READ!
Vote for Members who contribute the most to your trading, and help us moderate content within the Forums.


  Current location        Thread information  
OmniTrader Professional Forum
OmniTrader Pro General Discussion
Unique trailing stop
Last Activity 9/15/2018 4:32 AM
5 replies, 707 viewings

Jump to page : 1
Now viewing page 1 [25 messages per page]
 
back reply
Printer friendly version

^ Top
John Crowley

Member

Posts: 6

Joined: 6/17/2016

User Profile
 
Subject : Unique trailing stop
Posted : 6/17/2016 3:40 PM
Post #26148

I’m trying to code a specific type of trailing stop. I have OT Pro.
It’s a trailing stop but requires certain reference points

The first reference point is the last pivot low
Using WaveTrader which has its own stop level that gives me the last pivot low value

WT_LL (0.7,14,0), this is the dotted red line in the chart as an example

The other reference point is the value of the SMA(30) at the point of the last pivot low, as defined by the WT_LL

What I want from the stop is to initially set a stop loss at the last pivot low as a starting point, if the last pivot low is below the sma 30
If the SMA 30 is below the last pivot low, the initial stop loss should be 1% below the 30sma

The stop I want to trail, based on the next pivot low
So the next pivot low should raise the stop according to the above. Ie the lower of the pivot low or 1% below the SMA(30) if the SMA is lower than the pivot
It shouldn’t trail the SMA. It should only trail when the pivot low changes

hopefully the attached explains what I'm trying to do
Can anybody could help with this?



[Edited by John Crowley on 6/18/2016 2:04 AM]

Attached file : trailing pivot stop.JPG (153KB - 99 downloads)

^ Top
John Crowley

Member

Posts: 6

Joined: 6/17/2016

User Profile
 
Subject : RE: Unique trailing stop
Posted : 6/18/2016 1:55 AM
Post #26149 - In reply to #26148

I've gone one step further and with what actually turned out to be simpler than I thought I've produced a stop that (almost) matches with the requirements
here is the code:
#Stop

Dim myvalue as single
Dim mystop as single

If WT_LL(0.7, 14, 0) < sma(30) Then
MyValue = WT_LL(0.70, 14, 0)
Else If MyValue = sma(30)
end if

MyStop = MyValue


If Signal = Longsignal And L Signal = ExitSignal
End if

plotprice("Stop",MyStop,green)

the plot is displayed in green on the second chart. however my problem is this:
the code of the stop is WT_ZZ(0.7,14,0) which as you can see in the attachment is the same as the indicator setting
however the movement of the stop is not using the same settings, its clearly taking differennt parameters

is this a bug?
could somebody please verify

[Edited by John Crowley on 6/18/2016 2:01 AM]

Attached file : WT settings.JPG (83KB - 91 downloads)

^ Top
Jim Dean

Sage
2000100010025
Posts: 3142

Joined: 3/13/2006
Location: L'ville, GA

User Profile
 
Subject : RE: Unique trailing stop
Posted : 6/18/2016 2:02 AM
Post #26150 - In reply to #26149

probably because the zigzag formula only ID's the pivots AFTER the fact ... it uses hindsight and therefore must be implemented with care.

plot the zigzag indicator on the chart with the same params to see when it actually "recognizes" a pivot.
^ Top
John Crowley

Member

Posts: 6

Joined: 6/17/2016

User Profile
 
Subject : RE: Unique trailing stop
Posted : 6/18/2016 2:17 AM
Post #26151 - In reply to #26150

Thanks for the reply
I've attached the WT_ZZ indicator on the chart, same settings as the WT_LL
the two are identical, the ZZ giving the signals as per the indicator, so you can see where the change in pivot is occuring.

the stop, using the same parameters, does not behave as per the indicator settings
I've attached the indicator, and a vertical line where the change is being recognised, but the stop doesn't move with the same precision.
Attached file : WT_ZZ.JPG (79KB - 98 downloads)

^ Top
Jim Dean

Sage
2000100010025
Posts: 3142

Joined: 3/13/2006
Location: L'ville, GA

User Profile
 
Subject : RE: Unique trailing stop
Posted : 6/18/2016 2:24 AM
Post #26152 - In reply to #26151

The code you posted, as it shows up in the post anyways, has several errors in it. try attaching a zip file.

I really busy tomorrow so I don't know when I can get back to you.
^ Top
John Crowley

Member

Posts: 6

Joined: 6/17/2016

User Profile
 
Subject : RE: Unique trailing stop
Posted : 6/18/2016 2:47 AM
Post #26153 - In reply to #26152

here is a screen shot of the code, yes when you copy and paste into the body, some of the syntax is missing.
I appreciate any time you have Jim, and appreciate just the reply itself!

In the mean time I will work on the buffer I wanted originally

Attached file : code.JPG (23KB - 110 downloads)

Jump to page : 1
Now viewing page 1 [25 messages per page]
back reply

Legend    Action      Notification  
Administrator
Forum Moderator
Registered User
Unregistered User
E-Mail this thread to a friend
Toggle e-mail notification


Nirvana Systems
For any problems or issues please contact our Webmaster at webmaster@nirvsys.com.