Coding something happening in the last 5 periods

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #40045 quote
    Juan SalasJuan Salas
    Participant
    Master

    Hi everyone,

    Is it possible to code something happening in the last 5 periods???

    Example:

    IF MM6 Crosses over MM5 (in any of the last 5 candles)  AND close>MM6 THEN

    I am trying to BUY when two or more conditions occur, but in some cases all of them happen within the last 3-5 candles.

    Thanks in advance,

    Juan

    #40046 quote
    DespairDespair
    Blocked
    Master
    if condition1 then
     signalindex=intradaybarindex
    endif
    if condition2 and intradaybarindex-signalindex<=5 then
     buy 1 contract at market
    endif

    This should do it.

    #40059 quote
    Juan SalasJuan Salas
    Participant
    Master

    Despair,

    Thanks so much for your help. It works the way you said.

    I am learning a lot from these contributions.

    Regards,

    Juan

    #40087 quote
    robertogozzirobertogozzi
    Moderator
    Legend

    You may try this one:

    .
    .
    .
    IF summation[5]((Average[6] CROSSES OVER Average[5]) AND (close > Average[6])) > 0 THEN
    .
    .
    .
    ENDIF
    .
    .
    .

    Roberto

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

Coding something happening in the last 5 periods


ProOrder: Automated Strategies & Backtesting

New Reply
Author
author-avatar
Juan Salas @juan-salas Participant
Summary

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

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