Smoothed Bollinger% Strategy Daily_Topic

Viewing 15 posts - 31 through 45 (of 92 total)
  • Author
    Posts
  • #61410 quote
    ALEALE
    Moderator
    Master

    Hi Nicolas,

    I think that problem could be derivates from code structure. May be trailing stop or something else

    #61411 quote
    T-raderT-rader
    Participant
    Average

    The code was started this week so yeah it´s the first time.

    I´ve had the same problem with other codes on daily which affects the over all performance of the code alot and it has ended with me scrapping the code.

    #61467 quote
    NicolasNicolas
    Keymaster
    Legend

    I don’t see anything in the code that lead me thinking it’s related.. why do you think so? Are you talking about the rejected orders limit reached?

    #61470 quote
    ALEALE
    Moderator
    Master

    It happens on daily time frame on saturday, also on cac and dax without reasons

    #61473 quote
    ALEALE
    Moderator
    Master

    Also happens that at 00.02 of sunday morning
    the stop is removed, and reappears at the next candle in monday morning at 01.00

    #61500 quote
    T-raderT-rader
    Participant
    Average

    I´m not sure why it´s happening. I´ve gone through the code many times now and can´t find anything that differates from lets say an 1 hour code that isn´t stopping it self.

    My highly non certain conclusion is that it has something to do with IGs pricing.

    Mon-Thurs = 1 candle – 24 hours, Fri=1 caandle – 22 hours. I think that´s messing up the code since it can´t read the price when it thinks it should be able to and thats why there´s an error and prt trying to quit the code.

     

    Now my position has closed and I have (as you can see in the picture below) three rejected orders that says=

    First rejection = This market is now closed

    Second rejection = Sorry, we have been unable to confirm the status of your trading request. Please call us on …..

    Third Redjection= Price is no longer available

    ALE thanked this post
    Rejected-orders.png Rejected-orders.png
    #61540 quote
    T-raderT-rader
    Participant
    Average

    Ok, now I´m going to dubbelpost again… But I really like this code so I want it to work 🙂
    With my limited coding skills this is the only thing I can think of changing (code). No new position on fridays and closes open positions on friday opening.

    //--------------------------------------------------------------------------------------------------
    //days
    notfd =  opendayofweek = 1 or opendayofweek = 2 or opendayofweek = 3
    // STRATEGY
    //--------------------------------------------------------------------------------------------------
    
    IF NOT LongOnMarket AND avgFilterEnterLong AND SvEFilterEnterLong and notfd THEN
    BUY 1 CONTRACT AT MARKET
    ENDIF
    
    
    IF NOT ShortOnMarket AND avgFilterEnterShort AND SveFilterEnterShort and notfd THEN
    SELLSHORT 1 CONTRACT AT MARKET
    ENDIF
    
     
    IF  POSITIONPERF<0 THEN
    IF LongOnMarket AND BARINDEX-TRADEINDEX(1)>= barLong THEN
    SELL AT MARKET
    ENDIF
    ENDIF
    
    IF POSITIONPERF<0 THEN
    IF shortOnMarket AND BARINDEX-TRADEINDEX(1)>= barshort  THEN
    EXITSHORT AT MARKET
    ENDIF
    ENDIF
    
    
    if opendayofweek = 4 and openhour = 21 
    sig=1
    else
    sig=0
    endif
    IF sig=1 THEN
    SELL AT MARKET
    EXITSHORT AT MARKET
    ENDIF
    #61543 quote
    ALEALE
    Moderator
    Master

    @t-rader,

    have you already had this strategy open of Friday? It could be a case that is not rarely verified.
    I have other strategies with the same code on the indexes and this it happens only rarely me on the European indexes. But I never work on forex.

    #61546 quote
    T-raderT-rader
    Participant
    Average

    I had it this friday. Maybe it wont happen again or it will, I dont know but its pretty annoying if it closing a loosing trade that would have been a winner if it was hold over the weekend.

    Personally I´m fine with this addition to the code since I don´t like to have FX positions open during NFP, I like trend more than volatility.

    When I have experineced this problem in the past it has always been on OMX (Sweden 30).

    #61550 quote
    ALEALE
    Moderator
    Master

    To avoid volatily days please consider it:

    once countFridays = 0
     
    firstDayOfMonth = (day = 1)
    isFriday  = (dayOfWeek = 5)
    firstWeek = (day < 8)
     
    if firstDayOfMonth then
    countFridays = 0
    endif
    if isFriday and (not isFriday[1]) then
    countFridays = countFridays + 1
    endif
     
     
    // Non Farm Payrolls
    nfpDay    = isFriday and firstWeek
     
    // Triple Witching
    isMarch = (Month = 3)
    isJune = (Month = 6)
    isSept = (Month = 9)
    isDec  = (Month = 12)
    tripleWitchingMonth = isMarch or isJune or isSept or isDec
    thirdFriday = isFriday and countFridays = 3
    tripleWitching = thirdFriday and tripleWitchingMonth
    //////////////////////////////////////////////////////////
    IF nfpday or tripleWitching then
    sell at market
    exitshort at market
    endif
    
    #61552 quote
    ALEALE
    Moderator
    Master
    once countFridays = 0
     
    firstDayOfMonth = (day = 1)
    isFriday  = (dayOfWeek = 5)
    firstWeek = (day < 8)
     
    if firstDayOfMonth then
    countFridays = 0
    endif
    if isFriday and (not isFriday[1]) then
    countFridays = countFridays + 1
    endif
     
     
    // Non Farm Payrolls
    nfpDay    = isFriday and firstWeek
     
    // Triple Witching
    isMarch = (Month = 3)
    isJune = (Month = 6)
    isSept = (Month = 9)
    isDec  = (Month = 12)
    tripleWitchingMonth = isMarch or isJune or isSept or isDec
    thirdFriday = isFriday and countFridays = 3
    tripleWitching = thirdFriday and tripleWitchingMonth
    //////////////////////////////////////////////////////////
    return tripleWitching COLOURED (200,0,0) STYLE(HISTOGRAM) AS "WHICH" ,nfpDay COLOURED (100,0,0) STYLE(HISTOGRAM)AS "NFP"
    TempusFugit thanked this post
    #61576 quote
    T-raderT-rader
    Participant
    Average

    Thanks. That´s a good snippet of code for my other strategys but it dosen´t solve the friday stopping problem.

    #61582 quote
    ALEALE
    Moderator
    Master

    Yes of course but i don’t understand how your code could resolve this problem

    #61695 quote
    T-raderT-rader
    Participant
    Average

    Cause if there´s an open position my code closes it on friday opening 🙂
    And it dosent take any trades on friday either.

    Skärmklipp22.png Skärmklipp22.png
    #61699 quote
    ALEALE
    Moderator
    Master
    //-----------------------------------------------------------------------------------------------
    //days
    notfd =  opendayofweek = 1 or opendayofweek = 2 or opendayofweek = 3
    // STRATEGY
    //--------------------------------------------------------------------------------------------------
     
    IF NOT LongOnMarket AND avgFilterEnterLong AND SvEFilterEnterLong and notfd THEN
    BUY 1 CONTRACT AT MARKET
    ENDIF
     
     
    IF NOT ShortOnMarket AND avgFilterEnterShort AND SveFilterEnterShort and notfd THEN
    SELLSHORT 1 CONTRACT AT MARKET
    ENDIF
     
     
    IF  POSITIONPERF<0 THEN
    IF LongOnMarket AND BARINDEX-TRADEINDEX(1)>= barLong THEN
    SELL AT MARKET
    ENDIF
    ENDIF
     
    IF POSITIONPERF<0 THEN
    IF shortOnMarket AND BARINDEX-TRADEINDEX(1)>= barshort  THEN
    EXITSHORT AT MARKET
    ENDIF
    ENDIF
     
     
    if opendayofweek = 4 and openhour = 21 THEN
    IF POSITIONPERF>0 THEN
    SELL AT MARKET
    EXITSHORT AT MARKET
    ENDIF
    ENDIF

    YOU CAN CONSIDER TO TEST IF IT’S BETTER TO CLOSE IT IF POSITION IT’S IN PROFIT OR NOT

Viewing 15 posts - 31 through 45 (of 92 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

Smoothed Bollinger% Strategy Daily_Topic


ProOrder: Automated Strategies & Backtesting

New Reply
Author
author-avatar
ALE @aleale Moderator
Summary

This topic contains 91 replies,
has 15 voices, and was last updated by robertogozzirobertogozzi
5 years, 8 months ago.

Topic Details
Forum: ProOrder: Automated Strategies & Backtesting
Language: English
Started: 01/07/2018
Status: Active
Attachments: 22 files
ProRealCode ProRealCode
Loading...