Matriciel

Moving average trading system

Category: Strategies By: Matriciel Created: September 27, 2016, 3:25 PM
September 27, 2016, 3:25 PM
Strategies
17 Comments
Moving average trading system

EN / Hello everyone,

Here is an automatic trading strategy based on the Mobile Averages.

This code is very simple because I started in this discipline! 🙂

I need your help to optimize the code. I would like to filter out false signals in order to have more winning positions and reduce drawdown.

Thank you in advance for your help.

Best regards,

DJ

 

FR / Bonjour à tous,

Voici une stratégie de trading automatique basée sur les Moyennes Mobiles.

Ce code est très simple car je débute dans cette discipline ! 🙂

Je sollicite votre aide afin d’optimiser ce code. J’aimerais filtrer les faux signaux afin d’avoir davantage de positions gagnantes et réduire le drawdown.

Merci d’avance pour votre aide.

Bien cordialement,

DJ


// Définition des paramètres du code
DEFPARAM CumulateOrders = True // Cumul des positions activé

// Conditions pour ouvrir une position acheteuse
indicator1 = close
indicator2 = Average[100](close)*1.002
c1 = (indicator1 CROSSES OVER indicator2)

indicator3 = close
indicator4 = Average[1000](close)
c2 = (indicator3 > indicator4)

IF c1 AND c2 THEN
BUY 1 CONTRACT AT MARKET
ENDIF

// Conditions pour fermer une position acheteuse
indicator5 = close
indicator6 = Average[100](close)*0.998
c3 = (indicator5 CROSSES UNDER indicator6)

IF c3 THEN
SELL  AT MARKET
ENDIF

// Conditions pour ouvrir une position en vente à découvert
indicator7 = close
indicator8 = Average[100](close)*0.998
c4 = (indicator7 CROSSES UNDER indicator8)

indicator9 = close
indicator10 = Average[1000](close)
c5 = (indicator9 < indicator10)

IF c4 AND c5 THEN
SELLSHORT 1 CONTRACT AT MARKET
ENDIF

// Conditions pour fermer une position en vente à découvert
indicator11 = close
indicator12 = Average[100](close)*1.002
c6 = (indicator11 CROSSES OVER indicator12)

IF c6 THEN
EXITSHORT  AT MARKET
ENDIF

Download
Filename: Moving-Average-TS-Matriciel.itf
Downloads: 420
Matriciel
Matriciel Master
Developer by day, aspiring writer by night. Still compiling my bio... Error 404: presentation not found.
Author’s Profile

Comments

Matriciel
10 years ago
#

Hi Chaostrader82,
You know, I'm starting in automatic strategy coding so I'm not going to be able to help you a lot.

chaostrader82
10 years ago
#

Theres some bugs still with this program , can somebody help to improve on the following?

Improvements needed 

  1. BUY if current close is higher than previous close 
  2. No stoploss or take profit settings 

Notes : Strategy only works in a upward trending market, heavy losses in a downward or whipped saw trend 

chaostrader82
10 years ago
#

Dear Matriciel , can you add in the following ? stoploss=30pips , take profit= 4pips <=== after you are done pls paste it back here. Thanks 

chaostrader82
10 years ago
#

Dear Matriciel , you should try removing these 1.0998 , 0.0998 , these functions actually draws down your profits .I made it more cleaner but it is for scalping only. i only tested on some of the pairs so far. maybe you want to have a further look at it. This is only for a trending market that has a definate trend, if its a sideway market dont use this because the MAs will trigger and you will get whipped sawed.

// Conditions pour ouvrir une position acheteuse setting (1000units 15mins chart )
indicator1 = close
indicator2 = Average[5](close)
c1 = (indicator1 CROSSES OVER indicator2)

IF c1 THEN
BUY 3 CONTRACT AT MARKET
ENDIF

// Conditions pour fermer une position acheteuse
indicator3 = close
indicator4 = Average[7](close)
c2 = (indicator3 CROSSES OVER indicator4)

IF c2 THEN
BUY 3 CONTRACT AT MARKET
ENDIF

// Conditions pour ouvrir une position acheteuse
indicator5 = close
indicator6 = Average[60](close)
c3 = (indicator5 CROSSES OVER indicator6)

IF c3 THEN
SELL AT MARKET
ENDIF

chaostrader82
10 years ago
#

hi marticiel , can you email me at xxxx ? i want to work with you on the development of the codes 

Nicolas
10 years ago
#

Please dont put your email address publicly on the website. If you want to make a dev team for improvements of this strategy, I suggest you to make a new thread on the forums where everyone in interest should help. It makes senses since everything here is completely free and share the same sharing spirit. Thanks.

Matriciel
10 years ago
#

I wanted to say "take profit" and not "trailing stop" ... :)

Matriciel
10 years ago
#

Je voulais dire : "take profit" et non "trailing stop"... :)

chaostrader82
10 years ago
#

Hi Matriciel,

How do you change the limit to take profit ? kindly advice 

Matriciel
10 years ago
#

Hi Chaostrader82,

You can play with the value of the trailing stop.
This one works well : SET TARGET pPROFIT 300

PRT_kok
10 years ago
#

Amusante cette petite strat : elle est positive sur 200000 ut mais tu obtiens un DD de 78% du benefice et un profit factor de 1,10.

cordialement.

#

It's incredible, this little offset make big difference! dunno why..

Matriciel
10 years ago
#

These are the moving averages offset on the vertical axis.

#

what do 0.998 and 1.002 factors represents?

Matriciel
10 years ago
#

Hi Klaus,
I'm about 15 minutes time frame I trade on the DAX30.

Matriciel
10 years ago
#

Hi Klaus,
I'm about 15 minutes time frame and I trade on the DAX30.

klaus
10 years ago
#

Hi Matriciel,

on which timeframe and Indices does your code run?

ciao Klaus

ProRealCode ProRealCode
Loading...