Rule Book EA

Maverick

Master Trader
Apr 3, 2014
323
3
79
Bournemouth UK
I have tested the water with MQL4 code now I want to jump in at the deep end and create my first EA :)

It started with me thinking that a Crossover Close Position would be a script - Not so apparently :(

If I am going to create an EA then it should be Multi Purpose in my opinion and facilitate more rules being added as and when.

This is my first draft

Rule Book EA.png

Rule # 1 was an earlier idea of mine that never got started unfortunately :(
Rather than wait for the dreaded Margin Call to clean you out this rule closes the trade/bet when you get down to your original investment - Live to trade another day :)

I suppose the variable could be the + amount because the EA should already know your original Balance ?

Rule # 2 closes the position/bet when the market crosses the chosen MA

Rule # 3, 4, 5 etc ready and waiting New Rules to be added

MQL4 CODERS WANTED

I don't just want this making for me . . . I want to be hands on :)

U could B2

Where do I start ?

PS . . . Yes I spreadbet rather than trade but the proposed EA should work for either/or
.
 

Maverick

Master Trader
Apr 3, 2014
323
3
79
Bournemouth UK
With zero help I have got the ball rolling
MQL4:
//+------------------------------------------------------------------+
//|                                                    Rule_Book.mq4 |
//|                                       Copyright 2016, Earn_Forex |
//|                                        https://www.earnforex.com |
//|                                          Original Idea: Maverick |
//|                      Assissted by: GET YOUR NAME HERE BY HELPING |
//+------------------------------------------------------------------+
#property copyright "Copyright 2016, Earn_Forex"
#property link      "https://www.earnforex.com"
#property version   "1.00"
#property strict
//+------------------------------------------------------------------+
//| Expert initialization function                                   |
//+------------------------------------------------------------------+
int OnInit()
  {

Now what ?
.
 

Maverick

Master Trader
Apr 3, 2014
323
3
79
Bournemouth UK
For the life of me I can't figure out why I can't get Adjustable MA to open on a chart :(
Loaded in Experts folder and it has been Compiled . . . H'mmm
 

Maverick

Master Trader
Apr 3, 2014
323
3
79
Bournemouth UK
I was sure Adjustable MA was an EA but it works in indicators . . . strange

Although I have yet to figure out why it doesn't show any lines nor are their any in inputs

Adjustable_MA.png
 

Maverick

Master Trader
Apr 3, 2014
323
3
79
Bournemouth UK
Haven't got a clue really . . . but I have made a start
MQL4:
//----------------------- INCLUDES
#include <stdlib.mqh>
 
//----------------------- EA PARAMETER
extern string
         Expert_Name       = "---------- Rule_Book v1.0";
 
         MA_Setting        = "---------- Moving Average Setting";
extern int
         MAPeriod          = 12,
         MAMethod          = 1,   //0:SMA 1:EMA 2:SMMA 3:LWMA
         MAPrice           = 0;   //0:CLOSE 1:OPEN
 

Maverick

Master Trader
Apr 3, 2014
323
3
79
Bournemouth UK
Hopefully the end result . . . Not entering the trade But closing the trade I opened manually

CrossOver.png

Not totally sure about the type and size of the MA at the moment . . . Need to create the EA first.

Looks good on paper :)
.
 

Maverick

Master Trader
Apr 3, 2014
323
3
79
Bournemouth UK
If only it was as simple as Open and Close . . . forgot to take the High and Low into consideration :(

I had turned the wicks off :(