Coding something happening in the last 5 periods

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #40045 quote
    Juan 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
    Despair
    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 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
    robertogozzi
    Moderator
    Master

    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.

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 robertogozzi
8 years, 8 months ago.

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