Delay before enter market

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #80302 quote
    AbzAbz
    Participant
    Veteran

    Hello

     

    anyone that can help with a code for delaying before enter the market. If all conditions meet then delay x candles before entering the market.

    #80304 quote
    robertogozzirobertogozzi
    Moderator
    Legend

    Save BARINDEX when all conditions are met and start counting each bar while conditions are still valid.

    After the number of bars you like let the code enter a trade.

    #80312 quote
    AbzAbz
    Participant
    Veteran

    Hello

    Do you have any examples on the code below?

     

    IF not onmarket AND c1 AND c2 AND c3 AND c4 AND c5  THEN
    Buy pos AT MARKET
    ENDIF
    #80322 quote
    VonasiVonasi
    Moderator
    Master

    Do you need the conditions to be met and then just wait a certain number of bars or do you need the conditions to be met and then met again at each bar for a certain number of bars?

    #80330 quote
    AbzAbz
    Participant
    Veteran

    just need the conditions to be met once and then wait certain amount of bars.

    #80337 quote
    VonasiVonasi
    Moderator
    Master
    BarsToWait = 6
    pos = 1
    
    IF not onmarket and c1 and c2 and c3 and c4 and c5 then
    flag = 1
    startindex = barindex
    ENDIF
    
    if flag and (barindex - startindex) = BarsToWait
    Buy pos at market
    Flag = 0
    endif

    Not tested.

    Abz and Allan- thanked this post
Viewing 6 posts - 1 through 6 (of 6 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

Delay before enter market


ProOrder: Automated Strategies & Backtesting

New Reply
Author
author-avatar
Abz @abbas_sadiq Participant
Summary

This topic contains 5 replies,
has 3 voices, and was last updated by VonasiVonasi
8 years ago.

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