Skip to content

Instantly share code, notes, and snippets.

@snjage
snjage / trendStrength.mql4
Created May 13, 2017 20:25 — forked from currencysecrets/trendStrength.mql4
Determining the strength of a trend can be utilised with this simple function. More details of this indicator found here: http://www.currencysecrets.com/882/identifying-weakest-strongest-currencies-measuring-trend
double trendStrength( int b = 52, int per = 0, string sym = "" ) {
if ( sym == "" ) { sym = Symbol(); }
if ( b * 2 < iBars( sym, per ) ) { b = MathFloor( iBars( sym, per ) * 0.5 ); }
double maDiff = iMA( sym, per, b, 0, MODE_SMA, PRICE_CLOSE, 0 ) - iMA( sym, per, b, 0, MODE_SMA, PRICE_CLOSE, b );
double strVal = maDiff / iATR( sym, per, b, 0 );
double result = strVal * MarketInfo( sym, MODE_TICKVALUE );
return ( result );
}
@snjage
snjage / trendline-orders.mq4
Created May 13, 2017 19:36 — forked from currencysecrets/trendline-orders.mq4
Entries and exits now in one script
string VERSION = "TL BO 1.0";
extern int EXT_ATR = 300; // ATR(x)
extern double EXT_ATR_INI_STOP = 0.1; // additional buffer to add beyond the initial stop
extern int EXT_LOOKBACK = 3; // number of bars to find highest high/lowest low
extern double EXT_RISK_MINAMT = 50; // dollar value of the minimum amount to risk per trade
extern double EXT_RISK_DIVISOR = 10; // AccountBalance/X = risk per trade
extern int EXT_MAX_SLIP = 10; // maximum points of slippage allowed for order 10 = 1 pip
extern double EXT_ATR_TRAILSTOP = 2; // multiple for trailing the market ATR(EXT_ATR) * X
@snjage
snjage / CSAutomatedTrendLines.mq4
Created May 13, 2017 19:32 — forked from currencysecrets/CSAutomatedTrendLines.mq4
Plots automated trend lines and horizontal support and resistance lines on existing chart. This represents now version 3.0 of this script as it has had a rewrite on the level of swings, rather than limiting it to 3 levels through a series of multiple if-statements! This script will also form the basis for the automated trading aspect, so expect …
//+------------------------------------------------------------------+
//| CS Trend Line Breakout.mq4 |
//| Ryan Sheehy |
//| http://www.currencysecrets.com |
//| Version: 3.0 |
//| Released: 7 Jan 13 |
//+------------------------------------------------------------------+
#property copyright "Ryan Sheehy"
#property link "http://www.currencysecrets.com"
@snjage
snjage / automatedTrendLines.mq4
Created May 13, 2017 19:31 — forked from currencysecrets/automatedTrendLines.mq4
MQL4: Automated Trend Lines
//+------------------------------------------------------------------+
//| Automated Trend Lines.mq4 |
//| Ryan Sheehy, CurrencySecrets.com |
//| http://www.currencysecrets.com |
//+------------------------------------------------------------------+
#property copyright "Ryan Sheehy, CurrencySecrets.com"
#property link "http://www.currencysecrets.com"
/*
* This script automates the generation and plotting of sloping trend
@snjage
snjage / myMoneyManagement.mq4
Created May 13, 2017 19:29 — forked from currencysecrets/myMoneyManagement.mq4
MQL4: My Money Management
//+------------------------------------------------------------------+
//| My Money Management.mq4 |
//| Ryan Sheehy, CurrencySecrets.com |
//| http://www.currencysecrets.com |
//+------------------------------------------------------------------+
#property copyright "Ryan Sheehy, CurrencySecrets.com"
#property link "http://www.currencysecrets.com"
//--- input parameters
extern double xRiskPerTrade=1; // $ amount of risked per trade
@snjage
snjage / SimpleChannelBreakout.mq4
Created May 13, 2017 19:21 — forked from currencysecrets/SimpleChannelBreakout.mq4
This was the simple breakout system designed for the series on creating a MetaTrader 4 system in Sublime Text's text editor. The series can be found on our website http://www.currencysecrets.com.
//+------------------------------------------------------------------+
//| Simple Channel Breakout System.mq4
//| Copyright 2013, Ryan Sheehy
//| http://www.currencysecrets.com
//| v1.1 - errors fixed (getLots & multipleOrders)
//+------------------------------------------------------------------+
#property copyright "Copyright 2013, Ryan Sheehy"
#property link "http://www.currencysecrets.com"
//--- input parameters