Delay before enter market

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #80302 quote
    Abz
    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
    robertogozzi
    Moderator
    Master

    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
    Abz
    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
    Vonasi
    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
    Abz
    Participant
    Veteran

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

    #80337 quote
    Vonasi
    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.

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 Vonasi
7 years, 5 months ago.

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