gbp/jpy profitable strategy help

Viewing 9 posts - 1 through 9 (of 9 total)
  • Author
    Posts
  • #149895 quote
    abro163
    Participant
    Average

    Hi I tried to code this strategy https://www.youtube.com/watch?v=PaVIbaTRO7o

    I seem to have succesfully done that, but the profit factor is not as good as he claims.  It is a “stop and reverse” type strategy

    One thing I noticed was that if the profit target was hit, the strategy reenters the position – How can I stop it entering when the stop or profit target is hit. (you can see on 18mar 2020)

    I tried to play around with a tradecount below, but not sure. Went into an infinite loop or missed the next trade on 19mar 2020

    Set chart to newyork time !

    // code-parameter
    DEFPARAM CumulateOrders = false
    // window high/low calculation
    ONCE StartTime = 000000   
    ONCE EndTime = 040000    
    
    // trading window
    ONCE BuyTime = 040000   
    ONCE SellTime = 150000  
    
    sl = 150
    tp = 470
    
    // calculate high/low and sl/tp
    IF Time >= StartTime AND Time <= EndTime THEN
    IF TIME = StartTime THEN
    DailyHigh = High
    DailyLow = Low
    ENDIF
    IF High > DailyHigh THEN
    DailyHigh = High
    ENDIF
    IF Low < DailyLow THEN
    DailyLow = Low
    ENDIF
    
    
    TradeCounterLong = 0
    TradeCounterShort = 0
    
    ENDIF
    
    // position management
    IF Time >= BuyTime AND Time <= SellTime  then//and tradecounterlong <=1 THEN
    
    buy 1 contract at dailyhigh stop
    TradeCounterLong = TradeCounterLong + 1
    SET STOP pLOSS sl
    set target pprofit tp
    
    ENDIF
    
    IF Time >= BuyTime AND Time <= SellTime  then //and TradeCounterShort <=1 THEN
    
    sellshort 1 contract at dailylow stop
    TradeCounterShort = TradeCounterShort + 1
    SET STOP pLOSS sl
    set target pprofit tp
    
    ENDIF
    
    #149898 quote
    robertogozzi
    Moderator
    Master

    Add this at line 6:

    ONCE TradeON = 1

    add this at lines 40 and 49:

    TradeON = 0

    add this at line 13:

    If IntraDayBarIndex = 0 THEN
       TradeON = 1
    ENDIF

    then add this condition at lines 34 and 43:

    AND TradeON = 1
    #149980 quote
    abro163
    Participant
    Average

    Thanks Roberto,  I tried your code but it made the system trade only once per day.   It is stop and reverse so can trade twice

    I want it not to trade  after the stop or profit target gets hit for the remaining time in the day,

    I tried to make it like your example with two variables – tradeonShort and tradeonLong ,

    So only one long trade and one short per day is taken, which should work,   but didn’t seem to work.

    #149997 quote
    abro163
    Participant
    Average

    Probably because it was carrying positions from overnight, i need to do something like if longonmarket, dont open new buy trades until next day.

    #150022 quote
    robertogozzi
    Moderator
    Master

    This should do, it only allows one LONG and one SHORT trade per day:

    // code-parameter
    DEFPARAM CumulateOrders = false
    // window high/low calculation
    ONCE StartTime = 000000
    ONCE EndTime   = 040000
     
    // trading window
    ONCE BuyTime  = 040000
    ONCE SellTime = 150000
     
    ONCE TradeLONG  = 0
    ONCE TradeSHORT = 0
    
    IF IntraDayBarIndex = 0 THEN
    TradeLONG  = 0
    TradeSHORT = 0
    ENDIF
    
    sl = 150
    tp = 470
     
    // calculate high/low and sl/tp
    IF Time >= StartTime AND Time <= EndTime THEN
    IF TIME = StartTime THEN
    DailyHigh = High
    DailyLow = Low
    ENDIF
    IF High > DailyHigh THEN
    DailyHigh = High
    ENDIF
    IF Low < DailyLow THEN
    DailyLow = Low
    ENDIF
     
     
    TradeCounterLong = 0
    TradeCounterShort = 0
     
    ENDIF
     
    // position management
    IF Time >= BuyTime AND Time <= SellTime  and not LongOnMarket and TradeLONG = 0 then//and tradecounterlong <=1 THEN
    
    buy 1 contract at dailyhigh stop
    TradeCounterLong = TradeCounterLong + 1
    SET STOP pLOSS sl
    set target pprofit tp
    TradeLONG = 1
    ENDIF
     
    IF Time >= BuyTime AND Time <= SellTime  and not ShortOnMarket and TradeSHORT = 0 then //and TradeCounterShort <=1 THEN
     
    sellshort 1 contract at dailylow stop
    TradeCounterShort = TradeCounterShort + 1
    SET STOP pLOSS sl
    set target pprofit tp
    TradeSHORT = 1
    ENDIF
    #150274 quote
    abro163
    Participant
    Average

    Thanks, that didn’t really work either,

    I got it

    // Open Range Breakout DAX 5/15M
    
    // code-parameter
    DEFPARAM CumulateOrders = false
    // window high/low calculation
     
    
    ONCE StartTime = 000000   //000000
    ONCE EndTime = 040000     //040000
    
    // trading window
    ONCE BuyTime = 040000   //040000
    ONCE SellTime = 150000  //150000
    
    sl = 150
    tp = 470
    
    // calculate high/low and sl/tp
    IF Time >= StartTime AND Time <= EndTime THEN
    IF TIME = StartTime THEN
    DailyHigh = High
    DailyLow = Low
    ENDIF
    IF High > DailyHigh THEN
    DailyHigh = High
    ENDIF
    IF Low < DailyLow THEN
    DailyLow = Low
    ENDIF
    
    
    tradeCounterLong = 0
    TradeCounterShort = 0
    
    ENDIF
    
    // position management
    IF Time >= BuyTime AND Time <= SellTime and tradecounterlong <=2 and close>close[1]   then   //and tradecounterlong <=1
    // Long and currentdayofweek <5 and DClose(0)>DClose(1)
    
    
    
    buy 1 contract at dailyhigh stop
    TradeCounterLong = TradeCounterLong + 1
    SET STOP pLOSS sl
    set target pprofit tp
    
    
    ENDIF
    
    IF Time >= BuyTime AND Time <= SellTime and tradecountershort <=2 and close<close[1]  then
    // Long and currentdayofweek <5 and DClose(0)>DClose(1) and tradecountershort <=1
    sellshort 1 contract at dailylow stop
    TradeCounterShort = TradeCounterShort + 1
    SET STOP pLOSS sl
    set target pprofit tp
    
    
    ENDIF
    

    also another version that enters only if closes below the initial 4hr range

    (this one the timeframe will affect performance)

    // Open Range Breakout DAX 5/15M
    
    // code-parameter
    DEFPARAM CumulateOrders = false
    // window high/low calculation
     
    
    
    ONCE EndTime = 040000     //040000
    
    // trading window
    ONCE BuyTime = 040000   //040000
    ONCE SellTime = 150000  //150000
    
    sl = 150
    tp = 470
    
    // calculate high/low and sl/tp
    IF Time = EndTime THEN
    
    DailyHigh = highest[4](high)
    DailyLow = lowest[4](low)
    
    
    
    tradeCounterLong = 0
    TradeCounterShort = 0
    
    ENDIF
    
    // position management
    IF Time >= BuyTime AND Time <= SellTime and tradecounterlong <=1 and close> dailyhigh  then   //and tradecounterlong <=1
    // Long and currentdayofweek <5 and DClose(0)>DClose(1)
    
    
    
    buy 1 contract at market
    TradeCounterLong = TradeCounterLong + 1
    SET STOP pLOSS sl
    set target pprofit tp
    
    
    ENDIF
    
    IF Time >= BuyTime AND Time <= SellTime and tradecountershort <=1 and close<dailylow  then
    // Long and currentdayofweek <5 and DClose(0)>DClose(1) and tradecountershort <=1
    sellshort 1 contract at market
    TradeCounterShort = TradeCounterShort + 1
    SET STOP pLOSS sl
    set target pprofit tp
    
    
    ENDIF
    
    #150275 quote
    abro163
    Participant
    Average

    If you use 1hr chart set

    DailyHigh = highest[4](high)
    DailyLow = lowest[4](low)
    15min

    DailyHigh = highest[16](high)
    DailyLow = lowest[16](low)
    is best
    #150282 quote
    abro163
    Participant
    Average

    and close>close[1] can be taken out on the first system, was just testing

    #150283 quote
    abro163
    Participant
    Average

    Also try chicago or new york time different results (or just change code 1hr different) chicago seems better

Viewing 9 posts - 1 through 9 (of 9 total)
  • You must be logged in to reply to this topic.

gbp/jpy profitable strategy help


ProOrder: Automated Strategies & Backtesting

New Reply
Author
author-avatar
abro163 @abro163 Participant
Summary

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

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