thestrat

Tagged: 

Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
    Posts
  • #65075
    Marc
    • Topics: 10
    • Replies: 22
    • Posts: 32

    Hi guys,

    I am trying to write a script to identify this 3 candle set up:

    //condition so 3rd from last candle is a 2//
    v1= HIGH()[2] > HIGH()[3];
    v2= LOW()[2] < low()[3];

    v1 or v2

    //2nd candle is an inside candlet//
    HIGH()[1] < HIGH()[2];
    and LOW()[1] > LOW()[2];
    and

    //last day candle//
    HIGH() > HIGH()[1];

    I have in the scan: Unknown function: offset low2  > i don’t know what is causing the issue.

    Previously I have tried this formula:
    high() > high(1) and LOW() >= LOW(1);
    and HIGH(0)[1] < HIGH(0)[2];
    and low(0)[1]> low(0){2];

    >>> and HIGH(0)[1] < HIGH(0)[2]; is not giving correct results.

    pls let me know how to correct it.

    This is part of a trading method called Thestrat. It requires to draw horizontal lines on top/ bottom of M/W/D candles. I have read in the forum that Optuma’s script did not allow to do draw horizontal line automatically but the post was 2 years old I believe. Is there a way now to automatically draw those lines from highs/low of multi time frames?

    thanks and best regards
    Marc.

    #65079
    Darren
    • Topics: 66
    • Replies: 633
    • Posts: 699

    Hi Marc,

    The high 3 bars ago would be HIGH()[2] not HIGH()[3]. You could also use HIGH(2) to get the same result, but don’t put a 0 in the parentheses if using square brackets.

    For inside bars we have a BarTypes() function that will automatically find them, so BARTYPES(DEFAULT=Inside)[1] can be used to find when yesterday was an inside bar.

    As for the horizontals, they can be drawn using a Show Plot, so to plot the month/week high use HIGH() and click on the text to change the Timeframe to Month or Week:

    Capture

    To only plot the current month high use LAST(HIGH(Month(PERIODAMOUNT=1)))

    To only plot the previous month’s high: LAST(HIGH(Month(PERIODAMOUNT=1))[1])

    Hope that helps!

    #65081
    Marc
    • Topics: 10
    • Replies: 22
    • Posts: 32

    Hi Darren,

    Ok I got how to plot the lines. Thank you very much.

    Regarding the formula, it does not really work though

    The candle from 2 days ago needs to be a directional candle meaning it closed higher or lower than the candle 3 days ago . So it should be outside bar + inside bar + outside bar (Up) but this does not work:
    BARTYPES(DEFAULT=Outside)[2];
    and BARTYPES(DEFAULT=Inside)[1];
    and BARTYPES(Day(PERIODAMOUNT=1), DEFAULT=Outside);
    when I Execute scan: unknown Function: offset Bartypesdefault= Inside1

    I have modified the original formula accordingly and it works
    v1= HIGH()[2] > HIGH()[3] and LOW()[2] >= LOW()[3];
    v2= LOW()[2] < low()[3] and HIGH()[2] <= HIGH()[3];
    v1 or v2

    However when I add the inside bar and BARTYPES(DEFAULT=Inside)[1]; on the NASDAQ100 results include outside bars such as ADSK, CDW, CHTR, COST, CSX.. etc)… Then if I add the last criteria:  and BARTYPES(Day(PERIODAMOUNT=1), DEFAULT=Outside); I have:  unknown Function: offset Bartypesdefault= Inside1 … so I don’t get the expected result…

    Thanks and best regards

    Marc

    #65095
    Darren
    • Topics: 66
    • Replies: 633
    • Posts: 699

    Hi Marc,

    Don’t put ; between the ‘and’ conditions and the scans will work without the unknown function error.

    #65097
    Marc
    • Topics: 10
    • Replies: 22
    • Posts: 32

    Hi Darren,

    Pls kindly let me know what is wrong with this formula. I am looking for a higher high or higher low candle(2)+ an inside candle (1) + a higher high (2)
    v1=BARTYPES(Day(PERIODAMOUNT=1), DEFAULT=Lower)[2];
    v2=BARTYPES(Day(PERIODAMOUNT=1), DEFAULT=Higher)[2];
    v3=BARTYPES(DEFAULT=Inside)[1];
    v4=BARTYPES(Day(PERIODAMOUNT=1), DEFAULT=Higher);

    v1 or v2
    and v3 and v4

    I don’t get the inside candle with this formula even though it can come up as a  “true” in the table, it is not on the chart.

    Thanks and best regards
    Marc

    #65115
    Darren
    • Topics: 66
    • Replies: 633
    • Posts: 699

    Hi Marc,

    I put (v1 or v2) in parentheses and I got the expected results. Also, I assume you are applying to a daily watchlist / chart? If so there’s no need to specify the timeframe in the script.

    If you change the colour scheme to Swing Relations then the inside bars will show as black, as per this example for XOM which returned a true result (as of Friday’s data). If you still have issues send your watchlist to support and we’ll take a look.

    Capture

    1 user thanked author for this post.
    #65181
    Marc
    • Topics: 10
    • Replies: 22
    • Posts: 32

    Hi Darren,

    I’d like to have an indication of  the bar type in my watchlist: 1 if inside bar, “2up” if Higher bar, “2dw” if lower bar, 3 if outside bar.

    I am going nowhere with my formula… Can you pls show me how to write it?

    Thanks and best regards

    Marc

    #65199
    Darren
    • Topics: 66
    • Replies: 633
    • Posts: 699

    Hi Marc,

    You would need a combination of IF statements and conditional column labels in the watchlist. This is a bit beyond basic scripting support so if you would like to arrange a paid scripting consultation send a note to support.

    However, the concept of IF statement and values are the same as in this example which shows the direction of the RRG in a watchlist. Replace the Heading values with BartTypes():

    https://forum.optuma.com/topic/scripts-for-relative-rotation-graphs-rrgs/#post-64301

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

Pin It on Pinterest