Buy order after two conditions from 2 time frames

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #176523 quote
    assafnassafn
    Participant
    Average

    Hello,

    I’m having trouble writing a code with conditions from 2 TF.

    1. Weekly rsi[9] crosses under 30

    and then wait for:

    2. Daily rsi[14] crosses under 20.

    Is that possible?

    #176529 quote
    robertogozzirobertogozzi
    Moderator
    Legend

    There you go:

    timeframe(Weekly,UpdateOnClose)
    Wrsi = rsi[9]
    c1 = Wrsi crosses under 30
    Timeframe(Daily,UpdateOnClose)
    Drsi = rsi[14]
    c2 = Drsi crosses under 20
    Timeframe(Default)
    Cond = c1 AND c2
    IF Cond THEN
       buy at market
       set stop   ploss   200
       set target pprofit 400
    ENDIF
    #176531 quote
    robertogozzirobertogozzi
    Moderator
    Legend

    At lines 1 and 4 you can replace UpdateOnClose with Default, not to wait the closing of the candle before updating variables.

    assafn thanked this post
    #176535 quote
    assafnassafn
    Participant
    Average

    Thank you robertogozzi

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

Buy order after two conditions from 2 time frames


ProOrder: Automated Strategies & Backtesting

New Reply
Author
author-avatar
assafn @assafn Participant
Summary

This topic contains 3 replies,
has 2 voices, and was last updated by assafnassafn
5 years, 1 month ago.

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