Current location | Thread information | |
![]() ![]() ![]() ![]() ![]() ![]() |
Last Activity 1/2/2025 4:50 PM 10 replies, 1984 viewings |
|
|
Printer friendly version |
^ Top | |||
kmcintyre![]() Legend ![]() ![]() ![]() ![]() Posts: 410 Joined: 8/30/2007 Location: Valley Center, CA ![]() |
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 ![]() ![]() ![]() Posts: 87 Joined: 8/1/2011 Location: Sydney, NSW, Australia ![]() |
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 ![]() ![]() Posts: 3022 Joined: 9/21/2006 Location: L'ville, GA ![]() |
#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 ![]() ![]() ![]() ![]() Posts: 410 Joined: 8/30/2007 Location: Valley Center, CA ![]() |
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 ![]() ![]() Posts: 3022 Joined: 9/21/2006 Location: L'ville, GA ![]() |
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 ![]() ![]() ![]() ![]() Posts: 410 Joined: 8/30/2007 Location: Valley Center, CA ![]() |
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 ![]() ![]() Posts: 3022 Joined: 9/21/2006 Location: L'ville, GA ![]() |
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 ![]() ![]() ![]() ![]() Posts: 410 Joined: 8/30/2007 Location: Valley Center, CA ![]() |
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 ![]() ![]() Posts: 3022 Joined: 9/21/2006 Location: L'ville, GA ![]() |
Interesting. No idea why. | ||
^ Top | |||
kmcintyre![]() Legend ![]() ![]() ![]() ![]() Posts: 410 Joined: 8/30/2007 Location: Valley Center, CA ![]() |
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… ![]() ![]() | ||
^ Top | |||
Jim Dean![]() Sage ![]() ![]() Posts: 3022 Joined: 9/21/2006 Location: L'ville, GA ![]() |
The SM level for bar X is set by the value determined in bar X-1 Also true for Limit levels. |
|
|
Legend | Action | Notification | |||
Administrator
Forum Moderator |
Registered User
Unregistered User |
![]() |
Toggle e-mail notification |