Breakout Brent crudeoil "copy paste/adjusted"
12/10/2016 at 7:56 PM #18218
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:)
12/11/2016 at 7:16 AM #18227
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 ?
Reb12/11/2016 at 7:53 AM #18230
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 ?12/11/2016 at 10:08 AM #18234
Didn’t test it myself, but check out spread maybe..12/11/2016 at 10:55 AM #18235
I use a spread of 3 like IG does12/12/2016 at 7:33 AM #18265
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)12/12/2016 at 3:33 PM #18341
As french, I think we have the same time zone12/12/2016 at 3:39 PM #18342
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.12/12/2016 at 4:03 PM #1835112/12/2016 at 4:21 PM #18354
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)12/12/2016 at 4:43 PM #18357
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.
Alco123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121// 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 excludedIF (Month = 5 AND Day = 1) OR (Month = 12 AND (Day = 24 OR Day = 25 OR Day = 26 OR Day = 30 OR Day =31)) THENTradingDay = 0ELSETradingDay = 1ENDIF// Variables which can be adapted based on your preferencesPositionSize = 1AmplitudeMax = 80//58//80AmplitudeMin = 13//11//12OrderDistance = 4//4MinPercent = 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 THENBuyLevel = 0SellLevel = 0BuyPosition = 0SellPosition = 0StartTradingDay = 0ELSIF Time >= StartTime AND StartTradingDay = 0 AND TradingDay = 1 THEN// We store the index of the first bar of the trading dayIndexStartDay = IntradayBarIndexStartTradingDay = 1ELSIF 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 definedIF BuyLevel = 0 OR SellLevel = 0 THENUpperLevel = 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 StartTimeDayDistance = 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 significantMinDistance = DayDistance * MinPercent / 100// Calculation of the buy and sell levels for the day if the conditions are metIF DayDistance <= AmplitudeMax THENIF SellLevel = 0 AND (Close - LowerLevel) >= MinDistance THENSellLevel = LowerLevel + OrderDistanceENDIFIF BuyLevel = 0 AND (UpperLevel - Close) >= MinDistance THENBuyLevel = UpperLevel - OrderDistanceENDIFENDIFENDIF// Creation of buy and sell short orders for the day if the conditions are metIF SellLevel > 0 AND BuyLevel > 0 AND (BuyLevel - SellLevel) >= AmplitudeMin THENIF BuyPosition = 0 THENIF LongOnMarket THENBuyPosition = 1ELSEBUY PositionSize CONTRACT AT BuyLevel STOPENDIFENDIFIF SellPosition = 0 THENIF ShortOnMarket THENSellPosition = 1ELSESELLSHORT PositionSize CONTRACT AT SellLevel STOPENDIFENDIFENDIFENDIF// Definition of the conditions to exit the market when a// buying or selling position is open//////////////////////////////////////////////////////////////////////////////Trailing stop logikk////////////////////////////////////////////////////////////////////////////trailing stoptrailingstop = 45//15//resetting variables when no trades are on marketif not onmarket thenMAXPRICE = 0MINPRICE = closepriceexit = 0endif//case SHORT orderif shortonmarket thenMINPRICE = MIN(MINPRICE,close) //saving the MFE of the current tradeif tradeprice(1)-MINPRICE>=trailingstop*pointsize then //if the MFE is higher than the trailingstop thenpriceexit = MINPRICE+trailingstop*pointsize //set the exit price at the MFE + trailing stop price levelendifendif//case LONG orderif longonmarket thenMAXPRICE = MAX(MAXPRICE,close) //saving the MFE of the current tradeif MAXPRICE-tradeprice(1)>=trailingstop*pointsize then //if the MFE is higher than the trailingstop thenpriceexit = MAXPRICE-trailingstop*pointsize //set the exit price at the MFE - trailing stop price levelendifendif//exit on trailing stop price levelsif onmarket and priceexit>0 thenEXITSHORT AT priceexit STOPSELL AT priceexit STOPendif/////////////////////////////////////////////////////////////////Trailing stop logikk//////////////////////////////////////////////////////////////SET STOP ploss 55//5512/12/2016 at 4:48 PM #1835812/12/2016 at 4:54 PM #18363
Did you add spread? 0 bars trades are not a big problem if they are losers!12/12/2016 at 4:58 PM #18364
now it works perfect12/12/2016 at 4:59 PM #18365
Ok great! Spread = 3. I didn’t changed it from the original code.