Tools, Techniques, and Training for Nirvana Platforms |
OmniTrader, VisualTrader, OmniFunds & OmniVest |
| ||
| ||
|
|
Luke 12:33 (NKJV) ... Sell what you have and give alms; provide yourselves money bags which do not grow old, a treasure in the heavens that does not fail, where no thief approaches nor moth destroys. |
System signal not firing | |||
|
BruceWilliamson |
| ||||
Spectator Posts: 5 Location: Australia: , Rhodes, NSW | Hi Folks I posted this on the OT Pro Forum but haven't had a response yet so thought I'd try my luck on TT I'm struggling to get the following system to fire any signals and hope that you may be able to help me spot the error. It's pretty basic pardon the pun but I am no VB expert. Attached is a screenshot of what I'm trying to capture with a fat X for the missing signal on the vote line. Below is the code for the #System and at the end, the debug values for the two days involved. Any help much appreciated Any questions, give me a shout Cheers Bruce
(OT22 Signal #0.PNG) Edited by BruceWilliamson 11/20/2021 11:32 PM Attachments OT22 Signal #0.PNG (135KB - 2 downloads) | ||||
JimDean |
| ||||
Owner/Admin Posts: 3925 Location: USA: GA, Lawrenceville | Hi Bruce You may have overthought this when coding it. No need for a for/next loop. OLang has an implicit “outer” loop that moves forward from bar 0 to the HRE, working on one bar then the next and so on. Your code is relative to the “current” bar in that loop. So, all you need is to check for the condition you want and fire a signal, as the implicit loop moves forward. I’m using the conditions in your snapshot. #system If bar > 10 then If L[1]= LLV(10) and C > O and C > H[1] then Signal = LongSignal Elseif H[1]= HHV(10) and C < O and C < L[1] then Signal = ShortSignal End if End if … you can add params if you want for the 10 and 1 values. But no need for for/next or intermediate dim’d variables. | ||||
JimDean |
| ||||
Owner/Admin Posts: 3925 Location: USA: GA, Lawrenceville | Here’s another thing to consider … You might also want to specify that the slope of the price prior to the recent turn was opposite the trade direction. Also, maybe make sure that the most recent close isn’t too high - that it’s not hitting a resistance level. #system If bar > 10 then If L[1]= LLV(10) and C > O and C > H[1] _ and LnReg_Slope(5)[1] < 0 and C < HHV(C,10)[1] then Signal = LongSignal Elseif H[1]= HHV(10) and C < O and C < L[1] _ and LnReg_Slope(5)[1] > 0 and C > LLV(C,10)[1] then Signal = ShortSignal End if End if | ||||
BruceWilliamson |
| ||||
Spectator Posts: 5 Location: Australia: , Rhodes, NSW | Hi Jim Thanks a million for your response, much appreciated The reason I have the loop is that I also want to check for LLV/HHV for the previous "n" periods i.e. for the scenario where it isn't a "V" bounce and takes a few days to develop, see attached for an example. Is there a better (more efficient) technique for accomplishing this look back processing? The reason I'm using parameters is that once I get it working I want to optimise the LLV/HHV & look back periods independently for longs and shorts as I firmly believe they behave quite differently Thanks for the tip on the linear regression, I was definitely going to incorporate a filter to prevent trading against the trend … whether that be short, medium or long term will come out in the wash during back testing and PortSim Cheers Bruce (OT22 Signal #1.PNG) Attachments OT22 Signal #1.PNG (34KB - 2 downloads) | ||||
JimDean |
| ||||
Owner/Admin Posts: 3925 Location: USA: GA, Lawrenceville | I admit that I don't really follow what you are trying to do ... the code without the For/Next will find ALL qualified signals from the beginning to the HRE, without having to doubly-loop through the bars. Have you tried running the code to see how it performs? I've looked over your original code with the for/next and although I can't see a need for it, there are a few seemingly illogical aspects. 1. Your uses of C and O inside the loop logically should have some kind of [myBar] pointer. 2. The L & H values being checked should likely use [myBar+1] pointers. I hope this helps. | ||||
BruceWilliamson |
| ||||
Spectator Posts: 5 Location: Australia: , Rhodes, NSW | Hi Jim I apologise, I'm not sure what HRE stands for and a quick search didn't find anything explanatory ?? I'm trying to capture the scenario where the LLV does NOT immediately precede the entry bar so in the screenshot above, hopefully stepping thru the chart chronologically and my dodgy pseudocode will convey my thoughts: 27/4 LLV Occurs ' 1st condition met 28/4 C (NOT) > H[1] AND C (NOT) > O ' i.e. fails long signal test in both cases
29/4 C > H[2] AND C > O ' i.e. passes long signal test in both cases
N.B. On 29/4 the [] (square brackets) values are 2 not 1 hence why I thought the FOR loop was appropriate In SQL or procedural code I would use recursion for the look back with a limit on how far I look back i.e. max 5 days for longs and 3 days for shorts I hope this makes sense Jim and doesn't muddy the waters further ?? Cheers Bruce | ||||
|
Owner of site: Jim Dean -- Forum content is confidential, and may not be distributed without written permission. | |