Trading Strategy – Buy at Market on nth occurrence of Lower Low

Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
    Posts
  • #177199 quote
    s_darbey
    Participant
    New

    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

    Lower-Lows.png Lower-Lows.png
    #177221 quote
    Swingueur
    Participant
    Average

    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?

    #177237 quote
    s_darbey
    Participant
    New

    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.

    #177238 quote
    s_darbey
    Participant
    New

    It doesn’t like this, do i need to declare this as an array somehow prior to storing the values?

    LL[LLcount]=low[2]

    #177375 quote
    Swingueur
    Participant
    Average

    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

    #177378 quote
    Nicolas
    Keymaster
    Legend

    Indeed, you have to put a $ before a variable name to be considered as an array.

    #177623 quote
    GraHal
    Participant
    Master

    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).

Viewing 7 posts - 1 through 7 (of 7 total)
  • You must be logged in to reply to this topic.
ProRealAI ProRealAI New

Stuck on this ProBuilder code?

Describe what this topic is trying to build, in plain English, and ProRealAI writes the ProRealTime™ indicator, screener or system for you.

Available in 7 languages
Try ProRealAI

Trading Strategy – Buy at Market on nth occurrence of Lower Low


ProOrder: Automated Strategies & Backtesting

New Reply
Author
author-avatar
s_darbey @s_darbey Participant
Summary

This topic contains 6 replies,
has 4 voices, and was last updated by GraHal
4 years, 12 months ago.

Topic Details
Forum: ProOrder: Automated Strategies & Backtesting
Language: English
Started: 09/10/2021
Status: Active
Attachments: 1 files
Logo Logo
Loading...