Breakout Brent crudeoil "copy paste/adjusted"

Viewing 15 posts - 1 through 15 (of 90 total)
  • Author
    Posts
  • #18218 quote
    Kenneth Kvistad
    Participant
    Senior

    Here is a strategy copyed from here and adjusted for the brentcrude oil E1 5 min chart.

    Any sugestions or coments are welcome.

    Have not started it live  since I whant to test it in V.10.3 PRT for IG users:)

    Breakout-5-min-pic.png Breakout-5-min-pic.png Breakout-5min-BrentCrude-E1-1.itf
    #18227 quote
    reb
    Participant
    Master

    Hi Kenneth

    I uploaded the itf file then launched the strategy in 5 min on the LCO Crude Brent

    I don’t have the same results as you, did I do something wrong ?

     

    Reb

    temp.jpg temp.jpg
    #18230 quote
    reb
    Participant
    Master

    I checked a bit the code and I see some differences between the comments and the code :

    // The position is closed at 9:45 p.m., local market time (France).
    DEFPARAM FlatAfter = 225500
    // No new position is taken after the candlestick that closes 5:15 p.m.
    LimitEntryTime = 154500//154500
    // The market analysis strats at the 15-minute candlestick which closes at 9:30 a.m.
    StartTime = 151500

     

    As french I have the time zone as you, why did did you mention 214500as comment and 225500 in your code ?

    Could it be the reason of the big difference in term of results ?

    #18234 quote
    Nicolas
    Keymaster
    Master

    Didn’t test it myself,  but check out spread maybe..

    #18235 quote
    reb
    Participant
    Master

    I use a spread of 3 like IG does

    #18265 quote
    Kenneth Kvistad
    Participant
    Senior

    Hi.

     

    I dont kow why results are different. Is probably somtheing with the timeframe to do.

    I use 5 min chart 100 000units witch is max history for me.

    Spread is 3.

    STrategy starts 1515 and can not trade after 1545. (Norway local time)  this has to be adjusted to your time Reb. Were are you from?

    Position can be open to 21.45 or later, you can choose.

    It also has Nicolas mef stop code witch I know works good in live trading(no bugs)

    #18341 quote
    reb
    Participant
    Master

    hi Kenneth

    As french, I think we have the same time zone

    #18342 quote
    Kenneth Kvistad
    Participant
    Senior

    Then I am sorry and dont.know why its a diffrence. I use mini brent crude e1 lco. I WILL check out the itf. File with a friends acc. Later and see if its same for him.

    #18351 quote
    Nicolas
    Keymaster
    Master

    Get the same results as Kenneth has. Picture attached.

    brent-oil-trading-strategy.png brent-oil-trading-strategy.png
    #18354 quote
    reb
    Participant
    Master

    ok

    I don’t understand, I tested this strat on PRT complete and PRT premium

    I have the same results as I posted

    Where is the issue ?

    LCO 5min, spread 3, no modification on the code (pnly uploaded)

    #18357 quote
    Alco
    Participant
    Senior

    Hi reb,

    I also had a different result on default settings.

    Try this code. I changed time and it did work for me.
    Let me know if it changed for you.

    Alco

    // We don't load data before the start of the system.
    // As a result, if the system is started in the afternoon,
    // it will wait until the next day before placing any orders.
    DEFPARAM PreLoadBars = 0
    // The position is closed at 9:45 p.m., local market time (France).
    DEFPARAM FlatAfter = 235500
    // No new position is taken after the candlestick that closes 5:15 p.m.
    LimitEntryTime = 164500//154500
    // The market analysis strats at the 15-minute candlestick which closes at 9:30 a.m.
    StartTime = 161500
    // Some holidays such as the 24th and 31st of December are excluded
    IF (Month = 5 AND Day = 1) OR (Month = 12 AND (Day = 24 OR Day = 25 OR Day = 26 OR Day = 30 OR Day =31)) THEN
    TradingDay = 0
    ELSE
    TradingDay = 1
    ENDIF
    // Variables which can be adapted based on your preferences
    PositionSize = 1
    AmplitudeMax = 80//58//80
    AmplitudeMin = 13//11//12
    OrderDistance = 4//4
    MinPercent = 35//30
    // We initialize this variable once at the beginning of the trading system.
    ONCE StartTradingDay = -1
    // The variables which can change during the day are initialized
    // at the beginning of each new trading day.
    IF (Time <= StartTime AND StartTradingDay <> 0) OR IntradayBarIndex = 0 THEN
    BuyLevel = 0
    SellLevel = 0
    BuyPosition = 0
    SellPosition = 0
    StartTradingDay = 0
    ELSIF Time >= StartTime AND StartTradingDay = 0 AND TradingDay = 1 THEN
    // We store the index of the first bar of the trading day
    IndexStartDay = IntradayBarIndex
    StartTradingDay = 1
    
    ELSIF StartTradingDay = 1 AND Time <= LimitEntryTime THEN
    // For each trading day, the highest and lowest price of the instrument
    // are recorded every 15 minutes since StartTime
    // until the buy and sell levels can be defined
    IF BuyLevel = 0 OR SellLevel = 0 THEN
    UpperLevel = Highest[IntradayBarIndex - IndexStartDay + 1](High)
    LowerLevel = Lowest [IntradayBarIndex - IndexStartDay + 1](Low)
    // Calculation of the difference between the highest
    // and lowest price of the instrument since StartTime
    DayDistance = UpperLevel - LowerLevel
    // Calculation of the minimum distance between the upper level and lower level
    // to consider a breakout of the upper or lower level to be significant
    MinDistance = DayDistance * MinPercent / 100
    // Calculation of the buy and sell levels for the day if the conditions are met
    IF DayDistance <= AmplitudeMax THEN
    IF SellLevel = 0 AND (Close - LowerLevel) >= MinDistance THEN
    SellLevel = LowerLevel + OrderDistance
    ENDIF
    IF BuyLevel = 0 AND (UpperLevel - Close) >= MinDistance THEN
    BuyLevel = UpperLevel - OrderDistance
    ENDIF
    ENDIF
    ENDIF
    // Creation of buy and sell short orders for the day if the conditions are met
    IF SellLevel > 0 AND BuyLevel > 0 AND (BuyLevel - SellLevel) >= AmplitudeMin THEN
    IF BuyPosition = 0 THEN
    IF LongOnMarket THEN
    BuyPosition = 1
    ELSE
    BUY PositionSize CONTRACT AT BuyLevel STOP
    ENDIF
    ENDIF
    IF SellPosition = 0 THEN
    IF ShortOnMarket THEN
    SellPosition = 1
    ELSE
    SELLSHORT PositionSize CONTRACT AT SellLevel STOP
    ENDIF
    ENDIF
    ENDIF
    ENDIF
    // Definition of the conditions to exit the market when a
    // buying or selling position is open
    
    //////////////////////////////////////////////////////////////////////////
    ////Trailing stop logikk
    //////////////////////////////////////////////////////////////////////////
    //trailing stop
    trailingstop = 45//15
    
    //resetting variables when no trades are on market
    if not onmarket then
    MAXPRICE = 0
    MINPRICE = close
    priceexit = 0
    endif
    
    //case SHORT order
    if shortonmarket then
    MINPRICE = MIN(MINPRICE,close) //saving the MFE of the current trade
    if tradeprice(1)-MINPRICE>=trailingstop*pointsize then //if the MFE is higher than the trailingstop then
    priceexit = MINPRICE+trailingstop*pointsize //set the exit price at the MFE + trailing stop price level
    endif
    endif
    
    //case LONG order
    if longonmarket then
    MAXPRICE = MAX(MAXPRICE,close) //saving the MFE of the current trade
    if MAXPRICE-tradeprice(1)>=trailingstop*pointsize then //if the MFE is higher than the trailingstop then
    priceexit = MAXPRICE-trailingstop*pointsize //set the exit price at the MFE - trailing stop price level
    endif
    endif
    
    //exit on trailing stop price levels
    if onmarket and priceexit>0 then
    EXITSHORT AT priceexit STOP
    SELL AT priceexit STOP
    endif
    //////////////////////////////////////////////////////////////
    ///Trailing stop logikk
    //////////////////////////////////////////////////////////////
    
    SET STOP ploss 55//55
    
    #18358 quote
    Alco
    Participant
    Senior

    My results are even better than Nicolas. But it has 6 ”0” bars. I don’t know if this is bad?

    breakout-5-min-brent.png breakout-5-min-brent.png
    #18363 quote
    Nicolas
    Keymaster
    Master

    @Alco

    Did you add spread? 0 bars trades are not a big problem if they are losers!

    #18364 quote
    reb
    Participant
    Master

    thks alco

     

    now it works perfect

    #18365 quote
    Alco
    Participant
    Senior

    Ok great! Spread = 3. I didn’t changed it from the original code.

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

Breakout Brent crudeoil "copy paste/adjusted"


ProOrder: Automated Strategies & Backtesting

New Reply
Author
Summary

This topic contains 89 replies,
has 20 voices, and was last updated by GraHal
7 years, 2 months ago.

Topic Details
Forum: ProOrder: Automated Strategies & Backtesting
Language: English
Started: 12/10/2016
Status: Active
Attachments: 33 files
Logo Logo
Loading...