Move to BE on Confirmation of Market Structure

Viewing 5 posts - 16 through 20 (of 20 total)
  • Author
    Posts
  • #137646 quote
    Steveaw
    Participant
    Average

    Ah ok I guess it doesn’t matter which but let me take a look at them using gold spot/USD is that ok?

    Probably change the entry onto a higher timeframe as well just to get into a trade.

    Quick question though (and you have probably realised by now that I’m a coding numpty!) how does the code know what SigHI1 is and how does this increase(lines 51 & 54 in my code version above)?

    Also on line 51 where SigHI > 0 would I be able to to substitute 0 for a higher integer value say 20 to represent 20 pips in profit or is it just a 1-0 true – false statement?

    Forgive me for my lack of understanding!

    Steve

    #137683 quote
    robertogozzi
    Moderator
    Master

    Don’t worry, newbie ISN’T numpty!  (the same as Expert ISN’T smart!)

    GraHal ‘s motto is “Ask a question, you may be a fool for a day. Don’t ask a question, you may be a fool for life!? ” and I subscribe to it!

    that 0 is just a logical statement (true-false), 0=FALSE whichever value other than 0 is true.

    But… what proves GraHal is right is just in your lines 51-54. Checking them I just realized a made a HUGE mistake in my first post, where I used logical values to compare higher and lower swing points.

    Thanks for spotting that Steveaw.

    This is the correct (?!) version of my first post:

    ONCE SwingHI1 = 0
    ONCE SwingHI  = 0
    ONCE SwingLO1 = 0
    ONCE SwingLO  = 0
    ONCE LookBack = 10
    IF Not OnMarket Then
       MySL  = 0
    ENDIF
    MaxHI    = max(open,close)
    MinLO    = min(open,close)
    Bullish  = close > open
    Bearish  = close < open
    SwingHI  = highest[LookBack](MaxHI)
    SwingLO  = lowest[LookBack](MinLO)
    SigHI    = SwingHI AND Bearish AND Bullish[1]
    SigLO    = SwingLO AND Bullish AND Bearish[1]
    IF LongOnMarket AND SigHI > 0 AND SwingHI > SwingHI1 THEN
       SwingHI1 = SwingHI
       IF SwingHI1 > SwingLO1 THEN
          MySL = max(TradePrice,max(MySL,SwingLO1))
       ENDIF
    ELSIF ShortOnMarket AND SigLO > 0 AND SwingLO < SwingLO1 THEN
       SwingLO1 = SwingLO
       IF SwingLO1 < SwingHI1 THEN
          MySL = min(TradePrice,min(MySL,SwingHI1))
       ENDIF
    ENDIF
    IF OnMarket AND MySL <> 0 THEN
       SELL      AT MySL Stop
       EXITSHORT AT MySL Stop
    ENDIF

    I’m so sorry you will have to change your strategy again!

    GraHal thanked this post
    #137704 quote
    Steveaw
    Participant
    Average

    Hi Roberto

    I’ve attached a XAU/USD on 5 min entry  & 1 Hr exit for the code.

    settings are:

    Set Point for Entry 1751 long

    SL – 10

    TP – 20

    Steve

    Screenshot-2020-06-30-at-13.44.32.png Screenshot-2020-06-30-at-13.44.32.png
    #137751 quote
    robertogozzi
    Moderator
    Master

    Please post your last used code.

    #138322 quote
    Steveaw
    Participant
    Average
    // Hi Roberto - I've attached the code and another screenshot on XAU/USD
    //Steve
    
    // Solution from PRC For Finding a BOS5
    
    //TAKE PROFITS AT BREAK OF MARKET STRUCTURE Test 3
    //-------------------------------------------------------------------------
    // Definition of code parameters
    DEFPARAM CumulateOrders = False // Cumulating positions deactivated
    daysForbiddenEntry = OpenDayOfWeek = 6 OR OpenDayOfWeek = 0
    if onmarket or strategyprofit<>strategyprofit[1] then
    flag = 1
    endif
     
    if dayofweek <> dayofweek[1] then
    flag = 0
    endif
     
    entry=1751
     
    SET STOP pLOSS sl
    SET TARGET pPROFIT tp
    sl=10
    tp=50
    // Conditions to enter long position
    notradetime1=213000
    notradetime2=233000
    notradetime=time>notradetime1 and time<notradetime2
     
    timeframe (60 minute, updateonclose)
     
    c1=low<=entry
    timeframe(default, updateonclose)
    IF not daysForbiddenEntry and not flag and not onmarket and not notradetime and c1 Then
    Buy 1 perpoint AT MARKET
    ENDIF
     
    // from PRC
    timeframe (60 minutes, updateonclose)
    ONCE SigHI1   = 0
    //ONCE SigHI2   = 0
    ONCE SigLO1   = 0
    //ONCE SigLO2   = 0
    ONCE LookBack = 5
    IF Not OnMarket Then
    MySL  = 0
    ENDIF
    MaxHI    = max(open,close)
    MinLO    = min(open,close)
    Bullish  = close > open
    Bearish  = close < open
    SwingHI  = highest[LookBack](MaxHI)
    SwingLO  = lowest[LookBack](MinLO)
    SigHI    = SwingHI AND Bearish AND Bullish[1]
    SigLO    = SwingLO AND Bullish AND Bearish[1]
    IF LongOnMarket AND SigHI > 0 AND SigHI > SigHI1 THEN
    //SigHI2 = SigHI1
    SigHI1 = SigHI
    IF SigHI1 > SigLO1 THEN
    MySL = max(TradePrice,max(MySL,SigLO1))
    ENDIF
    ELSIF ShortOnMarket AND SigLO > 0 AND SigLO < SigLO1 THEN
    //SigLO2 = SigLO1
    SigLO1 = SigLO
    IF SigLO1 < SigHI1 THEN
    MySL = min(TradePrice,min(MySL,SigLO1))
    ENDIF
    ENDIF
    IF OnMarket AND MySL <> 0 THEN
    SELL      AT MySL Stop
    EXITSHORT AT MySL Stop
    ENDIF
    Screenshot-2020-07-03-at-17.20.22.png Screenshot-2020-07-03-at-17.20.22.png
Viewing 5 posts - 16 through 20 (of 20 total)
  • You must be logged in to reply to this topic.

Move to BE on Confirmation of Market Structure


ProOrder: Automated Strategies & Backtesting

New Reply
Author
author-avatar
Steveaw @steveaw Participant
Summary

This topic contains 19 replies,
has 4 voices, and was last updated by Steveaw
5 years, 7 months ago.

Topic Details
Forum: ProOrder: Automated Strategies & Backtesting
Language: English
Started: 06/27/2020
Status: Active
Attachments: 6 files
Logo Logo
Loading...