x bars in a row code

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #149953 quote
    ullle73
    Participant
    Senior

    Hi,

    Could anyone help out coding following:

    • timeframe 4h. When 6 bars in a row have closed lower (6 red bars in a row)
    • timeframe 5 min, when 2 bars in a row have closed higher (2 green bars in a row) Buy 1 contract
    #149956 quote
    robertogozzi
    Moderator
    Master

    There you go:

    Defparam CumulateOrders = false
    Timeframe(4 hour,UpdateOnClose)
    Bearish = close < open
    c1 = (summation[6]((close < close[1]) AND Bearish) = 6)
    Timeframe(5 minute,UpdateOnClose)
    Bullish = close > open
    c2 = (summation[2]((close > close[1]) AND Bullish) = 2)
    Timeframe(default)
    If c1 AND c2 AND Not OnMarket THEN
       Buy 1 contract at Market
    ENDIF
    ullle73 thanked this post
Viewing 2 posts - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.

x bars in a row code


ProOrder: Automated Strategies & Backtesting

New Reply
Author
author-avatar
ullle73 @jonas_rydqvist Participant
Summary

This topic contains 1 reply,
has 2 voices, and was last updated by robertogozzi
5 years, 3 months ago.

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