Hi Nicolas
I would appreciate some guidance on coding a strategy that will buy at market on the nth occurrence of a Lower Low (LL). See picture attached for my expectaton of a Lower Low.
In english i’m looking for somthing like this:
Lower Low can be a variation of “low[5] > low[4] and low[4] >= low[3] and low[3] >= low[2] and low[2] < low[1] and low[1] < low[0]”
Start with setting the variables LL1 to LL5 to 0
Next
1st occurence of a LL set LL1 = Price of Low[2] within the Lower Low
In between each lower lower there will be a Lower High (which could be the opposite of the description of the Lower Lower above).
2nd occurence of LL set LL2 = Price of Low[2] within the 2nd Lower Low
3rd occurence of LL set variable LL3 = Price of Low[2] within the 3rd Lower Low
Then buy when LL3 is <> 0
Then when on market set LL variables back to 0 and start again.
Thanks for our support in advance.
Steve
Hello,
The signal is clearly in the style of Williams’ fractals.
To keep track of previous signals, I believe you can play with intermediate variables, and a table to log LL values. Something like this (not tested):
Remark: not sure why there is a need for 5 variables and why LL3 should be initialized if it is set to 0 just after
once HHcount = 0
once LLcount = 0
cLL = ... // Put here the conditions for LL
cHH = ... // Put here opposite conditions for HH
IF cHH and HHcount=0 THEN // Detect a swing high as intermediate signal
HHcount=HHcount+1
ENDIF
IF cLL and HHcount>0 and LLcount<2 THEN // Initialize the first 2 variables when there is a swing low
LL[LLcount]=low[2]
LLcount=LLcount+1
HHcount=0
ENDIF
IF cLL and HHcount>0 and LLcount=2 THEN // Action on third swing low
BUY xxx // Put here BUY instructions
LLcount=0
HHcount=0
ENDIF
PS: when do you plan to sell?
Thanks for the quick response!
I’ll see if i can incorporate this into my strategy! I’m still playing around with a trailing stop strategy for Selling.
It doesn’t like this, do i need to declare this as an array somehow prior to storing the values?
LL[LLcount]=low[2]
Hello,
Never used arrays before, but looking at one fresh post from @Nicolas, there is a need of $ sign
$LL[LLcount]=low[2]
To be tested
Indeed, you have to put a $ before a variable name to be considered as an array.
You getting anywhere with this s_darbey ?
I am watching with interest as I would love to see code that stores HH / HL and which flags up a change to LH / LL (and vice versa).