Kenneth Kvistad

Brent Oil 5 minutes trading strategy

Category: Strategies By: Kenneth Kvistad Created: August 21, 2016, 7:12 PM
August 21, 2016, 7:12 PM
Strategies
85 Comments
Brent Oil 5 minutes trading strategy

It is an automated strategy used for Brent oil CFD on 5 minute chart with good results since October 2015 as i don’t have more data to run it.  Trailing stop code from Nicolas.

If anyone is able to run the backtest for a longer time  then please post it here.  As you will see, there is no 0 bars on the backtest.  Any idea for improving the code is welcome.

DEFPARAM CumulateOrders = False // Cumulating positions deactivated

//defparam flatbefore = 230000
//defparam flatafter = 065500

// Conditions to enter long positions
indicator1 = TimeSeriesAverage[12](close)
indicator2 = WilderAverage[60](close)
c1 = (indicator1 >= indicator2)

indicator3 = SMI[14,2,16](close)
c2 = (indicator3 CROSSES OVER -44)

IF c1 AND c2 THEN
 BUY 2 CONTRACT AT MARKET
ENDIF

// Conditions to enter short positions
indicator4 = TimeSeriesAverage[28](close)
indicator5 = WilderAverage[88](close)
c3 = (indicator4 <= indicator5)

indicator6 = SMI[8,1,16](close)
c4 = (indicator6 >= 45)

IF c3 AND c4 THEN
 SELLSHORT 2 CONTRACT AT MARKET
ENDIF

//////////////////////////////////////////////////////////////////////////
////Trailing stop logikk
//////////////////////////////////////////////////////////////////////////
//trailing stop
trailingstop = 34

//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

SET STOP ploss 62//20
SET TARGET pPROFIT 98//54

 

Download
Filename: brent-crude-eur1-mini-Live-acc..png
Downloads: 471
Download
Filename: Brent-Oil-5MIN-strategy.itf
Downloads: 1030
Kenneth Kvistad
Kenneth Kvistad Senior
This author is like an anonymous function, present but not directly identifiable. More details on this code architect as soon as they exit 'incognito' mode.
Author’s Profile

Comments

Stenozar
9 years ago
#

Thanks Reb; do you suggest any other strategy on Brent?

thanks

reb
reb
9 years ago
#

Hi Stenozar

Sorry in the library, could you use english pls ?

I don't use this strategy  live. I have followed it since the beginning and the results are not so good (less interesting than before mid 2016)

Reb

Stenozar
9 years ago
#

Buongiorno, qualcuno sta utilizzando in reale questa strategia? con quali risultati?

Grazie!

andre.vorster
10 years ago
#

volpiemanuel.

I back tested your strategy again now and could not find the same results as before. I will try and reproduce the results with some tweaking.
I did not run the strategy because the backtest on Oil does not seem stable to me. On IG the backest frames only goes back to about a month. 

 

volpiemanuele
10 years ago
#

@vorster

hi,

wich parameter do you use for your test with starting capital of 100$ ?And SL/TP which value ? Tanks

andre.vorster
10 years ago
#

Hi Kennith.

Only read your code now.

I tested on PRT 10.3

Tested your code with various capital and time frames. Even with intial capital of just $100 it performs well. Best results got from time frame 2min over 100,000 (x)units. Then the next good results are between 18-24min again. Strange in these time frames (18-24min) the graph only shows trade from 14March 2017 onwards. Before that is flatline.

For me personally it says a lot if code/autotrade performs well with initial small amount of capital.

Great code!! and nicely commented as well.!

Hope this helps.

Kenneth Kvistad
10 years ago
#

Hi..

I have been working for many months now and have not tested it or done anything since last I posted a tread here.

Anyone that have been running it on 10.3 backtest mode? I am now on vication and very eeger to start again soon

Abz
Abz
10 years ago
#

pro real time version 10.3 available for norwegian customer trough IG

akira220984
10 years ago
#

Hi Kenneth,

Do you have any updates for this strategy?

demoz
10 years ago
#

Keep us updated!

reb
reb
10 years ago
#

ok thks for the info Kenneth

Kenneth Kvistad
10 years ago
#

GAMMA. I dont know how ninja trader setup is.. it would e nice to test and see:)

 

To Reb: the new version will come february to IG.com , new version has inside candel information. So it will be more accurate an reliable when we backtest. That means that we can tweek the code better. 

Kenneth Kvistad
10 years ago
#

Hi everyone.

I tried to upload a screenshot of my live acc. That i started around 20july and ended around 20september.

Looks like i need to sit on computer since I cant upload from my phone.

I will try to do this later.

Anyway I run the automated startegy live and gained 1000euro before it had a drawdown  with 1000 euro, as many know I stopped the strategy since it had some few diffrenses with backtest and live but looks like we are close to figure something out.

Is there anybody who would like to run the strategy with a tick by tick version 10.3 prt.

I am a ig user and cant do.much before ig gets version 10.3 around february 2017

reb
reb
10 years ago
#

hi Kenneth

 for which reason are you waiting for the v10.3 ? What will be the impact about this strategy ?

Kenneth Kvistad
10 years ago
#



I have stoped the system due to diffrenses between backtest and live acc. I AM curently waiting til februry when ig relises new. Version for prt

GAMMA
10 years ago
#

i can run it on ninja trader for more time  i need the help to setup you can back test all the way 3 years

thank you in advance.

GAMMA
10 years ago
#

i can run it on ninja trader for more time  i need the help to setup

thank you in advance.

GAMMA
10 years ago
#

can we run on crude oil (CL) and (NG) @ ninja trader platform

JakeDB
10 years ago
#

HI There, 

Can someone explain what this part of the code means? I have come across it a few times & have NFI what it means. 

// Variables that would be adapted to your preferences
if time = 174500 then

Regards. 

John
10 years ago
#

@ rev

You 'd best write that problem to IG.

They should sort out why there was a dfference and wether the problem is IG or PRT.

It must become clear to you as a customer what happened exactly. You are paying fees to IG for the brokerage.

If the answers of IG are not satisfying PRT should be informed about that. PRT supplies their software to IG, so IG is a customer of PRT. If IG gives wrong prices or their integrity is in doubt, PRT should be aware of that.

 

JOHANFOHLIN
10 years ago
#

Hello Kenneth! Thank you for sharing this strategy. I have one question; how did you calculate the amount of pips to set as your profit target and stop loss?

Best Regards,

Johan

Kenneth Kvistad
10 years ago
#


There are some.diffrenses yes. PRT can be a pain.in the xxx..

Its nothing to do about it. I BELIVE this is for all automaded strategies in.backtest and live acc. It will.never be 100% accurate is my belife. Mybe in the new prt version it will.be more realistic??

 

reb
reb
10 years ago
#

Hi Kenneth, hi all

I find a new difference between PRT and IG

On the 23rd, sept, the strat  opened a short at 11:50 (Paris, Berlin time) and was stopped by IG at 15:32 (because trailing stop moved the stop at 4818 at 15h10)

The backtest doesn't recalculate the stop. So, it was never reached and the TP was reached a few hours later.

In one week, there are 2 differences between IG and PRT. The consequence is a difference of - 160 pips

Did you notice that before ?

Regards,

Reb

Kenneth Kvistad
10 years ago
#

Hi everyone. 

I have been on vication so I have not seen or done anyhing with all the posts or the strategy. 

I am currently still running it with not too much profits yet.

Why the backtest did a position while the live acc. Did I have no clue about it.

The best guy to answer for this is mybe Nicolas or someone else that have doen PRT longer than me. 

 

 

dajvop
10 years ago
#

Also on my live account a position opened on Friday 16 and ran for 457 bars with a loss on Monday.

This did not happen on backtest.

 

David

ALEALE
10 years ago
#

Dear David,

In my live account no position is opened on fryday evening, but was open in demo account.

Abz
Abz
10 years ago
#

Hallo Kenneth ,

Følger du selv denne koden , hvordan syns du det fungerer?

ALEALE
10 years ago
#

Could be a malfunction of the demo account

ProRealCode ProRealCode
Loading...