I want to find if condition has been met in the last few bars

Viewing 11 posts - 1 through 11 (of 11 total)
  • Author
    Posts
  • #181610 quote
    pdrh
    Participant
    Average

    I want to find if a condition has been met in the last few bars .

    Is there something similar to Lowest[N](close ) or could somebody give a code to do this .

    #181613 quote
    paisantrader
    Participant
    Senior

    a = summation[5](close > close[1])

    “a” will contain how many times the condition “close > close[1]” was met within the last 5 bars

    Nicolas and pdrh thanked this post
    #181618 quote
    Nicolas
    Keymaster
    Master
    #181625 quote
    pdrh
    Participant
    Average

    what I am wanting to find whether an as yet undefined condition has been met in the last few bars.

    #181627 quote
    nonetheless
    Participant
    Master

    you mean like, have any unicorns been discovered within last 5 bars?

    you have to tell the summation what to look for (unless i have completely misunderstood ???)

    pdrh thanked this post
    #181662 quote
    pdrh
    Participant
    Average

    So would i write

    a=summation[5](unicorns)

    #181664 quote
    nonetheless
    Participant
    Master

    You got it. Easy peasy.

    Let us know the result.

    pdrh thanked this post
    #181678 quote
    JS
    Participant
    Senior
    #181709 quote
    pdrh
    Participant
    Average

    I wanted to find when the price is rejected at a resistance level more than once and this gave a result

    a=supertrend[3,10]
    b=a-close
    ind=0
    If b<2.5 AND b>0 Then
    ind=1
    Endif
    d=summation[7](ind)
    Return d

    #181717 quote
    Nicolas
    Keymaster
    Master

    You should now use that new instruction: BARSSINCE ! Enjoy.

    #181725 quote
    PeterSt
    Participant
    Master

    Nice !

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

I want to find if condition has been met in the last few bars


ProOrder: Automated Strategies & Backtesting

New Reply
Author
author-avatar
pdrh @pdrh Participant
Summary

This topic contains 10 replies,
has 6 voices, and was last updated by PeterSt
4 years, 3 months ago.

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