OmniTrader Forum OmniTrader 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 Upgrade Forums
Trade Plans
I'm confused - help!
Last Activity 1/2/2025 4:50 PM
10 replies, 1984 viewings

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

^ Top
kmcintyre

Legend
100100100100
Posts: 410

Joined: 8/30/2007
Location: Valley Center, CA

User Profile
 
Subject : I'm confused - help!
Posted : 7/3/2018 9:07 PM
Post #44931

So what's mew. right? lol

I want a very simple fixed stop loss set at the LLV(2) of the bar that triggered the trade.


Stated another way, I want to exit if price touches the lowest low between yesterday's and today's bars. (EOD)

I've created a trade plan, but I haven't found a stop loss that allows me to specify the level via OmniScript.


I wrote a #stop in OL, but I don't see how I can ascertain the trigger bar so I can specify LLV(2)[ trigger ].

I also don't understand why I would write an OL stop for a fixed level. Doesn't the #stop code get invoked on every bar when a LongSignal or ShortSignal is active?

I only need the SL level set once when the trade plan is instantiated. (Actually when Step 2 of the TP is entered, after the long 100% market condition completes...)

I am sure there must be a easy way to do this. but I'm not seeing it.

Help!

Thanks


^ Top
John W

Regular
252525
Posts: 87

Joined: 8/1/2011
Location: Sydney, NSW, Australia

User Profile
 
Subject : RE: I'm confused - help!
Posted : 7/3/2018 9:20 PM
Post #44932 - In reply to #44931

Not sure if this helps but the RangeStop provided by Nirvana in OL with a 2 bar lookback would be:

If Signal = LongSignal And C < LLV(L,2)[1] Then
Signal = ExitSignal
^ Top
Jim Dean

Sage
20001000
Posts: 3022

Joined: 9/21/2006
Location: L'ville, GA

User Profile
 
Subject : RE: I'm confused - help!
Posted : 7/3/2018 9:39 PM
Post #44933 - In reply to #44931

#Stop
Dim thresh as single
If thresh = 0 then
Thresh = LLV(2)
Elseif L <= thresh then
Signal = ExitSignal
End if


… this is for long trades only.

[Edited by Jim Dean on 7/3/2018 9:40 PM]

^ Top
kmcintyre

Legend
100100100100
Posts: 410

Joined: 8/30/2007
Location: Valley Center, CA

User Profile
 
Subject : RE: I'm confused - help!
Posted : 7/4/2018 7:33 AM
Post #44934 - In reply to #44933

Jim,

Love it! Thanks.

So the Thresh is only set the first time the stop is called, but evaluated on every bar...


I plan on making the SL and TP stops (which will be similar in logic) broker stops. Do you know if the #stop function will be called immediately after the entry fills, or does it take a bar completion for the #stop to be called?


Happy 4th!

^ Top
Jim Dean

Sage
20001000
Posts: 3022

Joined: 9/21/2006
Location: L'ville, GA

User Profile
 
Subject : RE: I'm confused - help!
Posted : 7/4/2018 7:47 AM
Post #44935 - In reply to #44934

TP’s immediately move to the next step and apply its conditions. If the next step’s conditions are not immediately satisfied then it stays on that step until that happens.

The first bar that a stop-loop sees is the Signal bar. So the first LLV item is the signal bar low, and the other one for LLV(2) is the low of the bar just before the signal bar.

[Edited by Jim Dean on 7/4/2018 7:50 AM]

^ Top
kmcintyre

Legend
100100100100
Posts: 410

Joined: 8/30/2007
Location: Valley Center, CA

User Profile
 
Subject : RE: I'm confused - help!
Posted : 7/5/2018 12:32 PM
Post #44944 - In reply to #44935

Thanks for all the help Jim!

I used the Long Signal (and Short Signal) drawing tool to check out my stop levels. (And Take Profit levels for a different OL #stop...)

The only thing I noticed was that I needed to use LLV(1) to get the lowest low between the current (signal) bar and the previous bar. I was expecting a 2 parameter would be required to compare 2 bars, but that returned the lowest low of the signal bar and the 2 previous bars. Whatever. Can't argue with success...


Cheers


^ Top
Jim Dean

Sage
20001000
Posts: 3022

Joined: 9/21/2006
Location: L'ville, GA

User Profile
 
Subject : RE: I'm confused - help!
Posted : 7/5/2018 2:54 PM
Post #44949 - In reply to #44944

Your post actually is saying two different things, so I’m not sure how to reply.

The code I provided should set the threshold at the lower of the Signal bar’s low, and the bar just before the signal bar.

And should fire a long entry if the price of any bar after the signal bar exceeds that value.
(If attached to a buy order in step one)

[Edited by Jim Dean on 7/5/2018 2:56 PM]

^ Top
kmcintyre

Legend
100100100100
Posts: 410

Joined: 8/30/2007
Location: Valley Center, CA

User Profile
 
Subject : RE: I'm confused - help!
Posted : 7/5/2018 5:45 PM
Post #44951 - In reply to #44949

I think I'm saying the same thing in all my posts

LLV(2) returned the lowest low from L[0], L[1], and L[2]. This is absolutely not what I expected, but a PlotPrice() of the value returned from LLv(2) visually confirmed that result.

I had to use LLV(1) to get the lowest low value between the current bar (L[0] if you will) and L[1].

Here's the code I am using...

#stop

' implements Steve Primo's Strategy #4 stop loss

#Param "Cushion", 0.10 ' 10 cents below LLV(1) or above HHV(1)

Dim sLevel as Single

if Signal = LongSignal then
if sLevel = 0 then ' first call - uninitialized
sLevel = LLV(1) - Cushion
end if

if L <= sLevel then
Signal = ExitSignal
end if
else if Signal = ShortSignal then
if sLevel = 0 then ' first call - uninitialized
sLevel = HHV(1) + Cushion
end if

if H >= sLevel then
Signal = ExitSignal
end if
end if

PlotPrice("Primo4SL", sLevel, Black, 1 )


^ Top
Jim Dean

Sage
20001000
Posts: 3022

Joined: 9/21/2006
Location: L'ville, GA

User Profile
 
Subject : RE: I'm confused - help!
Posted : 7/5/2018 5:53 PM
Post #44952 - In reply to #44951

Interesting. No idea why.
^ Top
kmcintyre

Legend
100100100100
Posts: 410

Joined: 8/30/2007
Location: Valley Center, CA

User Profile
 
Subject : RE: I'm confused - help!
Posted : 7/5/2018 7:02 PM
Post #44953 - In reply to #44949

Actually LLV(2) is not the issue.

Looking closer, when I use the LongSignal drawing tool to highlight a bar, the Low value returned for that bar is the low for the previous bar.

See the attached png. I positioned the LongSignal tool on the last bar in the chart, The stop line was drawn at the L[1]. I moved the LongSignal tool to the right of the last bar. The stop line never is drawn on the low of the last bar.

The stops code is shown in another png. The sLevel of LongSignal is assigned L. The sLevel is plotted to the price chart at the bottom of the script. No LLV in the code path...

Is the problem with the LongSignal drawing tool? Or is the [0] bar when #stop is ran not the signal bar? I dunno…


Attached file : OT Long Entry Tool.png (74KB - 279 downloads)
Attached file : OT stop code.png (94KB - 301 downloads)

^ Top
Jim Dean

Sage
20001000
Posts: 3022

Joined: 9/21/2006
Location: L'ville, GA

User Profile
 
Subject : RE: I'm confused - help!
Posted : 7/5/2018 7:48 PM
Post #44954 - In reply to #44953

The SM level for bar X is set by the value determined in bar X-1

Also true for Limit levels.
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.