Checking if a Condition has occurred within N Periods

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #154359 quote
    CapnCrunch77CapnCrunch77
    Participant
    Junior

    Hello All,

    I’m trying to write a programme line entry whereby I want to execute a trade if a condition has been fulfilled with the last N periods (for example; if a cross of price over 100 MA line has occurred within X number of time frames).  Anyone able to provide guidane on how this condition can be expressed?

    Thanks!

    #154363 quote
    robertogozzirobertogozzi
    Moderator
    Legend

    There you go:

    x = summation[10](condition)
    If x Then
     .
     .
    Endif
    CapnCrunch77 thanked this post
    #154371 quote
    CapnCrunch77CapnCrunch77
    Participant
    Junior

    Awesome, thanks Roberto!!!

    Follow up question, do you know how I could make this work with TIMEFRAME?  say for instance, I want to check this in a 10min chart and my default where I am running the programme is 5 min (i.e. I want the programme to trade only if condition X has een validated in 10min timeframe).

    #154374 quote
    robertogozzirobertogozzi
    Moderator
    Legend

    You can use it as many times as needed, provided you name variabls differently among TF’s:

    Timeframe(10 minute,UpdateOnClose)
    x10 = summation[10](10-minute-condition)
    If x10 Then
     .
     .
    Endif
    Timeframe(default)
    xD = summation[10](default-TF-condition)
    If xD Then                               //or If xD AND x10 Then
     .
     .
    Endif
    Kovit thanked this post
Viewing 4 posts - 1 through 4 (of 4 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

Checking if a Condition has occurred within N Periods


ProOrder: Automated Strategies & Backtesting

New Reply
Author
Summary

This topic contains 3 replies,
has 2 voices, and was last updated by robertogozzirobertogozzi
5 years, 9 months ago.

Topic Details
Forum: ProOrder: Automated Strategies & Backtesting
Language: English
Started: 12/18/2020
Status: Active
Attachments: No files
ProRealCode ProRealCode
Loading...