davidelaferla

Universal XBody Strategy on Jp Morgan Chase (1Day)

Category: Strategies By: davidelaferla Created: August 22, 2023, 4:55 PM
August 22, 2023, 4:55 PM
Strategies
8 Comments
Universal XBody Strategy on Jp Morgan Chase (1Day)

here is the same strategy (other one can be found here) with the parameters adapted to follow the movements of the shares of the famous JP Morgan Chase bank.

//-------------------------------------------------------------------------
// Codice principale : Universal XBody Strategy
//-------------------------------------------------------------------------
//Universal XBody STrategy
// instrument: Jp Morgan Chase
// timeframe : Daily
// Spread: 0.3
// created and coded by davidelaferla
//————————————————————————-
//-------------------------------------------------------------------------
defparam cumulateorders=false
 
//***********************************************************************************************************

//------------------ SYSTEM VARIABLES---------------------------------------
//CAC40 Values:      -------------------------------------------- Ottimization info
period=578// Optimize best value for each Symbol, range=1-1000, with step=1
mode=2// Optimize the best trading mode , range=1-4, with step=1
invertsignal=1// 1=positive signal, -1=negative signal, range=-1-1, with step=2
//***********************************************************************************************
//------------------ SYSTEM FILTER---------------------------------------
filter1=46// to set after the variable optimization, range=1-100, with step=1
filter2=1// to set after the variable optimization, range=1-100, with step=1
//------------------ INDICATOR ---------------------------------------

n=5
giorno=opendayofweek
body=close-open
var=(body-body[1])
sumvar=summation[period](var)
if sumvar>filter1*pipsize then
green=(sumvar)
endif
if sumvar<-filter2*pipsize then
red=(sumvar)
endif
 
if mode=1 then
c1=red<red[1]
c2=green>green[1]
endif
if mode=2 then
c1=red>red[1]
c2=green<green[1]
endif
if mode=3 then
c1=red<red[1]
c2=green<green[1]
endif
if mode=4 then
c1=red>red[1]
c2=green>green[1]
endif
if c1 then
signal=1*invertsignal
elsif c2  then
signal=-1*invertsignal
endif

// Conditions for entering long positions and exit short positions
IF signal>0 and opendayofweek<5 then
BUY n contract AT market
ENDIF
// Conditions for entering short positions and exit long positions
IF signal<0 and opendayofweek<5 THEN
SELLSHORT n CONTRACTs AT market
ENDIF

Download
Filename: Universal-XBody-Strat-JpMorgan.itf
Downloads: 153
davidelaferla
davidelaferla Average
Code artist, my biography is a blank page waiting to be scripted. Imagine a bio so awesome it hasn't been coded yet.
Author’s Profile

Comments

Maik2404
2 years ago
#

Musiar können sie den code des automatischen systems teilen.

Musiar
2 years ago
#

Hi Davide, You have done a great job: I modified a bit your strategy for Nasdaq, and now I am in automatic trading with it.

Germano77
3 years ago
#

hello, thx for sharing, but wich broker do you use? At IG I got the notification "automatic trading not allowed for this instrument" thanks

YvesRobert
3 years ago
#

Hello daviddelaferla. Ok, but to optimize period and mode, filter1 and filter2 must be 0 or 1, or... ? Thank you

davidelaferla
3 years ago
#

Hello YvesRobert! To optimize period and mode, filter1 and filter2 must be 0

YvesRobert
3 years ago
#

Hello, how is it possible to optimized the 3 parameters (period, filter1 and filter2) at the same time because combinations number is over than 10000 ? Thank you.

davidelaferla
3 years ago
#

Follow these instructions: first optimize the period and the mode (leaving invertsignal=1 ) , and then optimize filters 1 and 2

lesmicard
3 years ago
#

you cant really use 0.3 spread since u got like 5 or 15 dollars cost when you open and close a postion on action . So your backtest isnt actually good .

ProRealCode ProRealCode
Loading...